mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Use a dedicated php service for each app
This commit is contained in:
parent
128577686a
commit
b8a1687f88
1 changed files with 26 additions and 3 deletions
|
@ -18,7 +18,7 @@ ynh_add_fpm_config () {
|
|||
phpversion="${phpversion:-7.0}"
|
||||
|
||||
local fpm_config_dir="/etc/php/$phpversion/fpm"
|
||||
local fpm_service="php${phpversion}-fpm"
|
||||
local fpm_service="php${phpversion}-fpm-$app"
|
||||
# Configure PHP-FPM 5 on Debian Jessie
|
||||
if [ "$(ynh_get_debian_release)" == "jessie" ]; then
|
||||
fpm_config_dir="/etc/php5/fpm"
|
||||
|
@ -45,7 +45,27 @@ ynh_add_fpm_config () {
|
|||
chown root: "$finalphpini"
|
||||
ynh_store_file_checksum "$finalphpini"
|
||||
fi
|
||||
ynh_systemd_action --service_name=$fpm_service --action=reload
|
||||
|
||||
# Create a config for a dedicated php-fpm service for the app
|
||||
echo "
|
||||
[Unit]
|
||||
Description=PHP $phpversion FastCGI Process Manager for $app
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
PIDFile=/run/php/php${phpversion}-fpm-$app.pid
|
||||
ExecStart=/usr/sbin/php-fpm${phpversion} --nodaemonize --fpm-config $finalphpconf --pid /run/php/php${phpversion}-fpm-$app.pid
|
||||
ExecReload=/bin/kill -USR2 \$MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
" > ../conf/$fpm_service
|
||||
|
||||
# Create this dedicated php-fpm service
|
||||
ynh_add_systemd_config --service=$fpm_service --template=$fpm_service
|
||||
|
||||
ynh_systemd_action --service_name=$fpm_service --action=restart
|
||||
}
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
|
@ -61,7 +81,10 @@ ynh_remove_fpm_config () {
|
|||
fpm_config_dir="/etc/php/7.0/fpm"
|
||||
fpm_service="php7.0-fpm"
|
||||
fi
|
||||
|
||||
# Remove the dedicated service php-fpm service
|
||||
ynh_remove_systemd_config --service=$fpm_service
|
||||
|
||||
ynh_secure_remove --file="$fpm_config_dir/pool.d/$app.conf"
|
||||
ynh_secure_remove --file="$fpm_config_dir/conf.d/20-$app.ini" 2>&1
|
||||
ynh_systemd_action --service_name=$fpm_service --action=reload
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue