diff --git a/README.md b/README.md
index 0a854ee..760bf97 100644
--- a/README.md
+++ b/README.md
@@ -37,8 +37,8 @@ Supported, with LDAP and SSO.
#### Supported architectures
-* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/)
-* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/)
+* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jenkins.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/)
+* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jenkins.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/)
## Links
diff --git a/README_fr.md b/README_fr.md
index 2ba7090..51224b5 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -38,8 +38,8 @@ Supportée, avec LDAP et SSO.
#### Architectures supportées
-* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/)
-* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/)
+* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jenkins.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/)
+* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jenkins.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/)
## Liens
diff --git a/check_process b/check_process
index 919dfd3..5433158 100644
--- a/check_process
+++ b/check_process
@@ -12,7 +12,7 @@
setup_public=1
upgrade=1
# 2.150.2~ynh2
- # upgrade=1 from_commit=29141b702f2954e0f72925121aea82a7fa3fc118
+ #upgrade=1 from_commit=29141b702f2954e0f72925121aea82a7fa3fc118
# 2.263.1~ynh1
upgrade=1 from_commit=0e1aae7be82034650e2c1f6c1ad6d68a41b80176
# 2.263.4~ynh1
@@ -23,7 +23,7 @@
change_url=1
;;; Options
Email=
-Notification=down
+Notification=none
;;; Upgrade options
; commit=29141b702f2954e0f72925121aea82a7fa3fc118
name=Fix for getopts 13 Apr 2019
diff --git a/manifest.json b/manifest.json
index 4bed405..a42dced 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "Extendable continuous integration server",
"fr": "Serveur d'intégration continue extensible"
},
- "version": "2.277.2~ynh1",
+ "version": "2.277.2~ynh2",
"url": "https://jenkins.io/index.html",
"license": "MIT",
"maintainer": {
@@ -40,11 +40,7 @@
{
"name": "is_public",
"type": "boolean",
- "default": true,
- "help": {
- "en": "A public Jenkins will be accessible by everyone unless you configure the security into jenkins admin panel.",
- "fr": "Un Jenkins public sera accessible par tout le monde à moins que vous ne configuriez la sécurité dans le panneau d'administration de jenkins."
- }
+ "default": true
}
]
}
diff --git a/scripts/actions/public_private b/scripts/actions/public_private
index 9512c4d..16b1201 100755
--- a/scripts/actions/public_private
+++ b/scripts/actions/public_private
@@ -43,7 +43,7 @@ if [ $is_public -eq 0 ]; then
else
public_private="public"
fi
-ynh_script_progression --message="Moving the application to $public_private..." --weight=3
+ynh_script_progression --message="Moving the application to $public_private..."
if [ $is_public -eq 0 ]
then
@@ -73,4 +73,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Execution completed" --last
+ynh_script_progression --message="Execution completed"
diff --git a/scripts/change_url b/scripts/change_url
index afccee8..7fdab5e 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -7,7 +7,6 @@
#=================================================
source _common.sh
-source ynh_maintenance_mode
source /usr/share/yunohost/helpers
#=================================================
@@ -25,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=2
+ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@@ -33,16 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
-# ACTIVATE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Activating maintenance mode..." --weight=2
-
-path_url=$old_path
-domain=$old_domain
-ynh_maintenance_mode_ON
-
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
+# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
@@ -86,7 +76,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
-ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5
+ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@@ -98,10 +88,6 @@ then
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
-
- # Store path_url setting
- ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
-
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
@@ -151,7 +137,7 @@ ynh_store_file_checksum --file="/etc/default/jenkins"
#=================================================
# START SYSTEMD SERVICE
#=================================================
-ynh_script_progression --message="Starting a systemd service..." --weight=30
+ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300"
@@ -163,17 +149,8 @@ ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
-#=================================================
-# DEACTIVE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Disabling maintenance mode..." --weight=5
-
-path_url=$old_path
-domain=$old_domain
-ynh_maintenance_mode_OFF
-
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Change of URL completed for $app" --last
+ynh_script_progression --message="Change of URL completed for $app"
diff --git a/scripts/install b/scripts/install
index 0c2d1ff..46cdb9b 100644
--- a/scripts/install
+++ b/scripts/install
@@ -50,7 +50,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
-ynh_script_progression --message="Storing installation settings..." --weight=3
+ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
@@ -62,7 +62,7 @@ ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
#=================================================
# FIND AND OPEN A PORT
#=================================================
-ynh_script_progression --message="Finding an available port..." --weight=2
+ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=8080)
@@ -71,7 +71,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=30
+ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
@@ -87,7 +87,7 @@ ynh_setup_source --dest_dir="../conf"
#=================================================
# NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Configuring NGINX web server..." --weight=2
+ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
@@ -97,7 +97,7 @@ ynh_add_nginx_config
#=================================================
# FIX THE PORT TO USE
#=================================================
-ynh_script_progression --message="Fixing the port in Jenkins config..." --weight=2
+ynh_script_progression --message="Fixing the port in Jenkins config..."
change_port() {
# Wait for the creation of the jenkins service file
@@ -120,7 +120,7 @@ pid_change_port=$!
#=================================================
# INSTALL JENKINS
#=================================================
-ynh_script_progression --message="Installing Jenkins..." --weight=30
+ynh_script_progression --message="Installing Jenkins..."
# Download jenkins deb file and install it.
dpkg --install --force-confnew ../conf/jenkins.deb
@@ -128,7 +128,7 @@ dpkg --install --force-confnew ../conf/jenkins.deb
#=================================================
# SETUP APPLICATION
#=================================================
-ynh_script_progression --message="Setuping application..." --weight=30
+ynh_script_progression --message="Setuping application..."
# Set the app as temporarily public for jenkins-cli.jar
ynh_script_progression --message="Configuring SSOwat..."
@@ -161,7 +161,7 @@ ynh_replace_string --match_string="0" --replace
# Wait for Jenkins to be fully started
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
-ynh_script_progression --message="Installing plugins..." --weight=60
+ynh_script_progression --message="Installing plugins..."
# If the log says that jenkins has started, install the plugins
wget -nv --no-check-certificate https://$domain${path_url%/}/jnlpJars/jenkins-cli.jar -O $final_path/jenkins-cli.jar 2>&1
@@ -232,14 +232,6 @@ ynh_store_file_checksum --file="$final_path/config.xml"
#=================================================
# GENERIC FINALIZATION
-#=================================================
-# SECURE FILES AND DIRECTORIES
-#=================================================
-ynh_script_progression --message="Securing files and directories..."
-
-# Set permissions to app files
-chown -R $app:$app $final_path
-
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@@ -250,7 +242,7 @@ yunohost service add $app --description="Extendable continuous integration serve
#=================================================
# START SYSTEMD SERVICE
#=================================================
-ynh_script_progression --message="Starting a systemd service..." --weight=20
+ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
@@ -258,7 +250,7 @@ ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins
#=================================================
# SETUP SSOWAT
#=================================================
-ynh_script_progression --message="Configuring permissions..." --weight=9
+ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@@ -269,7 +261,7 @@ then
fi
# /path/github-webhook has to be accessible for github's webhooks
-ynh_permission_create --permission="github-webhook" --url "/github-webhook" --allowed="visitors" --show_tile="false" --protected="true"
+ynh_permission_create --permission="github-webhook" --url="/github-webhook" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX
@@ -296,4 +288,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Installation of $app completed" --last
+ynh_script_progression --message="Installation of $app completed"
diff --git a/scripts/remove b/scripts/remove
index 4e9d00b..f247c70 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=4
+ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@@ -28,7 +28,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
- ynh_script_progression --message="Removing $app service integration..." --weight=1
+ ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
@@ -42,7 +42,7 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LSB
#=================================================
# REMOVE DEPENDENCIES
#=================================================
-ynh_script_progression --message="Removing dependencies..." --weight=20
+ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_package_autopurge $app
@@ -59,7 +59,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
+ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
@@ -81,4 +81,4 @@ ynh_secure_remove --file="/var/log/$app"
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Removal of $app completed" --last
+ynh_script_progression --message="Removal of $app completed"
diff --git a/scripts/restore b/scripts/restore
index 44229ee..b283384 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -8,7 +8,6 @@
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
-source ../settings/scripts/ynh_maintenance_mode
source ../settings/scripts/ynh_send_readme_to_admin__2
source /usr/share/yunohost/helpers
@@ -28,7 +27,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
-ynh_script_progression --message="Loading settings..." --weight=2
+ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@@ -47,19 +46,12 @@ ynh_webpath_available --domain=$domain --path_url=$path_url \
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
-#=================================================
-# ACTIVATE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Activating maintenance mode..." --weight=2
-
-ynh_maintenance_mode_ON
-
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Restoring the nginx configuration..."
+ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@@ -68,7 +60,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
-ynh_script_progression --message="Reinstalling dependencies..." --weight=20
+ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@@ -99,7 +91,7 @@ pid_change_port=$!
#=================================================
# INSTALL JENKINS
#=================================================
-ynh_script_progression --message="Installing Jenkins..." --weight=25
+ynh_script_progression --message="Installing Jenkins..."
# Download jenkins deb file and install it.
ynh_setup_source --dest_dir="../conf"
@@ -108,7 +100,7 @@ dpkg --install --force-confnew ../conf/jenkins.deb
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
-ynh_script_progression --message="Restoring the app main directory..." --weight=4
+ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
@@ -129,17 +121,10 @@ yunohost service add $app --description="Extendable continuous integration serve
#=================================================
# START SYSTEMD SERVICE
#=================================================
-ynh_script_progression --message="Starting a systemd service..." --weight=20
+ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
-#=================================================
-# DEACTIVE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Disabling maintenance mode..."
-
-ynh_maintenance_mode_OFF
-
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
@@ -167,4 +152,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Restoration completed for $app" --last
+ynh_script_progression --message="Restoration completed for $app"
diff --git a/scripts/upgrade b/scripts/upgrade
index 902553d..90405df 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -7,14 +7,13 @@
#=================================================
source _common.sh
-source ynh_maintenance_mode
source ynh_send_readme_to_admin__2
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=4
+ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@@ -34,7 +33,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
-ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
+ynh_script_progression --message="Ensuring downward compatibility..."
# If overwrite_nginx doesn't exist, create it
if [ -z "$overwrite_nginx" ]; then
@@ -68,25 +67,18 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
-ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=40
+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 () {
ynh_clean_check_starting
- # restore it if the upgrade fails
+ # Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
-#=================================================
-# ACTIVATE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Activating maintenance mode..." --weight=2
-
-ynh_maintenance_mode_ON
-
ynh_backup_if_checksum_is_different --file="/etc/default/jenkins"
ynh_backup_if_checksum_is_different --file="$final_path/config.xml"
@@ -105,7 +97,7 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LSB
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
- ynh_script_progression --message="Upgrading source files..." --weight=40
+ ynh_script_progression --message="Upgrading source files..."
# Download jenkins deb file and install it.
ynh_setup_source --dest_dir="../conf"
dpkg --install --force-confnew ../conf/jenkins.deb
@@ -131,7 +123,7 @@ fi
# Overwrite the nginx configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ]
then
- ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=4
+ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
@@ -140,7 +132,7 @@ fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
-ynh_script_progression --message="Upgrading dependencies..." --weight=12
+ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
@@ -149,25 +141,18 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RELOAD NGINX
#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=2
+ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# CHECK JENKINS STARTING
#=================================================
-ynh_script_progression --message="Restarting Jenkins..." --weight=25
+ynh_script_progression --message="Restarting Jenkins..."
# Wait for Jenkins to be fully started
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
-#=================================================
-# DEACTIVE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Disabling maintenance mode..." --weight=6
-
-ynh_maintenance_mode_OFF
-
#=================================================
# UPGRADE JENKINS-CLI.JAR
#=================================================
@@ -179,7 +164,7 @@ mv -f $final_path/jenkins-cli.jar.temp $final_path/jenkins-cli.jar
#=================================================
# UPGRADE PLUGINS
#=================================================
-ynh_script_progression --message="Upgrading plugins..." --weight=40
+ynh_script_progression --message="Upgrading plugins..."
cp $final_path/config.xml $final_path/config.xml.bak
@@ -202,14 +187,6 @@ ynh_store_file_checksum --file="$final_path/config.xml"
#=================================================
# GENERIC FINALIZATION
-#=================================================
-# SECURE FILES AND DIRECTORIES
-#=================================================
-ynh_script_progression --message="Securing files and directories..."
-
-# Set permissions on app files
-chown -R $app:$app $final_path
-
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@@ -249,4 +226,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Upgrade of $app completed" --last
+ynh_script_progression --message="Upgrade of $app completed"
diff --git a/scripts/ynh_maintenance_mode b/scripts/ynh_maintenance_mode
deleted file mode 100644
index 501b7c1..0000000
--- a/scripts/ynh_maintenance_mode
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-ynh_maintenance_mode_ON () {
- # Load value of $path_url and $domain from the config if their not set
- if [ -z $path_url ]; then
- path_url=$(ynh_app_setting_get $app path)
- fi
- if [ -z $domain ]; then
- domain=$(ynh_app_setting_get $app domain)
- fi
-
- mkdir -p /var/www/html/
-
- # Create an html to serve as maintenance notice
- echo "
-
-
-
-Your app $app is currently under maintenance!
-
-
-
-Your app $app is currently under maintenance!
-This app has been put under maintenance by your administrator at $(date)
-Please wait until the maintenance operation is done. This page will be reloaded as soon as your app will be back.
-
-
-" > "/var/www/html/maintenance.$app.html"
-
- # Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
- echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
-rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
-# Use another location, to not be in conflict with the original config file
-location ${path_url}_maintenance/ {
-alias /var/www/html/ ;
-
-try_files maintenance.$app.html =503;
-
-# Include SSOWAT user panel.
-include conf.d/yunohost_panel.conf.inc;
-}" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
-
- # The current config file will redirect all requests to the root of the app.
- # To keep the full path, we can use the following rewrite rule:
- # rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
- # The difference will be in the $1 at the end, which keep the following queries.
- # But, if it works perfectly for a html request, there's an issue with any php files.
- # This files are treated as simple files, and will be downloaded by the browser.
- # Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
-
- systemctl reload nginx
-}
-
-ynh_maintenance_mode_OFF () {
- # Load value of $path_url and $domain from the config if their not set
- if [ -z $path_url ]; then
- path_url=$(ynh_app_setting_get $app path)
- fi
- if [ -z $domain ]; then
- domain=$(ynh_app_setting_get $app domain)
- fi
-
- # Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
- echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
- systemctl reload nginx
-
- # Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
- sleep 4
-
- # Then remove the temporary files used for the maintenance.
- rm "/var/www/html/maintenance.$app.html"
- rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
-
- systemctl reload nginx
-}