feat(deploy): add redis compose uninstall; require Redis in install wizard

Step 2 blocks until Redis connects; uninstall-redis-compose.sh removes legacy
nexus-prod-redis container without touching host/1Panel Redis.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nexus Deploy
2026-06-06 02:51:52 +08:00
parent 536d520744
commit e42dc77127
6 changed files with 169 additions and 12 deletions
+11 -8
View File
@@ -99,7 +99,7 @@ def _build_redis_url(req: InitDbRequest) -> str:
def _resolve_redis_probe() -> tuple[str, int, str | None]:
"""Redis target for install wizard health check (Docker uses redis:6379, not host loopback)."""
"""Redis target for install wizard (Docker: host.docker.internal → 宿主机自建 Redis)."""
url = os.environ.get("NEXUS_REDIS_URL", "").strip()
if url:
parsed = urlparse(url)
@@ -442,9 +442,9 @@ async def env_check():
"pass": False,
})
# Redis — 用户自行安装(1Panel/宿主机),不阻塞安装向导
# Redis — 须先安装并连通(宿主机/1Panel);Docker 默认 host.docker.internal:6379
redis_ok = False
redis_msg = "检测"
redis_msg = "连接"
rh, rp, rpass = _resolve_redis_probe()
redis_label = f"{rh}:{rp}"
try:
@@ -454,20 +454,23 @@ async def env_check():
host=rh,
port=rp,
password=rpass or None,
socket_timeout=0.5,
socket_timeout=2.0,
)
r.ping()
redis_ok = True
redis_msg = f"✓ 已连接 {redis_label}"
except Exception as e:
redis_msg = f"未连接 {redis_label}(可继续,步骤3配置或稍后安装 Redis)— {e}"
redis_msg = (
f"连接失败: {e}(请先在宿主机/1Panel 安装 Redis"
f"Docker 部署须监听宿主机 6379 且 NEXUS_REDIS_URL 指向 {redis_label}"
)
except ImportError:
redis_msg = "redis 库未安装(可继续)"
redis_msg = "redis 库未安装"
checks.append({
"name": "Redis",
"required": "自行安装(步骤3配置)",
"required": "已连接",
"current": redis_msg,
"pass": True,
"pass": redis_ok,
})
# MySQL database — user configures in step 3