Skip to content

Commit 9518acd

Browse files
ihabadhamclaude
andcommitted
Revert "Forward SIGTERM to children in Dockerfile CMD"
This reverts commit 1bd5e86. The trap addition was incomplete. On the shutdown signal (Control Plane sends SIGINT per docs.controlplane.com/reference/workload/termination.md), the trap fires, `wait -n` returns 130, and `exit 1` then runs unconditionally. The container exits with code 1 on every rolling deploy instead of a code that reflects the signal-initiated shutdown. More importantly, the trap was trying to solve a problem Control Plane already handles. CP's default preStop hook runs `sh -c "sleep 45"` before any signal reaches PID 1, and the sidecar stops accepting new inbound connections ~80 seconds ahead of termination. That sleep plus the routing drain is the graceful-shutdown window; signal forwarding inside the container is marginal on top of it. Match the reference deployments verbatim: the react-on-rails-demo- marketplace-rsc Dockerfile and the hichee production Dockerfile both use this exact bash-c pattern without a trap. If deeper graceful shutdown is ever needed, the right tool is extending preStop or switching to a process manager (overmind, tini), not a bash trap on wait -n. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1bd5e86 commit 9518acd

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

.controlplane/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,5 @@ ENTRYPOINT ["./.controlplane/entrypoint.sh"]
8383
# Run the Pro Node renderer and Rails in a single container (Option 1 from
8484
# docs/oss/building-features/node-renderer/container-deployment.md).
8585
# `wait -n` exits on first child failure → container exits → Control Plane
86-
# restarts the whole unit. The trap forwards SIGTERM/SIGINT to both children
87-
# so rolling deploys can drain: Puma and the renderer's cluster manager both
88-
# handle SIGTERM, but bash as PID 1 doesn't forward the signal by default.
89-
# Keeps the existing Thruster HTTP/2 proxy for Rails.
90-
CMD ["bash", "-c", "node renderer/node-renderer.js & RENDERER_PID=$! ; bundle exec thrust bin/rails server & RAILS_PID=$! ; trap 'kill -TERM $RENDERER_PID $RAILS_PID' TERM INT ; wait -n ; exit 1"]
86+
# restarts the whole unit. Keeps the existing Thruster HTTP/2 proxy for Rails.
87+
CMD ["bash", "-c", "node renderer/node-renderer.js & RENDERER_PID=$! ; bundle exec thrust bin/rails server & RAILS_PID=$! ; wait -n ; exit 1"]

0 commit comments

Comments
 (0)