DONE: update .env and docker compose port forwarding
This commit is contained in:
@@ -87,11 +87,11 @@ jobs:
|
||||
- name: Verify deployment
|
||||
run: |
|
||||
set -e
|
||||
echo "Waiting for services to start..."
|
||||
sleep 15
|
||||
|
||||
cd "${DEPLOY_DIR}"
|
||||
|
||||
echo "Waiting for services to start..."
|
||||
sleep 10
|
||||
|
||||
for SERVICE in backend frontend; do
|
||||
STATUS=$(docker compose -f docker-compose.yml ps --status running --format '{{.Name}}' "$SERVICE" 2>/dev/null || true)
|
||||
if [ -z "$STATUS" ]; then
|
||||
@@ -110,15 +110,26 @@ jobs:
|
||||
echo "WARNING: Backend .env file not found"
|
||||
fi
|
||||
|
||||
if docker exec "$BE_CONTAINER" curl -sf http://localhost/health > /dev/null; then
|
||||
echo "✓ Backend health check passed"
|
||||
else
|
||||
echo "WARNING: Backend health check failed"
|
||||
fi
|
||||
API_PORT=$(grep -E '^API_PORT=' .env 2>/dev/null | cut -d= -f2- | tr -d '"' || true)
|
||||
FE_PORT=$(grep -E '^FE_PORT=' .env 2>/dev/null | cut -d= -f2- | tr -d '"' || true)
|
||||
API_PORT=${API_PORT:-8080}
|
||||
FE_PORT=${FE_PORT:-8081}
|
||||
|
||||
FE_CONTAINER=$(docker compose -f docker-compose.yml ps -q frontend)
|
||||
if docker exec "$FE_CONTAINER" wget -q --spider http://localhost/; then
|
||||
echo "✓ Frontend health check passed"
|
||||
else
|
||||
echo "WARNING: Frontend health check failed"
|
||||
fi
|
||||
check_health() {
|
||||
NAME=$1
|
||||
URL=$2
|
||||
for i in 1 2 3 4 5 6; do
|
||||
if curl -sf "$URL" > /dev/null; then
|
||||
echo "✓ ${NAME} health check passed (${URL})"
|
||||
return 0
|
||||
fi
|
||||
echo "Waiting for ${NAME}... attempt ${i}/6"
|
||||
sleep 5
|
||||
done
|
||||
echo "ERROR: ${NAME} health check failed (${URL})"
|
||||
docker compose -f docker-compose.yml logs --tail=50 "${NAME}" || true
|
||||
return 1
|
||||
}
|
||||
|
||||
check_health "backend" "http://127.0.0.1:${API_PORT}/health"
|
||||
check_health "frontend" "http://127.0.0.1:${FE_PORT}/health"
|
||||
|
||||
Reference in New Issue
Block a user