Skip to content

Add redis-cli static binary build & distribution tooling#1

Merged
AngelYanev merged 3 commits into
unstablefrom
add-redis-cli-static
Jul 6, 2026
Merged

Add redis-cli static binary build & distribution tooling#1
AngelYanev merged 3 commits into
unstablefrom
add-redis-cli-static

Conversation

@AngelYanev

@AngelYanev AngelYanev commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

This repository builds and distributes standalone, statically linked
redis-cli
binaries for Linux and macOS (amd64/arm64) and publishes them —
together with a curl | sh installer — to packages.redis.io.

redis-cli is frequently wanted on its own — on a laptop, a CI runner, an app
container, or a jump host — without installing or building the whole Redis
server, and without a package that also pulls in redis-server. The existing
options each have friction:

  • Distro packages (apt/dnf) are often outdated, tie the client version
    to the server package, and require root.
  • Building from source needs a toolchain and pulls all of Redis.
  • Docker isn't always available or appropriate for a one-off client.

A single static binary removes that friction: it has no runtime
dependencies
. Runs on any Linux distro including minimal/distroless/container images, and
installs in one command. Versions are pinnable via a stable URL, matching how
Redis already ships source tarballs.

What's included

  • build.sh — fetch a Redis version and build one static target → raw stripped
    binary + .sha256.
  • publish.sh — upload artifacts + install.sh to S3, with stable/latest
    pointers.
  • install.sh — OS/arch-detecting installer; checksum-verified; needs only
    curl/wget (no tar/gzip, so it works on the most minimal images);
    all logic wrapped in main() for curl | sh truncation safety.
  • test-distros.sh — Docker smoke tests across many distros.
  • .github/workflows/release_build_and_test.yml and release_publish.yml
    reusing build-and-test.yml, matching the redis-debian/redis-rpm layout.
    release_type: internal publishes to the staging bucket at its S3 URL;
    release_type: public publishes to the production bucket served at
    https://packages.redis.io.
  • README.md, LICENSE, .editorconfig, .redis_version, .gitignore.

Versioning

The version is the Redis version — this repo adds no numbering of its own.
Each build is published under an immutable, version-pinned path; stable and
latest are moving pointers to the newest promoted stable release (stable
matches the download.redis.io naming, latest the Docker one). Pre-releases
(e.g. 8.8-rc1) are installable by exact version but never move stable.

Install examples:

# latest stable
curl -fsSL https://packages.redis.io/redis-cli/install.sh | sh

# a specific version
curl -fsSL https://packages.redis.io/redis-cli/install.sh | REDIS_CLI_VERSION=8.4.4 sh

# direct, version-pinned download (no installer)
curl -fsSL https://packages.redis.io/redis-cli/8.4.4/redis-cli-8.4.4-linux-amd64 -o redis-cli

@AngelYanev
AngelYanev force-pushed the add-redis-cli-static branch 2 times, most recently from 20d8cb5 to b296cf1 Compare July 6, 2026 08:13
@AngelYanev
AngelYanev force-pushed the add-redis-cli-static branch from b296cf1 to f37fce2 Compare July 6, 2026 08:16
Comment thread .github/workflows/release_build_and_test.yml
Comment thread .github/workflows/release_publish.yml
Comment thread install.sh Outdated
if dl "${URL}.sha256" "$TMP/redis-cli.sha256" 2>/dev/null; then
info "verifying checksum"
expected="$(awk '{print $1}' "$TMP/redis-cli.sha256")"
actual="$(sha256 "$TMP/redis-cli")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe an error, there is no sha256 tool at least on Linux. Standard tool is named sha256sum it could calculate and check the sums at the same time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a function defined in lines 59-65. But now I am actually thinking that its better to refactor this and rename it properly to avoid confusions.

Comment thread install.sh
info "downloading $URL"
dl "$URL" "$TMP/redis-cli" || err "download failed: $URL"

if dl "${URL}.sha256" "$TMP/redis-cli.sha256" 2>/dev/null; then

@Peter-Sh Peter-Sh Jul 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general installers are hard-coding sums into the script. For example astral uv installer or nix installer.
But there are examples of installers which doesn't check any sums, like rust installer or bun installer. Rust installer relies on TLS trying to force higher TLS versions and to prevent fallback to http, bun installer just doesn't care.
Rust is using commands like this: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs

To be honest I don't know which is the best way to build a trust when using this form of installation. So just leaving this as a side-note.

Comment thread build.sh Outdated
# producing <src-root>/src/redis-cli. Passes static flags to the upstream
# Redis Makefile (we don't own it, so there's no custom target).
compile() {
co_os="$1"; co_arch="$2"; co_src="$3"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

co_arch variable is unused, I suggest using shellcheck to validate all the scripts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread build.sh
# fetch_redis <ref> <dest>: download + extract the Redis source into <dest>.
fetch_redis() {
fr_ref="$1"; fr_dest="$2"
fr_url="https://github.com/redis/redis/archive/${fr_ref}.tar.gz"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth hard-coding redis checksum as in docker and debian (but not rpm ha-ha, I should create a bug)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread install.sh Outdated
install -m 0755 "$TMP/redis-cli" "$DEST/redis-cli"
elif command -v sudo >/dev/null 2>&1; then
info "$DEST is not writable, using sudo"
sudo install -m 0755 "$TMP/redis-cli" "$DEST/redis-cli"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If DEST it not writable it may have not been created by mkdir since it runs without sudo and the install would fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread test-distros.sh
@@ -0,0 +1,90 @@
#!/usr/bin/env bash

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth running this as a part of CI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@AngelYanev
AngelYanev merged commit b8f1500 into unstable Jul 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants