From 9e5fb7cb40b8f3e9823456d90382c6b7eceb7d9f Mon Sep 17 00:00:00 2001 From: WangDL Date: Mon, 18 May 2026 14:44:39 +0800 Subject: [PATCH] fix: add backend health check + HTTPS nginx config with SSL support --- .gitea/workflows/deploy.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 67218c0..b4393b0 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -25,14 +25,32 @@ jobs: - name: Remove old container run: docker rm zhixi-api 2>/dev/null || true + - name: Ensure infrastructure is ready + run: | + # Create network if missing + docker network inspect zhixi-net >/dev/null 2>&1 || docker network create zhixi-net + + # Start MySQL + Redis via docker compose (try common locations) + for dir in /opt/zhixi /root/zhixi /tmp/api-server; do + if [ -f "$dir/docker-compose.yml" ]; then + cd "$dir" && docker compose up -d mysql redis 2>/dev/null || true + break + fi + done + sleep 3 + - name: Start new container run: | + ENV_FILE="" + if [ -f /etc/zhixi/.env.production ]; then + ENV_FILE="--env-file /etc/zhixi/.env.production" + fi docker run -d \ --name zhixi-api \ --network zhixi-net \ --restart unless-stopped \ -p 3001:3000 \ - --env-file /etc/zhixi/.env.production \ + $ENV_FILE \ zhixi-api:latest - name: Health check