From 3f97adb5cf96c40d236ced4f52128069737d641e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Mar 2020 05:02:23 +0200 Subject: [PATCH] Upgrade to PHP7.3 --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- scripts/.install.swp | Bin 20480 -> 0 bytes scripts/_common.sh | 2 +- scripts/backup | 16 +++++------ scripts/change_url | 41 ++++++++++++++++++--------- scripts/install | 64 ++++++++++++++++++++++--------------------- scripts/remove | 36 ++++++++++++------------ scripts/restore | 41 ++++++++++++++------------- scripts/upgrade | 60 +++++++++++++++++++++------------------- 10 files changed, 145 insertions(+), 119 deletions(-) delete mode 100644 scripts/.install.swp diff --git a/conf/nginx.conf b/conf/nginx.conf index ef9cf67..348040f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -58,7 +58,7 @@ location __PATH__/ { location ~ '[^/]\.php$|^/update.php' { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.2-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.3-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 49f1a37..046bbd6 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.2-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.3-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/.install.swp b/scripts/.install.swp deleted file mode 100644 index 1284576f2bbf616ae1d7df4c296388841e0ee41f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeI4e~ctW6~`M+esd?BQB+il*^Pm)GsE5GI513d!%Xk(#NFAsnb|vjc=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@tGsQ+}F)l=z`@j-+v5jN!dV%-iL8&jKg_XhJzs1p+n ztktbvWtr@dN;NvN5;_L)M%MaLV~!!8S4`yZA$3_(OSG+tcJ(aP5*tL?5zuzv<;nEz wI_8k_fbo9dwXLxjR9QSG<0i8+$#hW~$`40RkIFNlp~5!n>}+k}^!K&?8?lv?!T db.sql @@ -69,4 +69,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/change_url b/scripts/change_url index 87c334a..24cee26 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,13 +24,30 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_print_info --message="Backing up the app before changing its url (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -52,7 +69,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -83,24 +100,22 @@ fi #================================================= # UPDATE DRUSH ALIAS #================================================= -ynh_print_info --message="Updating Drush alias..." +ynh_script_progression --message="Updating Drush alias..." --weight=1 -cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php" +drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php" +cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -#================================================= +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$drush_aliasconfig" #================================================= # GENERIC FINALISATION -#================================================= - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -108,4 +123,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 7a08f66..00d1994 100644 --- a/scripts/install +++ b/scripts/install @@ -7,11 +7,11 @@ #================================================= source _common.sh -source /usr/share/yunohost/helpers source ynh_add_extra_apt_repos__3 source ynh_install_php__3 source ynh_composer__2 source ynh_exec_as +source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE @@ -49,15 +49,25 @@ ynh_save_args domain path_url password is_public final_path #================================================= # STANDARD MODIFICATIONS #================================================= -# INSTALL DEPENDENCIES +# INSTALL PHP7.3 #================================================= +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_script_progression --message="Installing PHP7.3..." --weight=1 + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" +fi + +#================================================= +# INSTALL DEPENDENCIES +#================================================= ynh_script_progression --message="Installing dependencies..." --weight=7 ynh_install_app_dependencies $pkg_dependencies #================================================= -# CREATE A PostgreSQL DATABASE +# CREATE A POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 @@ -92,22 +102,6 @@ ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" - -#================================================= -# INSTALL PHP 7.2 -#================================================= -ynh_script_progression --message="Installing PHP 7.2..." --weight=35 - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=1 - -# Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="7.2" - #================================================= # SPECIFIC SETUP #================================================= @@ -116,13 +110,13 @@ ynh_add_fpm_config --phpversion="7.2" ynh_script_progression --message="Creating Drush alias..." --weight=2 mkdir -p "$final_path/.drush" +drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php" +cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig" -cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php" - -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/.drush/$app.aliases.drushrc.php" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$drush_aliasconfig" #================================================= # INSTALL COMPOSER @@ -133,12 +127,12 @@ mkdir -p "$final_path/.composer" cp -f "../conf/composer.json" "$final_path/.composer/composer.json" -ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" +ynh_install_composer --phpversion="7.3" --workdir="$final_path/.composer" export PATH="$final_path/.composer/vendor/bin:$PATH" #================================================= -# Database initialization +# INITIALIZE POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Initializing PostgreSQL database..." --weight=8 @@ -146,7 +140,7 @@ ynh_replace_string "betaforms" "$db_user" "$final_path/framaforms.sql" ynh_psql_execute_file_as_root "$final_path/framaforms.sql" "$db_name" #================================================= -# Initialize tmp and private directory +# INITIALIZE TMP AND PRIVATE DIRECTORY #================================================= ynh_script_progression --message="Initializing tmp and private directory..." --weight=1 @@ -159,7 +153,7 @@ chown -R $app: "/home/yunohost.app/$app/data" chmod 775 "/home/yunohost.app/$app/data" #================================================= -# Missing images +# ADD MISSING IMAGES #================================================= ynh_script_progression --message="Adding missing images..." --weight=2 @@ -182,13 +176,13 @@ ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --targ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config_file" #================================================= -# Change admin password and apply custom conf +# CHANGE ADMIN PASSWORD AND APPLY CUSTOM CONF #================================================= ynh_script_progression --message="Changing admin password..." --weight=19 chown -R $app: $final_path -update-alternatives --set php /usr/bin/php7.2 +update-alternatives --set php /usr/bin/php7.3 ynh_exec_as $app env PATH=$PATH drush @$app upwd --password="$password" "admin" 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_name "Framaforms" 2>&1 @@ -218,6 +212,14 @@ ynh_store_file_checksum --file="$config_file" #================================================= # GENERIC FINALIZATION +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring php-fpm..." --weight=1 + +# Create a dedicated php-fpm config +ynh_add_fpm_config --phpversion="7.3" + #================================================= # SECURE FILES AND DIRECTORIES #================================================= diff --git a/scripts/remove b/scripts/remove index e101721..2c5a2fe 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,13 +7,13 @@ #================================================= source _common.sh -source /usr/share/yunohost/helpers source ynh_install_php__3 +source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -25,13 +25,29 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE THE PostgresSQL DATABASE +# REMOVE THE POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Removing the database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +#================================================= +# REMOVE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Removing php-fpm configuration..." --weight=1 + +# Remove the dedicated php-fpm config +ynh_remove_fpm_config + +#================================================= +# REMOVE PHP +#================================================= + +if [ "$(lsb_release --codename --short)" != "buster" ]; then + ynh_print_info --message="Removing php..." + ynh_remove_php +fi #================================================= # REMOVE DEPENDENCIES #================================================= @@ -56,23 +72,9 @@ ynh_script_progression --message="Removing nginx web server configuration..." -- # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=1 - -# Remove the dedicated php-fpm config -ynh_remove_fpm_config - #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE PHP -#================================================= -ynh_script_progression --message="Removing php..." --weight=14 - -ynh_remove_php - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index a355f06..8ed46ec 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,11 +8,11 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source /usr/share/yunohost/helpers source ../settings/scripts/ynh_add_extra_apt_repos__3 source ../settings/scripts/ynh_install_php__3 source ../settings/scripts/ynh_composer__2 source ../settings/scripts/ynh_exec_as +source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --time --weight=1 +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -37,7 +37,7 @@ db_user=$db_name #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -49,14 +49,14 @@ test ! -d $final_path \ #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE ALL FILES #================================================= -ynh_script_progression --message="Restoring all files..." --time --weight=1 +ynh_script_progression --message="Restoring all files..." --weight=1 ynh_restore @@ -74,26 +74,29 @@ chmod 775 "/home/yunohost.app/$app/data" #================================================= # SPECIFIC RESTORATION +#================================================= +# REINSTALL PHP7.3 +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_print_info --message="Reinstalling PHP7.3..." + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" +fi + #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies #================================================= -# REINSTALL PHP +# RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Reinstalling php..." - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - - -#================================================= -# RESTORE THE DATABASE -#================================================= -ynh_script_progression --message="Restoring the database..." --time --weight=1 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 ynh_psql_test_if_first_run @@ -106,13 +109,13 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php7.2-fpm --action=reload +ynh_systemd_action --service_name=php7.3-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 40c1e39..13377f2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,11 +7,11 @@ #================================================= source _common.sh -source /usr/share/yunohost/helpers source ynh_add_extra_apt_repos__3 source ynh_install_php__3 source ynh_composer__2 source ynh_exec_as +source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS @@ -74,6 +74,14 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 + +# Create a dedicated nginx config +ynh_add_nginx_config + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -87,12 +95,22 @@ then fi #================================================= -# NGINX CONFIGURATION +# UPGRADE PHP7.3 #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 -# Create a dedicated nginx config -ynh_add_nginx_config +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + if [ "$(ynh_app_setting_get --app=$app --key=php_version)" != "7.3" ]; then + ynh_print_info --message="Upgrading PHP7.3..." + ynh_remove_fpm_config + ynh_remove_app_dependencies + ynh_remove_php + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" + else + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" + fi +fi #================================================= # UPGRADE DEPENDENCIES @@ -109,20 +127,13 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# UPGRADE PHP -#================================================= -ynh_script_progression --message="Upgrading PHP..." --weight=12 - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="7.2" +ynh_add_fpm_config --phpversion="7.3" #================================================= # SPECIFIC UPGRADE @@ -131,24 +142,24 @@ ynh_add_fpm_config --phpversion="7.2" #================================================= ynh_script_progression --message="Upgrading Composer..." --weight=3 -ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" +ynh_install_composer --phpversion="7.3" --workdir="$final_path/.composer" #================================================= # UPGRADE DRUPAL #================================================= -ynh_script_progression --message="Upgrading Drupal..." --time --weight=30 +ynh_script_progression --message="Upgrading Drupal..." --weight=30 ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php" export PATH="$final_path/.composer/vendor/bin:$PATH" -update-alternatives --set php /usr/bin/php7.2 +update-alternatives --set php /usr/bin/php7.3 ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1 ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal -ynh_exec_as $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0 ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all +ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0 update-alternatives --set php /usr/bin/php7.0 @@ -162,16 +173,9 @@ ynh_store_file_checksum --file="$config_file" #================================================= -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -config_file=$final_path/sites/default/settings.php - -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$config_file" - #================================================= # GENERIC FINALIZATION +#================================================= # SECURE FILES AND DIRECTORIES #================================================= @@ -185,7 +189,7 @@ chmod 775 "/home/yunohost.app/$app/data" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] @@ -197,7 +201,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -205,4 +209,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last