This commit is contained in:
ericgaspar
2021-07-26 10:28:14 +02:00
parent bfb36f313c
commit a93ada3001
7 changed files with 76 additions and 68 deletions
+32 -23
View File
@@ -31,6 +31,20 @@ db_user=$db_name
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@@ -48,19 +62,20 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
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"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@@ -77,6 +92,10 @@ then
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@@ -93,21 +112,13 @@ ynh_script_progression --message="Upgrading nginx web server configuration..."
ynh_add_nginx_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading php-fpm configuration..."
# Create a dedicated php-fpm config
ynh_add_fpm_config
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# SPECIFIC UPGRADE
@@ -164,10 +175,8 @@ popd
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R root: $final_path
chmod -R 755 $final_path/storage
chown -R $app: $final_path/storage $final_path/bootstrap $final_path/public/logo $final_path/.env
#=================================================
# RELOAD NGINX