-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from bryanlatten/feature-signals
Nginx: use SIGQUIT instead of SIGTERM for graceful shutdown
- Loading branch information
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
#!/usr/bin/execlineb -S1 | ||
|
||
# @see https://github.com/just-containers/s6-overlay/issues/101 | ||
|
||
# Rely on container platform to restart this container on crash (marathon/docker-swarm/kubernetes) | ||
# BUT, when container is SIGNALLED to stop, don't interfere | ||
if { s6-test ${1} -ne 0 } | ||
if { s6-test ${1} -ne 256 } | ||
|
||
# When nginx process dies, the container should come down with it | ||
s6-svscanctl -t /var/run/s6/services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
#!/usr/bin/execlineb -P | ||
s6-setuidgid www-data | ||
|
||
nginx -g "daemon off;" | ||
# @see https://github.com/just-containers/s6-overlay/issues/41#issuecomment-99366363 | ||
|
||
# Nginx uses SIGQUIT to gracefully stop serving traffic. | ||
trap -x | ||
{ | ||
term | ||
{ | ||
foreground | ||
{ | ||
nginx -s quit | ||
} | ||
echo [sigterm-nginx] graceful shutdown complete | ||
} | ||
} | ||
|
||
s6-setuidgid www-data nginx -g "daemon off;" |