[PR #1511] [MERGED] fix(docker): improve container shutdown reliability and speed #1566

Closed
opened 2026-02-25 21:38:40 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/cypht-org/cypht/pull/1511
Author: @Revisto
Created: 5/11/2025
Status: Merged
Merged: 5/26/2025
Merged by: @kroky

Base: masterHead: fix/1502-graceful-container-shutdown


📝 Commits (2)

  • f1bf697 Use exec to start supervisord for graceful shutdown
  • 793fe2c Add stop_grace_period for db and cypht services

📊 Changes

2 files changed (+3 additions, -1 deletions)

View changed files

📝 docker-compose.dev.yaml (+2 -0)
📝 docker/docker-entrypoint.sh (+1 -1)

📄 Description

🍰 Pullrequest

This PR fixes a problem where dev containers get stuck to stop when using docker compose down or Ctrl+C.

Here's what changed:

  1. docker-entrypoint.sh: I added exec to start supervisord. This makes supervisord the main process (PID 1) in the container. So, when Docker wants to stop the container, supervisord gets the signal directly and can shut down nicely. Before, the script running supervisord was PID 1 and didn't always pass the stop signal correctly. You can read more about why exec helps here. This makes stopping containers much faster, usually less than a second.

  2. docker-compose.dev.yaml: I added stop_grace_period: 30s for both the cypht and db services. This gives them 30 seconds to stop cleanly after Docker asks them to, before Docker has to force them to stop.

These changes make stopping the dev environment smoother and quicker, and less buggy.

Issues


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cypht-org/cypht/pull/1511 **Author:** [@Revisto](https://github.com/Revisto) **Created:** 5/11/2025 **Status:** ✅ Merged **Merged:** 5/26/2025 **Merged by:** [@kroky](https://github.com/kroky) **Base:** `master` ← **Head:** `fix/1502-graceful-container-shutdown` --- ### 📝 Commits (2) - [`f1bf697`](https://github.com/cypht-org/cypht/commit/f1bf697476e9bd55b40915bfb4ec30f57ff53511) Use exec to start supervisord for graceful shutdown - [`793fe2c`](https://github.com/cypht-org/cypht/commit/793fe2cbd7efc071df6fb924f44a0ba7227187df) Add stop_grace_period for db and cypht services ### 📊 Changes **2 files changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docker-compose.dev.yaml` (+2 -0) 📝 `docker/docker-entrypoint.sh` (+1 -1) </details> ### 📄 Description <!-- You can find the latest issue templates here https://github.com/ulfgebhardt/issue-templates --> <!-- Validate your PR title - a quick Guide A valid PR title contains a type (https://github.com/commitizen/conventional-commit-types/blob/master/index.json), a scope (https://github.com/cypht-org/cypht/blob/master/.github/workflows/test.lint.pr.yml#L31) and a title starting with a lower case letter. Here are some valid examples: - fix(frontend): my fix - feat(backend): my feature - docs(docker): my docs - refactor(frontend/backend) : my refactor - test(unit): my test --> ## 🍰 Pullrequest This PR fixes a problem where dev containers get stuck to stop when using `docker compose down` or `Ctrl+C`. Here's what changed: 1. **`docker-entrypoint.sh`:** I added `exec` to start `supervisord`. This makes `supervisord` the main process (PID 1) in the container. So, when Docker wants to stop the container, `supervisord` gets the signal directly and can shut down nicely. Before, the script running `supervisord` was PID 1 and didn't always pass the stop signal correctly. You can read more about why `exec` helps [here](https://cloud.theodo.com/en/blog/docker-processes-container#Replace_a_bash_script_process_with_exec). This makes stopping containers much faster, usually less than a second. 2. **`docker-compose.dev.yaml`:** I added `stop_grace_period: 30s` for both the `cypht` and `db` services. This gives them 30 seconds to stop cleanly after Docker asks them to, before Docker has to force them to stop. These changes make stopping the dev environment smoother and quicker, and less buggy. ### Issues <!-- Which Issues does this fix, which are related? - fixes #XXX - relates #XXX --> - fixes #1502 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 21:38:40 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#1566
No description provided.