fix(deploy): improve deployment robustness and reliability
All checks were successful
Test Runner / test-basic (push) Successful in 8s
Test Runner / test-php (push) Successful in 7s
Deploy Application / deploy (push) Successful in 1m35s

- Add docker volume prune to deploy.sh to prevent stale code issues
- Add automatic migrations and cache warmup to staging entrypoint
- Fix nginx race condition by waiting for PHP-FPM before starting
- Improve PHP healthcheck to use php-fpm-healthcheck
- Add curl to production nginx Dockerfile for healthchecks
- Add ensureSeedsTable() to SeedRepository for automatic table creation
- Update SeedCommand to ensure seeds table exists before operations

This prevents 502 Bad Gateway errors during deployment and ensures
fresh code is deployed without volume cache issues.
This commit is contained in:
2025-11-25 17:44:44 +01:00
parent 7785e65d08
commit 85e2360a90
11 changed files with 121 additions and 20 deletions

View File

@@ -121,6 +121,13 @@ docker compose $COMPOSE_FILES pull || print_warning "Failed to pull some images,
print_info "Stopping existing containers..."
docker compose $COMPOSE_FILES down --remove-orphans || print_warning "No existing containers to stop"
# Staging: Remove named volume to ensure fresh code from image
# This prevents stale code persisting between deployments
if [ "$ENVIRONMENT" = "staging" ]; then
print_info "Removing staging code volume to ensure fresh deployment..."
docker volume rm staging-code 2>/dev/null || print_info "No stale staging volume to remove"
fi
# Remove any orphaned containers with conflicting names
for container in nginx php redis scheduler queue-worker; do
if docker ps -a --format '{{.Names}}' | grep -q "^${container}$"; then