mirror of
https://github.com/redis/redis.git
synced 2026-07-14 20:40:53 -04:00
Some checks are pending
CI / test-ubuntu-latest (push) Waiting to run
CI / test-sanitizer-address (push) Waiting to run
CI / build-debian-old (push) Waiting to run
CI / build-macos-latest (push) Waiting to run
CI / build-32bit (push) Waiting to run
CI / build-libc-malloc (push) Waiting to run
CI / build-centos-jemalloc (push) Waiting to run
CI / build-old-chain-jemalloc (push) Waiting to run
Codecov / code-coverage (push) Waiting to run
External Server Tests / test-external-standalone (push) Waiting to run
External Server Tests / test-external-cluster (push) Waiting to run
External Server Tests / test-external-nodebug (push) Waiting to run
Spellcheck / Spellcheck (push) Waiting to run
## Summary Redis core and the external modules (Search, JSON, Bloom, TimeSeries) are currently built and released through separate flows, forcing anyone assembling a full distribution to juggle multiple repos, refs, build commands, and config files. This PR collapses that into one Redis-owned workflow: ```sh make modules-update # clone/refresh modules from modules/modules.yaml make bootstrap # install per-module build/test deps make build # build Redis core + selected modules make run # start redis-server with modules loaded make test all # run module test suites make tarball TAG=... # build a reproducible source bundle ``` ## What This Adds **1. Manifest-driven modules** — `modules/modules.yaml` is the single source of truth for bundled modules. Each entry pins `repo`/`ref` and defines its build artifact and runtime `loadmodule` path. Refs resolve dynamically (tag → branch → SHA, else fail). Current pins: RedisBloom `v8.9.81`, RediSearch `v8.9.82`, RedisJSON `v8.9.81`, RedisTimeSeries `v8.9.82`. **2. Central manifest parser** — `scripts/lib/manifest.sh` is the only YAML reader, usable both as a shell library and a CLI helper (via `modules/manifest.mk`). **3. Per-module stub Makefiles removed** — The `modules/redis*/Makefile` stubs are deleted; their data moves to `modules.yaml` and shared behavior to `modules/common.mk`. ## Make Workflow The root `Makefile` is now a thin dispatch layer over scripts in `scripts/`: | Target | Script | Purpose | |---|---|---| | `make build [args]` | `scripts/build.sh` | Build Redis core plus selected modules | | `make bootstrap [args]` | `scripts/bootstrap.sh` | Install per-module build/test prerequisites | | `make setup [args]` | `scripts/setup.sh` | Run module update plus bootstrap | | `make run [args]` | `scripts/run.sh` | Start Redis with selected modules loaded | | `make test [args]` | `scripts/test.sh` | Run Redis or module tests | | `make clean [args]` | `scripts/clean.sh` | Clean Redis and/or module outputs | | `make deploy [args]` | `scripts/deploy.sh` | Install Redis and module artifacts | | `make modules-update [args]` | `scripts/modules-update.sh` | Clone/refresh module sources from the manifest | | `make modules-shallow [args]` | `scripts/modules-shallow.sh` | Re-clone selected modules with shallow history | | `make sync-redis-conf [args]` | `scripts/sync-redis-conf.sh` | Regenerate managed module config | | `make tarball TAG=...` | `scripts/tarball.sh` | Create a reproducible Redis + modules source tarball | All accept module selectors: ```sh make build all # core + all modules make build redisjson # core + one module make run none # core only, no modules make test redisearch TEST='some:test:name' ``` ## Runtime Configuration Removes the hand-maintained `redis-full.conf` (which could drift from upstream). Config is now generated: `sync-redis-conf.sh` produces a managed Modules block appended to verbatim `redis.conf`, with `loadmodule` lines (active when built or `ASSUME_BUILT=1`) plus each module's `module.conf`. The generated file is git-ignored. ## Docker & Release - **`docker/Dockerfile.noble`** — Ubuntu 24.04 build env for core + modules (amd64/arm64). - **`scripts/tarball.sh`** — reproducible source bundle: archives core at `TAG`, clones modules at pinned refs, strips `.git`/build artifacts, generates config, and produces a deterministic gzip. `utils/releasetools/01_create_tarball.sh` now delegates to it. - **`post-release-automation.yml`** — builds the bundle on published releases, uploads it as artifact + release asset, and reports SHA256. ## Docs `modules/MODULES.md` (operator guide), `modules/README.md`, and `README.md` cover the manifest schema, Make targets, tarball flow, Docker env, and troubleshooting. ## Compatibility Notes - `BUILD_WITH_MODULES=yes` is replaced by `make build [redis|core|none|all|<module>...]`. - `redis-full.conf` is now generated and git-ignored. - Module clones live under `modules/<name>/src/` (git-ignored). - `vector-sets` is omitted — it already lives in-tree. - RediSearch builds with `LTO=1 REDISEARCH_GENERATE_HEADERS=0 INLINE_LSE_ATOMICS=0`. --------- Co-authored-by: debing.sun <debing.sun@redis.com>
86 lines
3.6 KiB
Bash
Executable file
86 lines
3.6 KiB
Bash
Executable file
#!/bin/sh
|
|
# run.sh — start src/redis-server with selected modules auto-loaded.
|
|
#
|
|
# Usage: scripts/run.sh [<name> ...|all|.|'*'|none]
|
|
# Env: ARGS extra redis-server args/config (e.g. ARGS="--port 6400")
|
|
#
|
|
# Tokens:
|
|
# (no args) | all | . | '*' load every cloned module
|
|
# none start with no modules
|
|
# <name> [<name> ...] load only the named modules
|
|
#
|
|
# Locates each module's .so via TARGET_MODULE in modules/<name>/Makefile
|
|
# (handles redisjson → rejson.so), preferring <host_os>-<arch>-release/.
|
|
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)" || exit 1
|
|
. "$SCRIPT_DIR/lib/manifest.sh"
|
|
cd "$REPO_ROOT"
|
|
|
|
if [ ! -x src/redis-server ]; then
|
|
echo "ERROR: src/redis-server is not built. Run 'make build' (or 'make -C src all') first."
|
|
exit 1
|
|
fi
|
|
|
|
cloned="$(cloned_modules)"
|
|
# "core" is a "no modules" alias — same as "none".
|
|
_run_args="$*"
|
|
[ "$_run_args" = "core" ] && _run_args="none"
|
|
selected="$(resolve_modules "$_run_args" "$cloned" "none")"
|
|
|
|
# Detect whether the caller named modules explicitly. Wildcards ("", all, ., *)
|
|
# and the "none"/"core" tokens resolve without naming specific modules — in that
|
|
# case a missing .so is a warning (skip and continue). An explicit name means
|
|
# the user expects that module to load — a missing .so is a hard error.
|
|
case "${1:-}" in
|
|
""|all|.|'*'|none|core) explicit=0 ;;
|
|
*) explicit=1 ;;
|
|
esac
|
|
|
|
host_os="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
[ "$host_os" = "darwin" ] && host_os="macos"
|
|
|
|
load_flags=""
|
|
for name in $selected; do
|
|
# Resolve the .so basename from modules.yaml. Prefer `target_module:`
|
|
# (just-the-artifact), fall back to basename of `loadmodule:`, finally
|
|
# to `<name>.so` so we still try something even if both fields are empty.
|
|
so_base="$(basename "$(manifest_field "$name" target_module)")"
|
|
[ "$so_base" = "." ] || [ -z "$so_base" ] && so_base="$(basename "$(manifest_field "$name" loadmodule)")"
|
|
[ "$so_base" = "." ] || [ -z "$so_base" ] && so_base="$name.so"
|
|
|
|
# Each pipeline below ends in `|| true` because grep exits 1 on no match,
|
|
# which combined with `set -euo pipefail` on the parent shell would silently
|
|
# kill the whole script the moment a single un-built module shows up in the
|
|
# loop (the failure escapes the command substitution before the fallback
|
|
# `[ -z "$so_path" ]` chain ever runs). The `WARNING ... skipping` / error
|
|
# branch below is the intended "no .so" handling — keep grep failures out of $?.
|
|
candidates="$(find "modules/$name" -type f -name "$so_base" 2>/dev/null \
|
|
| grep -v -E '/(CMakeFiles|tests?|sample|samples|fixtures)/' || true)"
|
|
so_path="$(echo "$candidates" | grep -E "(^|/)$host_os-[^/]*-release(/|\$)" | head -1 || true)"
|
|
[ -z "$so_path" ] && so_path="$(echo "$candidates" | grep -E '(^|/)release(/|$)' | head -1 || true)"
|
|
[ -z "$so_path" ] && so_path="$(echo "$candidates" | grep -E '(^|/)[^/]*-release(/|$)' | head -1 || true)"
|
|
[ -z "$so_path" ] && so_path="$(echo "$candidates" | head -1 || true)"
|
|
|
|
if [ -z "$so_path" ]; then
|
|
if [ "$explicit" = "1" ]; then
|
|
echo "ERROR: $name is not built ($so_base not found under modules/$name)."
|
|
echo " Run 'make build $name' first."
|
|
exit 1
|
|
fi
|
|
echo "WARNING: no built $so_base found under modules/$name, skipping $name (did you run 'make build $name'?)"
|
|
continue
|
|
fi
|
|
echo "==> Loading $name from $so_path"
|
|
load_flags="$load_flags --loadmodule $so_path"
|
|
done
|
|
|
|
if [ -z "$load_flags" ]; then
|
|
echo "==> No modules selected; starting plain redis-server"
|
|
fi
|
|
|
|
# shellcheck disable=SC2086
|
|
echo "==> exec src/redis-server$load_flags ${ARGS:-}"
|
|
# shellcheck disable=SC2086
|
|
exec src/redis-server $load_flags ${ARGS:-}
|