Skip to content

Commit 14ccd81

Browse files
committed
Patch nginx so it does graceful shutdown on SIGTERM and fast shutdown on SIGQUIT. Fixes #31
1 parent 9be9a7c commit 14ccd81

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [x.x] - xxxx-xx-xx
8+
### Changes
9+
- [all] Patched nginx so it gracefully shuts down on SIGTERM.
10+
711
## [1.7] - 2021-06-04
812
### Changes
913
- [heroku-18] updated nginx to 1.20.1

nginx-heroku-18.tgz

1.3 KB
Binary file not shown.

nginx-heroku-20.tgz

641 Bytes
Binary file not shown.

scripts/build_nginx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ echo "Downloading $zlib_url"
3636
echo "Downloading $uuid4_url"
3737
(cd nginx-${NGINX_VERSION} && curl -L $uuid4_url | tar xvz )
3838

39+
if [ -d "/buildpack/scripts/patchfiles/${NGINX_VERSION}" ]
40+
then
41+
PATCHFILES=$(find /buildpack/scripts/patchfiles/${NGINX_VERSION} -name '*.patch')
42+
else
43+
PATCHFILES=$(find /buildpack/scripts/patchfiles/default -name '*.patch')
44+
fi
45+
46+
47+
(
48+
cd nginx-${NGINX_VERSION}
49+
for f in $PATCHFILES
50+
do
51+
echo "patch: $f"
52+
patch -p0 < $f
53+
done
54+
)
55+
3956
# This will build `nginx`
4057
(
4158
cd nginx-${NGINX_VERSION}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--- src/core/ngx_config.h 2020-05-23 04:21:07.000000000 +0000
2+
+++ src/core/ngx_config.h 2020-05-23 04:15:17.000000000 +0000
3+
@@ -56,9 +56,8 @@
4+
5+
#define ngx_random random
6+
7+
-/* TODO: #ifndef */
8+
-#define NGX_SHUTDOWN_SIGNAL QUIT
9+
-#define NGX_TERMINATE_SIGNAL TERM
10+
+#define NGX_SHUTDOWN_SIGNAL TERM
11+
+#define NGX_TERMINATE_SIGNAL QUIT
12+
#define NGX_NOACCEPT_SIGNAL WINCH
13+
#define NGX_RECONFIGURE_SIGNAL HUP

0 commit comments

Comments
 (0)