Some checks failed
Backend Maven CI / backend-local (push) Has been cancelled
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
886 B
Bash
36 lines
886 B
Bash
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
# RC 部署仅需要一个本机 Redis 缓存/会话实例;密码从私有 env 读取,配置文件仅 root 可读。
|
||
ROOT="${MUSE_RC_ROOT:-/opt/muse-rc1}"
|
||
ENV_FILE="${MUSE_INFRA_ENV:-/root/.config/muse-repo/infra.env}"
|
||
REDIS_PORT="${MUSE_REDIS_PORT:-6379}"
|
||
|
||
if [[ -f "${ENV_FILE}" ]]; then
|
||
set -a
|
||
# shellcheck disable=SC1090
|
||
source "${ENV_FILE}"
|
||
set +a
|
||
fi
|
||
|
||
if [[ -z "${MUSE_REDIS_PASSWORD:-}" ]]; then
|
||
echo "缺少 MUSE_REDIS_PASSWORD,拒绝启动 Redis。" >&2
|
||
exit 1
|
||
fi
|
||
|
||
install -d -m 700 "${ROOT}/redis" "${ROOT}/logs" "${ROOT}/run"
|
||
umask 077
|
||
cat > "${ROOT}/redis/redis.conf" <<EOF
|
||
bind 127.0.0.1
|
||
port ${REDIS_PORT}
|
||
protected-mode yes
|
||
requirepass ${MUSE_REDIS_PASSWORD}
|
||
dir ${ROOT}/redis
|
||
dbfilename dump.rdb
|
||
appendonly no
|
||
save ""
|
||
logfile ${ROOT}/logs/redis.log
|
||
EOF
|
||
|
||
exec redis-server "${ROOT}/redis/redis.conf" --daemonize no
|