Skip to content

Commit ef4e916

Browse files
committed
Adjust termination handling
- use `SIGQUIT` as stop signal for the container - set `process_control_timeout` to 5 seconds for PHP-FPM This should make 502 errors less likely when scaling down or doing rolling updates.
1 parent 467e258 commit ef4e916

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ RUN export FLOWNATIVE_LOG_PATH_AND_FILENAME=/dev/stdout \
3939
USER 1000
4040
EXPOSE 9000 9001
4141

42+
# terminate with SIGQUIT which is handled gracefully by php-fpm
43+
# contrary to SIGTERM which terminates php-fpm immediately.
44+
STOPSIGNAL SIGQUIT
45+
4246
WORKDIR ${PHP_BASE_PATH}
4347
ENTRYPOINT [ "/entrypoint.sh" ]
4448
CMD [ "run" ]

root-files/opt/flownative/php/etc/php-fpm.conf.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ pid = ${PHP_TMP_PATH}/php-fpm.pid
77
; the shell running php-fpm.sh, so we can wait for it with "wait":
88
daemonize = no
99

10+
; tell the child processes to wait for 5s before executing the signal
11+
; received from the parent process, to make the php-fpm container
12+
; terminate gracefully:
13+
process_control_timeout = 5
14+
1015
[www]
1116

1217
access.log = ${PHP_FPM_ACCESS_LOG_PATH}

0 commit comments

Comments
 (0)