Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Patch NGINX to allow it to better handle SIGTERM #56

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Binary file modified bin/nginx-debug-heroku-18
Binary file not shown.
Binary file modified bin/nginx-heroku-18
Binary file not shown.
20 changes: 20 additions & 0 deletions scripts/build_nginx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ echo "Downloading $zlib_url"
echo "Downloading $uuid4_url"
(cd nginx-${NGINX_VERSION} && curl -L $uuid4_url | tar xvz )

if [ -d "/buildpack/support/patchfiles/${NGINX_VERSION}" ]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ -d "/buildpack/support/patchfiles/${NGINX_VERSION}" ]
if [ -d "/buildpack/scripts/patchfiles/${NGINX_VERSION}" ]

then
PATCHFILES=$(find /buildpack/scripts/patchfiles/${NGINX_VERSION} -name '*.patch')
else
PATCHFILES=$(find /buildpack/scripts/patchfiles/default -name '*.patch')
fi


NGX_SHUTDOWN_SIGNAL=TERM
NGX_TERMINATE_SIGNAL=QUIT

(
cd nginx-${NGINX_VERSION}
for f in $PATCHFILES
do
echo "patch: $f"
patch -p0 < $f
done
)

(
cd nginx-${NGINX_VERSION}
./configure \
Expand Down
13 changes: 13 additions & 0 deletions scripts/patchfiles/1.18.0/0001-Custom-Terminate-Signal.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- src/core/ngx_config.h 2020-05-23 04:21:07.000000000 +0000
+++ src/core/ngx_config.h 2020-05-23 04:15:17.000000000 +0000
@@ -56,9 +56,8 @@

#define ngx_random random

-/* TODO: #ifndef */
-#define NGX_SHUTDOWN_SIGNAL QUIT
-#define NGX_TERMINATE_SIGNAL TERM
+#define NGX_SHUTDOWN_SIGNAL TERM
+#define NGX_TERMINATE_SIGNAL QUIT
#define NGX_NOACCEPT_SIGNAL WINCH
#define NGX_RECONFIGURE_SIGNAL HUP
1 change: 1 addition & 0 deletions scripts/patchfiles/default/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@