Skip to content

Conversation

@renatomefi
Copy link
Contributor

@renatomefi renatomefi commented Apr 17, 2019

Usabilla PHP Docker Template

Reviewers: @fabiotc @rdohms @WyriHaximus @renatomefi @frankkoornstra @agustingomes @cvmiert

Type

Please specify the type of changes being proposed:

Q A
Documentation? yes
Dockerfile change? yes

Changelog

  • Introduce dumb-init in order to rewrite signals wrongly handled by PHP-FPM
  • Replace entrypoint while keeping compatibility to the original PHP image one
  • Document

@renatomefi renatomefi marked this pull request as ready for review April 17, 2019 17:27
@renatomefi renatomefi changed the title Php fpm/translate signals PHP-FPM translate Kill Signals Apr 17, 2019
Copy link
Contributor

@frankkoornstra frankkoornstra left a comment

Choose a reason for hiding this comment

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

What do the rewrites do?

@renatomefi renatomefi force-pushed the php-fpm/translate-signals branch from a2dbf84 to 869af61 Compare April 18, 2019 09:07
Now we can rely on correct signal handling via dumb-init and only use
shush when there's actually encrypted variables
@renatomefi
Copy link
Contributor Author

@frankkoornstra php-fpm does not respect the standard posix Signals, it's expected from a process to gracefully finish the request upon SIGINT and SIGTERM, while on SIGHUP it's expected to reload its configuration. But the php-fpm process implements it differently and that's what the rewrites are fixing with the help of dumb-init

@renatomefi renatomefi merged commit 62f8c24 into master Apr 18, 2019
@renatomefi renatomefi deleted the php-fpm/translate-signals branch April 18, 2019 09:53
lcobucci added a commit to lcobucci/php that referenced this pull request Apr 18, 2019
The default signal used by docker to stop a container is SIGTERM and
that signal is understood by PHP-FPM as immediate termination.

This means that `php-fpm` won't wait for in-flight requests to finish
before of stopping the workers and main process. This behaviour is quite
undesired for production environments and should be avoided as much as
possible.

This implementation is meant to be extremely simple and only address the
stop signal used when running `docker stop`. `php-fpm` signal choices
are somewhat peculiar (`SIGUSR2` for example) and if we want to "fix"
them we would have to use a tool (e.g.: `dumb-init`).

More info:

 - https://linux.die.net/man/8/php-fpm
 - https://docs.docker.com/engine/reference/builder/#stopsignal
 - https://github.com/Yelp/dumb-init
 - usabilla/php-docker-template#102
ReactDevs007 added a commit to ReactDevs007/dockerlib that referenced this pull request Feb 3, 2021
The default signal used by docker to stop a container is SIGTERM and
that signal is understood by PHP-FPM as immediate termination.

This means that `php-fpm` won't wait for in-flight requests to finish
before of stopping the workers and main process. This behaviour is quite
undesired for production environments and should be avoided as much as
possible.

This implementation is meant to be extremely simple and only address the
stop signal used when running `docker stop`. `php-fpm` signal choices
are somewhat peculiar (`SIGUSR2` for example) and if we want to "fix"
them we would have to use a tool (e.g.: `dumb-init`).

More info:

 - https://linux.die.net/man/8/php-fpm
 - https://docs.docker.com/engine/reference/builder/#stopsignal
 - https://github.com/Yelp/dumb-init
 - usabilla/php-docker-template#102
VenusPR pushed a commit to VenusPR/PHP_Project that referenced this pull request Mar 12, 2023
The default signal used by docker to stop a container is SIGTERM and
that signal is understood by PHP-FPM as immediate termination.

This means that `php-fpm` won't wait for in-flight requests to finish
before of stopping the workers and main process. This behaviour is quite
undesired for production environments and should be avoided as much as
possible.

This implementation is meant to be extremely simple and only address the
stop signal used when running `docker stop`. `php-fpm` signal choices
are somewhat peculiar (`SIGUSR2` for example) and if we want to "fix"
them we would have to use a tool (e.g.: `dumb-init`).

More info:

 - https://linux.die.net/man/8/php-fpm
 - https://docs.docker.com/engine/reference/builder/#stopsignal
 - https://github.com/Yelp/dumb-init
 - usabilla/php-docker-template#102
principlesoftware-dev added a commit to principlesoftware-dev/PHP-branch that referenced this pull request Sep 2, 2024
The default signal used by docker to stop a container is SIGTERM and
that signal is understood by PHP-FPM as immediate termination.

This means that `php-fpm` won't wait for in-flight requests to finish
before of stopping the workers and main process. This behaviour is quite
undesired for production environments and should be avoided as much as
possible.

This implementation is meant to be extremely simple and only address the
stop signal used when running `docker stop`. `php-fpm` signal choices
are somewhat peculiar (`SIGUSR2` for example) and if we want to "fix"
them we would have to use a tool (e.g.: `dumb-init`).

More info:

 - https://linux.die.net/man/8/php-fpm
 - https://docs.docker.com/engine/reference/builder/#stopsignal
 - https://github.com/Yelp/dumb-init
 - usabilla/php-docker-template#102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants