Add exec to run script to run app as PID 1 #1200

Merged
konrad merged 1 commits from TheEdgeOfRage/api:main into main 3 months ago

Description

When running the docker container, the sh script will run as PID 1 and intercept any external signals (like docker stop) and won't pass it on to the app. Docker will wait for 10 seconds before proceeding to force kill the app, leading to both an unclean shutdown and an unnecessary wait of 10 seconds.

The exec in the script replaces the shell process with the su process, which correctly passes on signals to the app process and triggers a regular shutdown when doing a docker stop.

Checklist

  • I added or improved tests
  • I added or improved docs for my feature
  • Swagger (including mage do-the-swag)
  • Error codes
  • New config options (including adding them to config.yml.saml and running mage generate-docs)

I don't think any of these apply here, but please let me know if I need to do anything else :)

# Description When running the docker container, the sh script will run as PID 1 and intercept any external signals (like docker stop) and won't pass it on to the app. Docker will wait for 10 seconds before proceeding to force kill the app, leading to both an unclean shutdown and an unnecessary wait of 10 seconds. The exec in the script replaces the shell process with the `su` process, which correctly passes on signals to the app process and triggers a regular shutdown when doing a docker stop. # Checklist * [ ] I added or improved tests * [ ] I added or improved docs for my feature * [ ] Swagger (including `mage do-the-swag`) * [ ] Error codes * [ ] New config options (including adding them to `config.yml.saml` and running `mage generate-docs`) I don't think any of these apply here, but please let me know if I need to do anything else :)
TheEdgeOfRage added 1 commit 3 months ago
5c793bf47d
Add exec to run script to run as PID 1
TheEdgeOfRage changed title from Add exec to run script to run as PID 1 to Add exec to run script to run app as PID 1 3 months ago
konrad approved these changes 3 months ago
konrad left a comment
Owner

Thanks! I had this on my radar for a while but didn't get around to do it.

Thanks! I had this on my radar for a while but didn't get around to do it.
konrad merged commit b9793a267b into main 3 months ago

Reviewers

konrad approved these changes 3 months ago
continuous-integration/drone/pr Build is passing
The pull request has been merged as b9793a267b.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/api#1200
Loading…
There is no content yet.