mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:55:41 +00:00
Use nginx restart instead of reload for blue-green switch (#5260)
nginx reload doesn't always force DNS re-resolution in Docker. During blue-green deployment, after updating nginx.conf to point to the new instance (e.g., eagle-green:40032), nginx -s reload would sometimes keep trying to connect to the old (now removed) container, causing 502 errors. A full restart ensures nginx picks up the new upstream correctly. The ~1-2 second restart time is acceptable for deployment reliability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,7 +221,7 @@ main() {
|
||||
echo "JFR_SIDECAR_ADDR=jfr-sidecar:8081" >> "${env_file}"
|
||||
fi
|
||||
|
||||
# Validate nginx config before reload
|
||||
# Validate nginx config before restart
|
||||
log_info "Validating nginx configuration..."
|
||||
if ! docker exec nginx nginx -t 2>&1; then
|
||||
log_error "nginx config validation failed, aborting!"
|
||||
@@ -230,12 +230,12 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Reload nginx (use reload for faster switch, restart if reload fails)
|
||||
log_info "Reloading nginx..."
|
||||
if ! docker exec nginx nginx -s reload 2>/dev/null; then
|
||||
log_warn "Reload failed, restarting nginx..."
|
||||
docker compose -f "${COMPOSE_FILE}" restart nginx
|
||||
fi
|
||||
# Restart nginx to pick up new upstream
|
||||
# Note: We use restart instead of reload because reload doesn't always
|
||||
# force DNS re-resolution in Docker, causing nginx to keep trying to
|
||||
# connect to the old (removed) container
|
||||
log_info "Restarting nginx..."
|
||||
docker compose -f "${COMPOSE_FILE}" restart nginx
|
||||
|
||||
# Restart admin to pick up new .env
|
||||
log_info "Restarting admin service..."
|
||||
|
||||
Reference in New Issue
Block a user