1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dolibarr_ynh.git synced 2024-09-03 18:35:53 +02:00
This commit is contained in:
ericgaspar 2021-01-07 14:09:35 +01:00
parent 070c97a1ce
commit 067923c98c
No known key found for this signature in database
GPG key ID: 574F281483054D44
6 changed files with 20 additions and 47 deletions

View file

@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -52,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_print_info --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC BACKUP

View file

@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade

View file

@ -26,7 +26,6 @@ admin=$YNH_APP_ARG_ADMIN
member=$YNH_APP_ARG_MEMBER
is_public=0
app=$YNH_APP_INSTANCE_NAME
#=================================================
@ -100,7 +99,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Configuring php-fpm and install dependencies..." --weight=2
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=medium --footprint=medium --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_dependencies"
#=================================================
# SPECIFIC SETUP
@ -139,11 +138,10 @@ chown -R $app: "$final_path"
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
# Reload SSOwat config
yunohost app ssowatconf
# Set the app as temporarily public for cURL call
ynh_permission_update --permission "main" --add "visitors"
# Reload Nginx
# Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl
@ -251,10 +249,10 @@ ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log"
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
# Make app public if necessary or protect it
if [ $is_public -eq 0 ]
then
ynh_permission_update --permission "main" --add "visitors"
ynh_permission_update --permission "main" --remove "visitors"
fi
ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors"

View file

@ -33,6 +33,7 @@ datadir=$final_path/documents/
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -81,8 +82,7 @@ ynh_print_info --message="Reconfiguring PHP-FPM..."
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
@ -119,7 +119,7 @@ chmod go-w $datadir
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
ynh_systemd_action --service_name=php$YNH_PHP_VERSION-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -29,6 +29,7 @@ datadir=$final_path/documents/
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#=================================================
# CHECK VERSION
@ -91,18 +92,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -123,7 +112,7 @@ fi
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config YNH_PHP_VERSION
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
@ -145,8 +134,7 @@ if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then
fi
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#=================================================
# SPECIFIC UPGRADE
@ -171,17 +159,17 @@ then
# Upgrade with CURL
pushd $final_path/htdocs/install/
if php upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then
if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then
ynh_print_info --message="Step 1 upgrading ended successfully"
else
ynh_print_warn --message="Step 1 upgrading ended with error"
fi
if php upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then
if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then
ynh_print_info --message="Step 2 upgrading ended successfully"
else
ynh_print_warn --message="Step 2 upgrading ended with error"
fi
if php step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then
if php$phpversion step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then
ynh_print_info --message="Step 3 upgrading ended successfully"
else
ynh_print_warn --message="Step 3 upgrading ended with error"
@ -221,20 +209,6 @@ mkdir -p "$datadir"
chown -R $app: "$datadir"
chmod go-w $datadir
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors"
#=================================================
# RELOAD NGINX
#=================================================