-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from usabilla/php-fpm/translate-signals
PHP-FPM translate Kill Signals
- Loading branch information
Showing
5 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# first arg is `-f` or `--some-option` or if it's empty | ||
if [ -z "$1" ] || [ "${1#-}" != "$1" ]; then | ||
set -- php-fpm "$@" | ||
fi | ||
|
||
if [ "$1" = php-fpm ]; then | ||
if env | grep -E "^KMS_ENCRYPTED"; then | ||
set -- shush exec -- "$@" | ||
fi | ||
|
||
# Rewrite SIGINT to SIGQUIT | ||
# Rewrite SIGTERM to SIGQUIT | ||
# Rewrite SIGHUP to SIGUSR2 | ||
set -- dumb-init --rewrite 2:3 --rewrite 15:3 --rewrite 1:17 -- "$@" | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -xeu | ||
|
||
VERSION="1.2.2" | ||
|
||
curl -sL -o /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v"$VERSION"/dumb-init_"$VERSION"_amd64 | ||
|
||
chmod +x /usr/local/bin/dumb-init | ||
|
||
dumb-init --version | ||
|
||
RESULT=$? | ||
|
||
exit $RESULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.php_fpm_exec | ||
def test_php_fpm_exec_has_dumb_init(host): | ||
php_fpm_exec = host.run("ps 1") | ||
|
||
assert "dumb-init" in php_fpm_exec.stdout | ||
assert "--rewrite 2:3" in php_fpm_exec.stdout | ||
assert "--rewrite 15:3" in php_fpm_exec.stdout | ||
assert "--rewrite 1:17" in php_fpm_exec.stdout | ||
|
||
assert "shush" not in php_fpm_exec.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters