mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
Use PHPVERSION as PHP selection variable
This commit is contained in:
parent
16616a2f47
commit
563099da3a
8 changed files with 13 additions and 21 deletions
|
@ -32,7 +32,7 @@ location __PATH__/ {
|
||||||
# Execute and serve PHP files
|
# Execute and serve PHP files
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHP_CUSTOM__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
|
|
@ -33,7 +33,7 @@ group = __USER__
|
||||||
; (IPv6 and IPv4-mapped) on a specific port;
|
; (IPv6 and IPv4-mapped) on a specific port;
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
; Note: This value is mandatory.
|
; Note: This value is mandatory.
|
||||||
listen = /var/run/php/php__PHP_CUSTOM__-fpm-__NAMETOCHANGE__.sock
|
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||||
|
|
||||||
; Set listen(2) backlog.
|
; Set listen(2) backlog.
|
||||||
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "php_custom",
|
"name": "phpversion",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a PHP version you want to use for your app",
|
"en": "Choose a PHP version you want to use for your app",
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
YNH_PHP_VERSION="$php_custom"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -28,7 +28,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
||||||
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
||||||
php_custom=$(ynh_app_setting_get --app=$app --key=php_custom)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -51,7 +51,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$php_custom/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
|
|
@ -25,7 +25,7 @@ path_url=$YNH_APP_ARG_PATH
|
||||||
with_sftp=$YNH_APP_ARG_WITH_SFTP
|
with_sftp=$YNH_APP_ARG_WITH_SFTP
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
php_custom=$YNH_APP_ARG_PHP_CUSTOM
|
phpversion=$YNH_APP_ARG_PHPVERSION
|
||||||
|
|
||||||
with_mysql=$YNH_APP_ARG_WITH_MYSQL
|
with_mysql=$YNH_APP_ARG_WITH_MYSQL
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql
|
ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql
|
||||||
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
ynh_app_setting_set --app=$app --key=php_custom --value=$php_custom
|
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
|
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ chmod o-rwx "$final_path"
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||||
|
|
||||||
# Create a dedicatedPHP-FPM config
|
# Create a dedicatedPHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low --phpversion=$php_custom
|
ynh_add_fpm_config --usage=low --footprint=low --phpversion=$phpversion
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -30,7 +30,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
||||||
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
||||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||||
php_custom=$(ynh_app_setting_get --app=$app --key=php_custom)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -100,7 +100,7 @@ chmod o-rwx "$final_path"
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/${php_custom}/fpm/pool.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -113,7 +113,7 @@ ynh_restore_file --origin_path="/etc/php/${php_custom}/fpm/pool.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php${php_custom}-fpm --action=reload
|
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -23,7 +23,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql)
|
||||||
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp)
|
||||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||||
php_custom=$(ynh_app_setting_get --app=$app --key=php_custom)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
|
admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
|
||||||
|
|
||||||
|
@ -84,12 +84,6 @@ if [ -z "$with_sftp" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If with_sftp doesn't exist, create it
|
|
||||||
if [ -z "$php_custom" ]; then
|
|
||||||
php_custom="7.3"
|
|
||||||
ynh_app_setting_set --app=$app --key=php_custom --value=$php_custom
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
if ynh_legacy_permissions_exists; then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
@ -160,7 +154,7 @@ usermod -g "$app" "$app"
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$php_custom
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
|
Loading…
Add table
Reference in a new issue