Skip to content

feat(applications): add configurable stop grace period#9746

Open
hendricius wants to merge 2 commits intocoollabsio:nextfrom
hendricius:feat/configurable-stop-grace-period
Open

feat(applications): add configurable stop grace period#9746
hendricius wants to merge 2 commits intocoollabsio:nextfrom
hendricius:feat/configurable-stop-grace-period

Conversation

@hendricius
Copy link
Copy Markdown
Contributor

@hendricius hendricius commented Apr 22, 2026

Changes

Adds a per-application stop_grace_period setting (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

Category

  • New feature

Preview

image

AI Assistance

  • AI was used

If AI was used:

  • Tools used: Claude Code
  • How extensively: used it to rebase Jack's branch against current v4.x and resolve the cherry-pick conflicts. Feature is his.

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

  • I have read and understood the contributor guidelines. If I have failed to follow any guideline, I understand that this PR may be closed without review.
  • I have searched existing issues and pull requests (including closed ones) to ensure this isn't a duplicate.
  • I have tested all the changes thoroughly with a local development instance of Coolify and I am confident that they will work as expected when a maintainer tests them.

andrasbacsai and others added 2 commits April 21, 2026 12:30
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>
@github-actions
Copy link
Copy Markdown
Contributor

This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know.

@hendricius
Copy link
Copy Markdown
Contributor Author

@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.

@ShadowArcanist ShadowArcanist changed the base branch from v4.x to next April 23, 2026 09:16
@github-actions
Copy link
Copy Markdown
Contributor

This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know.

@ShadowArcanist
Copy link
Copy Markdown
Member

@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.

Hey, the PR is getting closed due to this:
image

I just updated the target branch, added missing section on description, and added a label to prevent github action from closing the PR

@ShadowArcanist ShadowArcanist changed the title feat: configurable stop grace period for applications feat(applications): add configurable stop grace period Apr 23, 2026
@hendricius
Copy link
Copy Markdown
Contributor Author

@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!

@ShadowArcanist
Copy link
Copy Markdown
Member

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Services are killed instead of gracefully stopped due to faulty process handling and not respecting stop_grace_period

3 participants