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

fix: sigterm handling so NGINX gracefully exits #1

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified nginx-heroku-18.tgz
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 @@ -36,6 +36,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}" ]
then
PATCHFILES=$(find /buildpack/support/patchfiles/${NGINX_VERSION} -name '*.patch')
else
exit 1
fi


NGX_SHUTDOWN_SIGNAL=TERM
NGX_TERMINATE_SIGNAL=QUIT
Comment on lines +47 to +48

Choose a reason for hiding this comment

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

I'm pretty sure these two lines aren't doing anything, since they're just setting shell variables that are never used. I suspect a previous version of this script used them, but they're no longer necessary.


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

# This will build `nginx`
(
cd nginx-${NGINX_VERSION}
Expand Down
13 changes: 13 additions & 0 deletions support/patchfiles/1.18.0/001-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