diff --git a/conf/nginx.conf b/conf/nginx.conf index ce045d4..88c9bd1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,4 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { proxy_pass http://127.0.0.1:__PORT__/; proxy_http_version 1.1; diff --git a/scripts/_common.sh b/scripts/_common.sh index d556267..58ae541 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib libstdc++6 redis-server rabbitmq-server libcurl4-dev" +pkg_dependencies="postgresql postgresql-contrib libstdc++6 rabbitmq-server libcurl4-dev" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index a70a476..570c4f3 100644 --- a/scripts/install +++ b/scripts/install @@ -103,14 +103,8 @@ ynh_psql_setup_db --db_user=$db_name --db_name=$db_name #================================================= ynh_script_progression --message="Configuring NGINX web server..." -if [ $path_url = "/" ]; then - ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf" -else - ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf" -fi - # Create a dedicated NGINX config -ynh_add_nginx_config "nextclouddomain" +ynh_add_nginx_config #================================================= # SPECIFIC SETUP diff --git a/scripts/upgrade b/scripts/upgrade index c07f40c..48f4c55 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,20 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up OnlyOffice 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 #================================================= @@ -57,20 +71,6 @@ fi ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list" ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list" -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up OnlyOffice 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 - #================================================= # CREATE DEDICATED USER #================================================= @@ -86,14 +86,8 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring NGINX web server..." -if [ "$path_url" = "/" ]; then - ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf" -else - ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf" -fi - # Create a dedicated nginx config -ynh_add_nginx_config "nextclouddomain" +ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES