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

@ -24,7 +24,7 @@ location __PATH__/ {
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 600; fastcgi_read_timeout 600;
} }
# Include SSOWAT user panel. # Include SSOWAT user panel.

View file

@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) 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)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # 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_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 # 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 # 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 # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade

View file

@ -26,7 +26,6 @@ admin=$YNH_APP_ARG_ADMIN
member=$YNH_APP_ARG_MEMBER member=$YNH_APP_ARG_MEMBER
is_public=0 is_public=0
app=$YNH_APP_INSTANCE_NAME 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 ynh_script_progression --message="Configuring php-fpm and install dependencies..." --weight=2
# Create a dedicated php-fpm config # 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 # SPECIFIC SETUP
@ -139,11 +138,10 @@ chown -R $app: "$final_path"
# Set the app as temporarily public for curl call # Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_app_setting_set --app=$app --key=skipped_uris --value="/" # Set the app as temporarily public for cURL call
# Reload SSOwat config ynh_permission_update --permission "main" --add "visitors"
yunohost app ssowatconf
# Reload Nginx # Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
# Installation with curl # Installation with curl
@ -251,10 +249,10 @@ ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log"
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary # Make app public if necessary or protect it
if [ $is_public -eq 1 ] if [ $is_public -eq 0 ]
then then
ynh_permission_update --permission "main" --add "visitors" ynh_permission_update --permission "main" --remove "visitors"
fi fi
ynh_permission_create --permission "public access" --url "/public/" --allowed "visitors" 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_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) 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 # 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_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 # SPECIFIC RESTORATION
@ -119,7 +119,7 @@ chmod go-w $datadir
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 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 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_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -91,18 +92,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
# 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 # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -123,7 +112,7 @@ fi
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config YNH_PHP_VERSION ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -145,8 +134,7 @@ if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then
fi fi
# Create a dedicated php-fpm config # 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 # SPECIFIC UPGRADE
@ -171,17 +159,17 @@ then
# Upgrade with CURL # Upgrade with CURL
pushd $final_path/htdocs/install/ 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" ynh_print_info --message="Step 1 upgrading ended successfully"
else else
ynh_print_warn --message="Step 1 upgrading ended with error" ynh_print_warn --message="Step 1 upgrading ended with error"
fi 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" ynh_print_info --message="Step 2 upgrading ended successfully"
else else
ynh_print_warn --message="Step 2 upgrading ended with error" ynh_print_warn --message="Step 2 upgrading ended with error"
fi 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" ynh_print_info --message="Step 3 upgrading ended successfully"
else else
ynh_print_warn --message="Step 3 upgrading ended with error" ynh_print_warn --message="Step 3 upgrading ended with error"
@ -221,20 +209,6 @@ mkdir -p "$datadir"
chown -R $app: "$datadir" chown -R $app: "$datadir"
chmod go-w $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 # RELOAD NGINX
#================================================= #=================================================