lili fd0f80b226
Some checks failed
Backend Maven CI / backend-local (push) Has been cancelled
docs(release): 记录mini部署证据
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 11:22:53 -07:00

36 lines
886 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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