1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/my_webapp_ynh.git synced 2024-09-03 19:46:26 +02:00

Upgrade to php7.3

This commit is contained in:
ericgaspar 2020-12-06 12:26:20 +01:00
parent c2b401aea1
commit b324c78780
No known key found for this signature in database
GPG key ID: 574F281483054D44
15 changed files with 66 additions and 64 deletions

View file

@ -1,8 +1,11 @@
Changelog Changelog
========= =========
## Unreleased ## [1.0~ynh4]()
- Nothing for now...
#### Changed
* [Use php7.3]
## [1.0~ynh3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42) - 2020-01-01 ## [1.0~ynh3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42) - 2020-01-01

View file

@ -38,7 +38,7 @@ of your custom Web application inside.
#### Supported architectures #### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/) * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/)
## Limitations ## Limitations
@ -58,8 +58,7 @@ then you should use this port to update your website with SFTP.
--- ---
Developers info ## Developers info
----------------
**Only if you want to use a testing branch for coding, instead of merging directly into master.** **Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing). Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing).

View file

@ -43,8 +43,6 @@
setup_sub_dir=1 setup_sub_dir=1
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=change Notification=change

View file

@ -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/php7.0-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;

View file

@ -8,7 +8,7 @@ name = "My webapp configuration"
name = "SFTP access" name = "SFTP access"
[main.sftp.sftp] [main.sftp.sftp]
ask = "Do you need a SFTP access ?" ask = "Do you need a SFTP access?"
type = "boolean" type = "boolean"
default = true default = true
@ -22,13 +22,13 @@ name = "My webapp configuration"
name = "Overwriting config files" name = "Overwriting config files"
[main.overwrite_files.overwrite_nginx] [main.overwrite_files.overwrite_nginx]
ask = "Overwrite the nginx config file ?" ask = "Overwrite the NGINX config file?"
type = "boolean" type = "boolean"
default = false default = false
help = "If the file is overwritten, a backup will be created." help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_phpfpm] [main.overwrite_files.overwrite_phpfpm]
ask = "Overwrite the php-fpm config file ?" ask = "Overwrite the PHP-FPM config file?"
type = "boolean" type = "boolean"
default = true default = true
help = "If the file is overwritten, a backup will be created." help = "If the file is overwritten, a backup will be created."
@ -38,19 +38,19 @@ name = "My webapp configuration"
name = "PHP-FPM configuration" name = "PHP-FPM configuration"
[main.php_fpm_config.footprint] [main.php_fpm_config.footprint]
ask = "Memory footprint of the service ?" ask = "Memory footprint of the service?"
choices = ["low", "medium", "high", "specific"] choices = ["low", "medium", "high", "specific"]
default = "low" default = "low"
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option." help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
[main.php_fpm_config.free_footprint] [main.php_fpm_config.free_footprint]
ask = "Memory footprint of the service ?" ask = "Memory footprint of the service?"
type = "number" type = "number"
default = "0" default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values." help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.usage] [main.php_fpm_config.usage]
ask = "Expected usage of the service ?" ask = "Expected usage of the service?"
choices = ["low", "medium", "high"] choices = ["low", "medium", "high"]
default = "low" default = "low"
help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."

View file

@ -6,7 +6,7 @@
"en": "Custom Web app with SFTP access", "en": "Custom Web app with SFTP access",
"fr": "Application Web personnalisée avec accès SFTP" "fr": "Application Web personnalisée avec accès SFTP"
}, },
"version": "1.0~ynh3", "version": "1.0~ynh4",
"url": "https://github.com/YunoHost-Apps/my_webapp_ynh", "url": "https://github.com/YunoHost-Apps/my_webapp_ynh",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"maintainer": { "maintainer": {
@ -18,7 +18,7 @@
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 3.8.0" "yunohost": ">= 4.0.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -40,7 +40,7 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh to add a SFTP access..." --weight=3 ynh_script_progression --message="Configuring SSH to add a SFTP access..." --weight=3
cp -R conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app cp -R conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app

View file

@ -28,29 +28,30 @@ 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)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/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
@ -77,4 +78,4 @@ fi
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -76,25 +76,25 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file # Change the path in the NGINX config file
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original nginx config file if modified # Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path" ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper # Set global variables for NGINX helper
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
@ -110,7 +110,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -45,20 +45,20 @@ else
fi fi
# Overwrite nginx configuration # Overwrite NGINX configuration
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)" old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}" overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
# Overwrite php-fpm configuration # Overwrite PHP-FPM configuration
old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)" old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)"
overwrite_phpfpm="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM:-$old_overwrite_phpfpm}" overwrite_phpfpm="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM:-$old_overwrite_phpfpm}"
# Footprint for php-fpm # Footprint for PHP-FPM
old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)" old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)"
fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}" fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}"
# Free footprint value for php-fpm # Free footprint value for PHP-FPM
# Check if fpm_footprint is an integer # Check if fpm_footprint is an integer
if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null
then then
@ -69,7 +69,7 @@ else
fi fi
free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}" free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}"
# Usage for php-fpm # Usage for PHP-FPM
old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)" old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)"
fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}" fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"

View file

@ -76,9 +76,9 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=2 ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
@ -145,6 +145,7 @@ ynh_script_progression --message="Configuring php-fpm..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -171,7 +172,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -194,7 +195,7 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
sftp_infos="You can connect to this repository by using sftp with the following credentials. sftp_infos="You can connect to this repository by using SFTP with the following credentials.
Domain: $domain Domain: $domain
Port: $(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}') Port: $(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
User: $app User: $app

View file

@ -48,17 +48,17 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=2 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated nginx config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing php-fpm configuration..." ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated php-fpm config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#================================================= #=================================================
@ -69,7 +69,7 @@ ynh_remove_fpm_config
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Removing the custom ssh config..." ynh_script_progression --message="Removing the custom SSH config..."
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
yunohost tools regen-conf ssh yunohost tools regen-conf ssh
fi fi

View file

@ -30,6 +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)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -95,7 +96,7 @@ chown root: "$final_path"
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -105,7 +106,7 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh..." ynh_script_progression --message="Configuring SSH..."
ynh_restore_file "/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" ynh_restore_file "/usr/share/yunohost/hooks/conf_regen/90-ssh_$app"
@ -117,9 +118,9 @@ fi
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
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=php7.0-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
#================================================= #=================================================

View file

@ -121,13 +121,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
@ -141,12 +134,12 @@ ynh_maintenance_mode_ON
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
# Overwrite the nginx configuration only if it's allowed # Overwrite the NGINX configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ] if [ $overwrite_nginx -eq 1 ]
then then
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
@ -171,12 +164,12 @@ usermod -g "$app" "$app"
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
# Overwrite the php-fpm configuration only if it's allowed # Overwrite the PHP-FPM configuration only if it's allowed
if [ $overwrite_phpfpm -eq 1 ] if [ $overwrite_phpfpm -eq 1 ]
then then
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 ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
fi fi
@ -188,7 +181,7 @@ fi
if [ $with_sftp -eq 1 ] if [ $with_sftp -eq 1 ]
then then
ynh_script_progression --message="Configuring ssh..." --weight=1 ynh_script_progression --message="Configuring SSH..." --weight=1
cp -R ../conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app cp -R ../conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app
@ -221,7 +214,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload