From a67fdba170c394dbc039cb5dae10407c4da130a2 Mon Sep 17 00:00:00 2001 From: Jerod Hodgkin Date: Thu, 16 Jul 2026 00:24:57 -0600 Subject: [PATCH] Make GitHub production deploy robust on first two-service run - fetch+reset instead of pull (survives working-tree drift on CT111) - create api/.env from example and the external web network if missing - health check now retries for 120s and fails the run properly Co-Authored-By: Claude Fable 5 --- .github/workflows/deploy.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5c90a24..4c59b54 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,11 +17,16 @@ jobs: - name: Pull latest changes run: | cd /opt/lisilou-portfolio - git pull origin main - + git fetch origin main + git reset --hard origin/main + - name: Build and restart containers run: | cd /opt/lisilou-portfolio + # First-run prerequisites for the two-service stack: + # compose requires api/.env to exist and the external "web" network + if [ ! -f api/.env ]; then cp api/.env.example api/.env; fi + docker network inspect web >/dev/null 2>&1 || docker network create web docker compose build docker compose up -d docker compose ps @@ -32,5 +37,12 @@ jobs: - name: Verify deployment run: | - sleep 5 - curl -f http://localhost:8080/health || echo "Health check failed" + for i in $(seq 1 24); do + if curl -sf http://localhost:8080/health >/dev/null; then + echo "Healthy after $((i*5))s" + exit 0 + fi + sleep 5 + done + echo "Health check failed after 120s" + exit 1