diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index a26d4ec..2de1091 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -1,5 +1,5 @@ name: Test & Deploy Waitlist -run-name: ${{ gitea.ref_name }} → Docker LXC +run-name: ${{ gitea.ref_name }} → Production on: push: @@ -36,7 +36,7 @@ jobs: - name: Run Tests run: pytest tests/ -v --tb=short - # ── 2. Deploy to Docker LXC via SSH ───────────────────────────────── + # ── 2. Deploy to production via SSH ───────────────────────────────── deploy: needs: test runs-on: ubuntu-latest @@ -52,6 +52,7 @@ jobs: script: | set -e DEPLOY_DIR="/opt/adiuvai-waitlist" + WAITLIST_DIR="$DEPLOY_DIR/waitlist" REPO_URL="http://10.0.0.119:3000/${{ gitea.repository }}.git" TAG="${{ gitea.ref_name }}" @@ -60,13 +61,13 @@ jobs: git clone --depth 1 --branch "${TAG}" "${REPO_URL}" adiuvai-waitlist-deploy # ── Sync source (preserve .env) ── + mkdir -p "$WAITLIST_DIR" cp -rf /tmp/adiuvai-waitlist-deploy/app/ \ /tmp/adiuvai-waitlist-deploy/alembic/ \ /tmp/adiuvai-waitlist-deploy/alembic.ini \ /tmp/adiuvai-waitlist-deploy/Dockerfile \ - /tmp/adiuvai-waitlist-deploy/docker-compose.yml \ /tmp/adiuvai-waitlist-deploy/requirements.txt \ - "$DEPLOY_DIR/" + "$WAITLIST_DIR/" rm -rf /tmp/adiuvai-waitlist-deploy # ── Verify .env ── @@ -75,22 +76,22 @@ jobs: exit 1 fi - # ── Build & restart ── + # ── Build & restart waitlist container ── cd "$DEPLOY_DIR" - docker compose build app - docker compose up -d --no-deps --force-recreate app + docker compose build waitlist + docker compose up -d --no-deps --force-recreate waitlist # ── Migrations (runs inside the container) ── - docker compose exec -T app alembic upgrade head + docker compose exec -T waitlist alembic upgrade head # ── Health check ── echo "Waiting for app..." sleep 5 - HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8001/health) + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80/health) if [ "$HTTP_CODE" -eq 200 ]; then echo "✅ Waitlist service is healthy (HTTP ${HTTP_CODE})" else echo "❌ Health check failed (HTTP ${HTTP_CODE})" - docker compose logs app --tail=50 + docker compose logs waitlist --tail=50 exit 1 fi