fix(deploy): improve deployment robustness and reliability
- 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user