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
continuous-integration/drone/pr Build is passing Details
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 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
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: vikunja/vikunja#1200
No description provided.