MOD-18280 - make install default build (#15754)

<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Behavior change is limited to install defaults and safer config file
permissions during deploy; no auth or runtime data-path changes.
> 
> **Overview**
> **`make install` now runs a build before copying artifacts**, matching
upstream Redis behavior and aligning it with `make deploy`. The Makefile
no longer sets `install: SKIP_BUILD ?= 1`; install and deploy both
invoke `scripts/build.sh` unless you pass **`SKIP_BUILD=1`** (documented
for cases like `sudo make install` where compiling as root would pollute
`~/.cargo` and module build dirs).
> 
> The README adds an **Install** subsection with
`PREFIX`/`DESTDIR`/`uninstall` examples and the opt-out build flag.
> 
> **`scripts/deploy.sh`** updates header comments for the new defaults
and fixes config rewriting under `sudo`: before patching `loadmodule`
blocks, the temp file is seeded with **`cp -p`** on the existing conf so
**`mv` does not leave `redis.conf` / `redis-full.conf` at mode 0600 or
root-owned** when the user still needs to edit them.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
782c3bcd79. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: TalBarYakar <tal.baryakar@redis.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-09-07 14:44:00 +03:00
1 parent 60b4364fef
commit 0b0d1784b8
3 files changed
+37 -9

No files matched your search

+7 -7
View File
@@ -90,10 +90,11 @@ endif
.DEFAULT:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@; done
# `install` is an alias for `deploy` that does NOT build: it copies the
# artifacts already in the tree, like upstream's install. Rebuild with
# `make install SKIP_BUILD=0`, or just use `make deploy`.
install: SKIP_BUILD ?= 1
# `install` is an alias for `deploy` — same args, same PREFIX/DESTDIR. Like
# upstream's install it builds first; nothing already up to date is recompiled,
# because Redis core and each module short-circuit on their own artifacts. See
# the `sudo make install` note in README.md: redisearch and redisjson ask cargo
# whether they are up to date, so it has to be on root's PATH.
install: deploy
# clean [<name> ...|all|.|redis|none] — Redis core + selected modules.
@@ -118,7 +119,7 @@ bootstrap:
+@scripts/bootstrap.sh $(BOOTSTRAP_ARGS)
# deploy [<name> ...|all|.|redis|none] [PREFIX=<path>] [DESTDIR=<path>]
# [PROG_SUFFIX=<suffix>]
# [PROG_SUFFIX=<suffix>] [SKIP_BUILD=1]
# Install Redis core + selected modules (default: every cloned module),
# then rewrite the `loadmodule` paths in redis-full.conf (and redis.conf, if
# it carries a Modules block) to point at the installed .so paths under
@@ -127,8 +128,7 @@ bootstrap:
deploy: PREFIX ?= /usr/local
deploy:
+@PREFIX='$(PREFIX)' DESTDIR='$(DESTDIR)' PROG_SUFFIX='$(PROG_SUFFIX)' \
SKIP_BUILD='$(SKIP_BUILD)' \
scripts/deploy.sh $(DEPLOY_ARGS)
SKIP_BUILD='$(SKIP_BUILD)' scripts/deploy.sh $(DEPLOY_ARGS)
# uninstall [<name> ...|all|.|redis|none] [PREFIX=<path>] [DESTDIR=<path>]
# [PROG_SUFFIX=<suffix>]
+19
View File
@@ -314,6 +314,25 @@ make -j "$(nproc)"
> with no config file, or `make build redis && ./src/redis-server redis.conf`
> from a git checkout, where `redis.conf` has no module block at all.
#### 4. Install
```sh
make install PREFIX=/usr/local # core binaries + every built module
sudo make install # same, into the default /usr/local
make uninstall PREFIX=/usr/local # removes exactly what install placed
```
`install` is an alias for `deploy`: it builds first (nothing already up to date
is recompiled), copies `redis-server`, `redis-cli` and `redis-benchmark` plus
the three `redis-server` symlinks to `$PREFIX/bin`, each module's `.so` to
`$PREFIX/lib/redis/modules`, and rewrites the `loadmodule` paths in the
generated config to point there. `DESTDIR=<path>` stages the files for
packaging without changing the paths written to the config, and
`PROG_SUFFIX=<suffix>` installs suffixed program names (`redis-server-alt`, …).
> To install without building at all, use `SKIP_BUILD=1`:
> `sudo make install SKIP_BUILD=1`
### Building Redis - flags and general notes
Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD.
+11 -2
View File
@@ -7,10 +7,15 @@
# $PREFIX/lib/redis/modules/ - per-module .so files
# DESTDIR optional staging root prepended to PREFIX (for packaging).
# Where files are copied; never part of the conf's paths.
# SKIP_BUILD 1 = install what is already built, skip phase 1 entirely
# (the default for `make install`; `make deploy` builds).
# PROG_SUFFIX suffix appended to the core program names, matching
# `make PROG_SUFFIX=…` (src/Makefile). Modules are unaffected.
# SKIP_BUILD 1 = do not build, install the artifacts already in the
# tree. Not a default: `make install` and `make deploy` both
# build, and each module's build short-circuits on an
# up-to-date artifact anyway. Meant for
# `sudo make install SKIP_BUILD=1`, where compiling as root
# would leave root-owned files in ~/.cargo and
# modules/*/src/bin.
# MAKE make binary (defaults to `make`); only used when shelling
# into build.sh, which itself respects it.
#
@@ -174,6 +179,10 @@ if [ -n "$installed_modules" ]; then
grep -qF "$LOADMODULE_BEGIN" "$conf" 2>/dev/null || return 0
local tmp
tmp="$(mktemp "${conf}.deploy.XXXXXX")"
# Clone the conf's mode (and owner, when root) onto the temp file: mktemp
# creates it 0600, and the mv below would carry that — plus root ownership
# under `sudo` — onto a conf the user still has to write.
cp -p "$conf" "$tmp"
trap 'rm -f "$tmp" "$new_lines_file"' EXIT
awk -v begin="$LOADMODULE_BEGIN" -v end="$LOADMODULE_END" -v newfile="$new_lines_file" '
$0 == begin {