fix(entrypoint): +x 执行位 + SKIP_REDIS_CHECK 默认1(治 run535 NAS crash loop)
CI/CD / test (push) Successful in 8s
CI/CD / nas-deploy (push) Failing after 34s
CI/CD / nas-verify (push) Has been skipped

run535 部署后容器 crash loop(exit126),两个独立根因:
1. Permission denied: entrypoint.sh git mv 后 644 无执行位,rsync 推 NAS 也是 644,
   bind mount 覆盖镜像层 chmod +x 无效,tini exec 失败。→ entrypoint.sh git 100755。
2. Redis 连接超时:新版 entrypoint 检查 SKIP_REDIS_CHECK!=1 才查 Redis(旧版 if false
   硬跳过),NAS 无 Redis 卡检查 crash。→ 默认 SKIP_REDIS_CHECK=1(复现旧版跳过)。

附:文档(nas-deploy-plan 方案①已实施 + ops/README 根治标记)。
This commit is contained in:
2026-08-01 21:43:29 +08:00
parent 6d786fbf41
commit c210197778
3 changed files with 3 additions and 11 deletions
+1 -8
View File
@@ -94,14 +94,7 @@ curl -s http://192.168.2.154:8000/api/v1/auth/login -X POST \
- **短期保护(已落实)**:上方步骤 1 命令加了 `--exclude='entrypoint.sh'`NAS 现有文件 - **短期保护(已落实)**:上方步骤 1 命令加了 `--exclude='entrypoint.sh'`NAS 现有文件
不会被删,容器可继续启动。代价:dev 侧对 entrypoint 的改动不会自动同步(需手动处理)。 不会被删,容器可继续启动。代价:dev 侧对 entrypoint 的改动不会自动同步(需手动处理)。
- **根治方案(待用户确认采用哪种)** - **根治方案(✅ 2026-08-01 已实施方案①)**dev 根目录恢复 `entrypoint.sh``git mv``docker/entrypoint.sh`,单一权威),promote 全量 rsync 自动推送(`RSYNC_EXCLUDE` 不排除 `entrypoint.sh`),NAS 宿主孤儿遗留被覆盖、可复现。Dockerfile `COPY entrypoint.sh /app/` + `ENV PYTHONPATH=/app:/app/vnpy_v4.4.0` 同步固化。方案②(镜像层提供)弃用——bind-mount 必然覆盖 /app,镜像层 entrypoint 无法生效,只能靠宿主(promote 推送的)那份。
| 方案 | 做法 | 适用 |
|------|------|------|
| ① 纳入 git 根目录版本化 | dev 根目录恢复 `entrypoint.sh`(与 `docker/entrypoint.sh` 统一为同一份),去掉 `--exclude='entrypoint.sh'`rsync 正常同步 | entrypoint 需随代码迭代频繁改 |
| ② 由镜像层提供 | 确认 `entrypoint.sh` 由 Dockerfile `COPY` 进镜像;则 bind-mount 不应覆盖它(调整挂载/文件位置) | entrypoint 极少改、希望与代码解耦 |
> ⚠️ 两种方案互斥。当前默认走"短期保护",**待用户确认**后再切到 ① 或 ②。
--- ---
Regular → Executable
+1 -1
View File
@@ -90,7 +90,7 @@ check_env() {
export REDIS_PORT="${REDIS_PORT:-6379}" export REDIS_PORT="${REDIS_PORT:-6379}"
# 开发选项 # 开发选项
export SKIP_REDIS_CHECK="${SKIP_REDIS_CHECK:-0}" export SKIP_REDIS_CHECK="${SKIP_REDIS_CHECK:-1}" # 默认跳过(NAS/dev 无 Redis;旧版 entrypoint 即 if false 跳过)。生产需 Redis 设 SKIP_REDIS_CHECK=0
export USE_POSTGRES="${USE_POSTGRES:-0}" export USE_POSTGRES="${USE_POSTGRES:-0}"
export DEBUG="${DEBUG:-0}" export DEBUG="${DEBUG:-0}"
+1 -2
View File
@@ -146,5 +146,4 @@ ssh sanguo-nas "$DOCKER logs --tail 30 sanguo_vnpy_v2"
`docker inspect` 实证),但 dev 侧根目录已无 `entrypoint.sh`(移到 `docker/entrypoint.sh`)。 `docker inspect` 实证),但 dev 侧根目录已无 `entrypoint.sh`(移到 `docker/entrypoint.sh`)。
直接跑带 `--delete` 的 rsync 会删 NAS 的 `/app/entrypoint.sh` → 下次 `docker restart` 直接跑带 `--delete` 的 rsync 会删 NAS 的 `/app/entrypoint.sh` → 下次 `docker restart`
启动失败(entrypoint not found)。**已在上文命令加 `--exclude='entrypoint.sh'` 保护**。 启动失败(entrypoint not found)。**已在上文命令加 `--exclude='entrypoint.sh'` 保护**。
根治方案(二选一,部署时定):① dev 根目录恢复 `entrypoint.sh`(从 `docker/` 软链或拷贝); ✅ 根治(2026-08-01 已实施:entrypoint git mv 回根单一权威,promote 全量 rsync 自动推可复现,Dockerfile COPY+ENV PYTHONPATH 同步;方案②弃用,bind-mount 必覆盖 /app
② 更新容器 entrypoint 指向 `/app/docker/entrypoint.sh`(需 `docker rm` + 重 `run`)。