diff --git a/.gitea/workflows/promote-master.yaml b/.gitea/workflows/promote-master.yaml index b21366e..3c7c36f 100644 --- a/.gitea/workflows/promote-master.yaml +++ b/.gitea/workflows/promote-master.yaml @@ -303,6 +303,8 @@ jobs: cat > .env << EOF FRONTEND_URL=${{ secrets.PROD_FRONTEND_URL }} + BACKEND_HOST_PORT=${{ secrets.PROD_BACKEND_HOST_PORT }} + FRONTEND_HOST_PORT=${{ secrets.PROD_FRONTEND_HOST_PORT }} SECRET_KEY=${SECRET_KEY_VALUE} REFRESH_TOKEN_EXPIRY_DAYS=${{ secrets.PROD_REFRESH_TOKEN_EXPIRY_DAYS }} DIGEST_TOKEN_SECRET=${DIGEST_TOKEN_SECRET_VALUE} @@ -316,6 +318,15 @@ jobs: chmod 600 .env .rollback-meta + backend_host_port=$(grep '^BACKEND_HOST_PORT=' .env | head -n1 | cut -d '=' -f2- || true) + frontend_host_port=$(grep '^FRONTEND_HOST_PORT=' .env | head -n1 | cut -d '=' -f2- || true) + if [ -z "$backend_host_port" ]; then + backend_host_port="5001" + fi + if [ -z "$frontend_host_port" ]; then + frontend_host_port="4601" + fi + docker-compose down wait_for_container_removal() { @@ -350,8 +361,8 @@ jobs: wait_for_container_removal chores-app-frontend-prod wait_for_container_removal chores-app-backend-prod - wait_for_port_release 443 - wait_for_port_release 5001 + wait_for_port_release "$frontend_host_port" + wait_for_port_release "$backend_host_port" docker-compose pull docker-compose up -d @@ -362,12 +373,12 @@ jobs: frontend_running=$(docker inspect -f '{{.State.Running}}' chores-app-frontend-prod 2>/dev/null || echo false) backend_ok=false - if curl -fsS http://localhost:5001/version >/dev/null 2>&1; then + if curl -fsS "http://localhost:${backend_host_port}/version" >/dev/null 2>&1; then backend_ok=true fi frontend_ok=false - if curl -kfsS https://localhost/ >/dev/null 2>&1; then + if curl -kfsS "https://localhost:${frontend_host_port}/" >/dev/null 2>&1; then frontend_ok=true fi @@ -381,7 +392,7 @@ jobs: docker tag git.ryankegel.com:3000/kegel/chores/frontend:predeploy-backup git.ryankegel.com:3000/kegel/chores/frontend:latest || true docker-compose up -d sleep 20 - curl -fsS http://localhost:5001/version >/dev/null + curl -fsS "http://localhost:${backend_host_port}/version" >/dev/null fi exit 1 diff --git a/docker-compose.yml b/docker-compose.yml index 448a62f..77c876a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: image: git.ryankegel.com:3000/kegel/chores/backend:latest # Or specific version tag container_name: chores-app-backend-prod # Added for easy identification ports: - - "5001:5000" # Host 5001 -> Container 5000 + - "${BACKEND_HOST_PORT:-5001}:5000" # Host port -> Container 5000 environment: - FLASK_ENV=production - FRONTEND_URL=${FRONTEND_URL} @@ -20,7 +20,7 @@ services: image: git.ryankegel.com:3000/kegel/chores/frontend:latest # Or specific version tag container_name: chores-app-frontend-prod # Added for easy identification ports: - - "443:443" # Host 443 -> Container 443 (HTTPS) + - "${FRONTEND_HOST_PORT:-4601}:443" # Host port -> Container 443 (HTTPS) environment: - BACKEND_HOST=chores-app-backend # Points to internal backend service depends_on: