feat(applications): add configurable stop grace period#9746
feat(applications): add configurable stop grace period#9746hendricius wants to merge 2 commits intocoollabsio:nextfrom
Conversation
Adds stop_grace_period to application settings (seconds, 1-3600, default 30). Used in place of the hardcoded docker stop -t 30 in the four places that stop application containers: rolling update shutdown, manual stop, stop on another server, and preview deployment stop. Non-positive values fall back to the default via ($val > 0) ? $val : default, with tests covering 0 and -10 so the cast does not blow up if a bad value ever lands in the db. Picks up Jack Coy's work from coollabsio#7125 which went dormant. His commits are squashed here with credit below. Co-authored-by: Jack Coy <jackman3000@gmail.com>
|
This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know. |
|
@andrasbacsai thanks for the great work on Coolify. I am using it every day. What am I doing wrong? 😁 Yes I used claude code to fix the bug and create the PR. Cheers and keep up the great work. |
|
This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know. |
Hey, the PR is getting closed due to this: I just updated the target branch, added missing section on description, and added a label to prevent github action from closing the PR |
|
@ShadowArcanist thanks a lot for the fix. Sorry - I feel stupid now. For some reason I did not see the details of that action somewhere, then I could have fixed it myself. Apologies and thanks again! |
No worries! |

Changes
Adds a per-application
stop_grace_periodsetting (1-3600 seconds, default 30) in the Advanced tab, Operations section. Used in place of the hardcoded 30 second timeout in the four places Coolify stops application containers today: rolling update shutdown, manual stop, stop on another server, and preview deployment stop.Non-positive values (0 / negative, should never happen in practice but possible from legacy data or direct DB edit) fall back to the default so they can't be passed straight to
docker stop.Picks up Jack Coy's work from #7125 which has been stuck since November with merge conflicts and no maintainer-can-modify flag. His commits are squashed here with credit via co-author trailer.
Motivation: I run https://clawy.io on Coolify. It holds long-lived websocket connections open per user for AI chat. 30 seconds is not enough to drain those on deploy and responses get cut off mid stream, which breaks user conversations with tool integrations. With this merged I can set it to 300 for that app and deploys become invisible to users.
Issues
stop_grace_period#5620Category
Preview
AI Assistance
If AI was used:
Testing
Tested on a throwaway Hetzner VM running this branch. Set to 60, app that sleeps 120 on SIGTERM -> docker killed at 60. Set to 300, same app exited cleanly at 120. Migration is nullable so existing apps default to 30, no behaviour change unless you opt in.
Contributor Agreement
Important