thread-master/deploy
王性驊 f2ca28c1d5 fix2 2026-06-28 18:19:16 +08:00
..
.env.dev fix2 2026-06-28 18:08:43 +08:00
.env.example fix2 2026-06-28 18:08:43 +08:00
Dockerfile.backend fix2 2026-06-28 18:08:43 +08:00
Dockerfile.node-worker fix2 2026-06-28 18:19:16 +08:00
Dockerfile.web fix2 2026-06-28 18:08:43 +08:00
README.md fix2 2026-06-28 18:08:43 +08:00
docker-compose.dev.yml fix2 2026-06-28 18:08:43 +08:00
docker-compose.yml fix2 2026-06-28 18:08:43 +08:00
nginx.conf fix2 2026-06-28 18:08:43 +08:00

README.md

巡樓部署Docker 一鍵啟動)

整套系統用單一 docker compose 拉起,對外只開前端 :80

瀏覽器 → web(nginx :80)
            ├─ 前端靜態檔vite build
            └─ /api 反代 → gateway:8890
gateway / workerGo─┐
node-workerplaywright┤→ Mongo / Redis同網路不對外
容器 角色
mongo / redis 資料層(只綁 127.0.0.1volume 持久化)
init run-once建索引 / 權限 / 第一個 admin冪等跑完即退
gateway API + scheduler + reaper:8890僅內網
worker Go job worker
node-worker playwright style-8d
web nginxserve 前端 + 反代 /api

一鍵啟動

cp deploy/.env.example deploy/.env   # 填密碼與 secret
make up                              # = docker compose up -d --build

啟動順序由 depends_on + healthcheck 保證Mongo/Redis 健康 → init 跑完 → gateway/worker 起來 → gateway 健康 → node-worker/web 起來。

常用指令

make ps             # 狀態
make logs           # 全部日誌
make logs-gateway   # 只看 gateway
make down           # 停(保留資料)
make down-clean     # 停並清空 Mongo/Redis volume
make rebuild        # 無快取重建並重啟
make init           # 重跑一次 DB 初始化

健康檢查

curl http://localhost/api/v1/health

產生 secret

openssl rand -base64 48   # JWT access / refresh / worker secret
openssl rand -base64 32   # HAIXUN_SECRETS_KEY機敏資料落地加密

注意事項

  • deploy/.env 內含 secret不要 commit。
  • MONGO_ROOT_PASSWORD 建議只用英數字;含 @ : / $ 等字元時compose 內的 HAIXUN_MONGO_URI 需自行 URL-encode。
  • 全系統時間 UTC+0容器 TZ=UTC)。
  • 本機開發(不全容器化)見根目錄 make dev