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

Merged
konrad merged 1 commits from TheEdgeOfRage/api:main into main 2022-07-12 14:02:34 +00:00
Contributor

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 2022-07-12 10:40:30 +00:00
Add exec to run script to run as PID 1
All checks were successful
continuous-integration/drone/pr Build is passing
5c793bf47d
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 2022-07-12 10:40:39 +00:00
konrad approved these changes 2022-07-12 14:02:20 +00:00
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 2022-07-12 14:02:34 +00:00
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/vikunja#1200
No description provided.