Merge pull request #133 from YunoHost/ericgaspar-patch
Ericgaspar patch
This commit is contained in:
		
						commit
						56d67669a3
					
				@ -71,8 +71,7 @@ https://yunohost.org/packaging_apps
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Developer info
 | 
					## Developer info
 | 
				
			||||||
----------------
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
 | 
					**Only if you want to use a testing branch for coding, instead of merging directly into master.**
 | 
				
			||||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing).
 | 
					Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing).
 | 
				
			||||||
 | 
				
			|||||||
@ -62,8 +62,7 @@ https://yunohost.org/packaging_apps
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Informations pour les développeurs
 | 
					## Informations pour les développeurs
 | 
				
			||||||
----------------
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
 | 
					**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
 | 
				
			||||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing).
 | 
					Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing).
 | 
				
			||||||
 | 
				
			|||||||
@ -6,11 +6,11 @@ about: When creating a bug report, please use the following template to provide
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
**How to post a meaningful bug report**
 | 
					**How to post a meaningful bug report**
 | 
				
			||||||
1. *Read this whole template first.*
 | 
					1. *Read this whole template first.*
 | 
				
			||||||
2. *Make sure you are on the right place:*
 | 
					2. *Determine if you are on the right place:*
 | 
				
			||||||
   - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
 | 
					   - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
 | 
				
			||||||
   - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
 | 
					   - *Otherwise, the issue may be due to REPLACEBYYOURAPP itself. Refer to its documentation or repository for help.*
 | 
				
			||||||
   - *In doubt, ask here and we will figure it out together.*
 | 
					   - *When in doubt, post here and we will figure it out together.*
 | 
				
			||||||
3. *Delete these italic comments as you write over them below, and remove this guide.*
 | 
					3. *Delete the italic comments as you write over them below, and remove this guide.*
 | 
				
			||||||
--- 
 | 
					--- 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Describe the bug
 | 
					### Describe the bug
 | 
				
			||||||
@ -22,7 +22,7 @@ about: When creating a bug report, please use the following template to provide
 | 
				
			|||||||
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
 | 
					- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
 | 
				
			||||||
- YunoHost version: x.x.x
 | 
					- YunoHost version: x.x.x
 | 
				
			||||||
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
 | 
					- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
 | 
				
			||||||
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
 | 
					- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
 | 
				
			||||||
  - If yes, please explain:
 | 
					  - If yes, please explain:
 | 
				
			||||||
- Using, or trying to install package version/branch:
 | 
					- Using, or trying to install package version/branch:
 | 
				
			||||||
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
 | 
					- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
 | 
				
			||||||
@ -36,8 +36,8 @@ about: When creating a bug report, please use the following template to provide
 | 
				
			|||||||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
 | 
					- *If you used the webadmin, please perform the equivalent command from the CLI first.*
 | 
				
			||||||
- *If the error occurs in your browser, explain what you did:*
 | 
					- *If the error occurs in your browser, explain what you did:*
 | 
				
			||||||
   1. *Go to '...'*
 | 
					   1. *Go to '...'*
 | 
				
			||||||
   2. *Click on '....'*
 | 
					   2. *Click on '...'*
 | 
				
			||||||
   3. *Scroll down to '....'*
 | 
					   3. *Scroll down to '...'*
 | 
				
			||||||
   4. *See error*
 | 
					   4. *See error*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Expected behavior
 | 
					### Expected behavior
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
# IMPORT GENERIC HELPERS
 | 
					# IMPORT GENERIC HELPERS
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
 | 
					# 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/_common.sh
 | 
				
			||||||
source /usr/share/yunohost/helpers
 | 
					source /usr/share/yunohost/helpers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -95,7 +95,7 @@ ynh_backup --src_path="/etc/$app/"
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_print_info --message="Backing up the MySQL database..."
 | 
					ynh_print_info --message="Backing up the MySQL database..."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### (However, things like mysql dumps *do* take some time to run, though the
 | 
					### (However, things like MySQL dumps *do* take some time to run, though the
 | 
				
			||||||
### copy of the generated dump to the archive still happens later)
 | 
					### copy of the generated dump to the archive still happens later)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
 | 
					ynh_mysql_dump_db --database="$db_name" > db.sql
 | 
				
			||||||
 | 
				
			|||||||
@ -37,7 +37,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)..." --time --weight=1
 | 
					ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Backup the current version of the app
 | 
					# Backup the current version of the app
 | 
				
			||||||
ynh_backup_before_upgrade
 | 
					ynh_backup_before_upgrade
 | 
				
			||||||
@ -45,7 +45,7 @@ ynh_clean_setup () {
 | 
				
			|||||||
	# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
 | 
						# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
 | 
				
			||||||
	ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
 | 
						ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# restore it if the upgrade fails
 | 
						# Restore it if the upgrade fails
 | 
				
			||||||
	ynh_restore_upgradebackup
 | 
						ynh_restore_upgradebackup
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
# Exit if an error occurs during the execution of the script
 | 
					# Exit if an error occurs during the execution of the script
 | 
				
			||||||
@ -79,23 +79,23 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# MODIFY URL IN NGINX CONF
 | 
					# MODIFY URL IN NGINX CONF
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
 | 
					nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Change the path in the nginx config file
 | 
					# Change the path in the NGINX config file
 | 
				
			||||||
if [ $change_path -eq 1 ]
 | 
					if [ $change_path -eq 1 ]
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
	# Make a backup of the original nginx config file if modified
 | 
						# Make a backup of the original NGINX config file if modified
 | 
				
			||||||
	ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
 | 
						ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
 | 
				
			||||||
	# Set global variables for nginx helper
 | 
						# Set global variables for NGINX helper
 | 
				
			||||||
	domain="$old_domain"
 | 
						domain="$old_domain"
 | 
				
			||||||
	path_url="$new_path"
 | 
						path_url="$new_path"
 | 
				
			||||||
	# Create a dedicated nginx config
 | 
						# Create a dedicated NGINX config
 | 
				
			||||||
	ynh_add_nginx_config
 | 
						ynh_add_nginx_config
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Change the domain for nginx
 | 
					# Change the domain for NGINX
 | 
				
			||||||
if [ $change_domain -eq 1 ]
 | 
					if [ $change_domain -eq 1 ]
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
	# Delete file checksum for the old conf file location
 | 
						# Delete file checksum for the old conf file location
 | 
				
			||||||
@ -123,7 +123,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# RELOAD NGINX
 | 
					# RELOAD NGINX
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
 | 
					ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ynh_systemd_action --service_name=nginx --action=reload
 | 
					ynh_systemd_action --service_name=nginx --action=reload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -33,14 +33,14 @@ password=$YNH_APP_ARG_PASSWORD
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### If it's a multi-instance app, meaning it can be installed several times independently
 | 
					### If it's a multi-instance app, meaning it can be installed several times independently
 | 
				
			||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
 | 
					### The id of the app as stated in the manifest is available as $YNH_APP_ID
 | 
				
			||||||
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
 | 
					### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2"...)
 | 
				
			||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
 | 
					### The app instance name is available as $YNH_APP_INSTANCE_NAME
 | 
				
			||||||
###    - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
 | 
					###    - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
 | 
				
			||||||
###    - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
 | 
					###    - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
 | 
				
			||||||
###    - ynhexample__{N} for the subsequent installations, with N=3,4, ...
 | 
					###    - ynhexample__{N} for the subsequent installations, with N=3,4...
 | 
				
			||||||
### The app instance name is probably what interests you most, since this is
 | 
					### The app instance name is probably what interests you most, since this is
 | 
				
			||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
 | 
					### guaranteed to be unique. This is a good unique identifier to define installation path,
 | 
				
			||||||
### db names, ...
 | 
					### db names...
 | 
				
			||||||
app=$YNH_APP_INSTANCE_NAME
 | 
					app=$YNH_APP_INSTANCE_NAME
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -56,8 +56,8 @@ app=$YNH_APP_INSTANCE_NAME
 | 
				
			|||||||
### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
 | 
					### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
 | 
				
			||||||
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
 | 
					ynh_script_progression --message="Validating installation parameters..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
 | 
					### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
 | 
				
			||||||
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
 | 
					### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app"
 | 
				
			||||||
final_path=/var/www/$app
 | 
					final_path=/var/www/$app
 | 
				
			||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
 | 
					test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -92,7 +92,7 @@ port=$(ynh_find_port --port=8095)
 | 
				
			|||||||
ynh_app_setting_set --app=$app --key=port --value=$port
 | 
					ynh_app_setting_set --app=$app --key=port --value=$port
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Optional: Expose this port publicly
 | 
					# Optional: Expose this port publicly
 | 
				
			||||||
# (N.B. : you only need to do this if the app actually needs to expose the port publicly.
 | 
					# (N.B.: you only need to do this if the app actually needs to expose the port publicly.
 | 
				
			||||||
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
 | 
					# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Open the port
 | 
					# Open the port
 | 
				
			||||||
@ -148,11 +148,11 @@ ynh_setup_source --dest_dir="$final_path"
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# NGINX CONFIGURATION
 | 
					# NGINX CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
 | 
					ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
 | 
					### `ynh_add_nginx_config` will use the file conf/nginx.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a dedicated nginx config
 | 
					# Create a dedicated NGINX config
 | 
				
			||||||
ynh_add_nginx_config
 | 
					ynh_add_nginx_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -166,7 +166,7 @@ ynh_system_user_create --username=$app
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# PHP-FPM CONFIGURATION
 | 
					# PHP-FPM CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
 | 
					ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### `ynh_add_fpm_config` is used to set up a PHP config.
 | 
					### `ynh_add_fpm_config` is used to set up a PHP config.
 | 
				
			||||||
### You can remove it if your app doesn't use PHP.
 | 
					### You can remove it if your app doesn't use PHP.
 | 
				
			||||||
@ -176,10 +176,10 @@ ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
 | 
				
			|||||||
###		- Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
 | 
					###		- Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
 | 
				
			||||||
###		- Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
 | 
					###		- Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
 | 
				
			||||||
###		- As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
 | 
					###		- As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
 | 
				
			||||||
###		With the reload at the end of the script.
 | 
					###		  with the reload at the end of the script.
 | 
				
			||||||
###		- And the section "PHP-FPM CONFIGURATION" in the upgrade script
 | 
					###		- And the section "PHP-FPM CONFIGURATION" in the upgrade script
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a dedicated php-fpm config
 | 
					# Create a dedicated PHP-FPM config
 | 
				
			||||||
ynh_add_fpm_config
 | 
					ynh_add_fpm_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -225,7 +225,7 @@ ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
 | 
				
			|||||||
# Reload SSOwat config
 | 
					# Reload SSOwat config
 | 
				
			||||||
yunohost app ssowatconf
 | 
					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
 | 
				
			||||||
@ -294,7 +294,7 @@ ynh_script_progression --message="Integrating service in YunoHost..." --time --w
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### `yunohost service add` integrates a service in YunoHost. It then gets 
 | 
					### `yunohost service add` integrates a service in YunoHost. It then gets 
 | 
				
			||||||
### displayed in the admin interface and through the others `yunohost service` commands.
 | 
					### displayed in the admin interface and through the others `yunohost service` commands.
 | 
				
			||||||
### (N.B. : this line only makes sense if the app adds a service to the system!)
 | 
					### (N.B.: this line only makes sense if the app adds a service to the system!)
 | 
				
			||||||
### If you're not using these lines:
 | 
					### If you're not using these lines:
 | 
				
			||||||
###		- You can remove these files in conf/.
 | 
					###		- You can remove these files in conf/.
 | 
				
			||||||
###		- Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script
 | 
					###		- Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script
 | 
				
			||||||
@ -307,7 +307,7 @@ yunohost service add $app --description "A short description of the app" --log "
 | 
				
			|||||||
###
 | 
					###
 | 
				
			||||||
### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed
 | 
					### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed
 | 
				
			||||||
###                               which will then be checked by YunoHost's diagnosis system
 | 
					###                               which will then be checked by YunoHost's diagnosis system
 | 
				
			||||||
###                               (N.B. DO NOT USE THIS is the port is only internal !!!)
 | 
					###                               (N.B. DO NOT USE THIS is the port is only internal!!!)
 | 
				
			||||||
###
 | 
					###
 | 
				
			||||||
### --test_status "some command"  a custom command to check the status of the service
 | 
					### --test_status "some command"  a custom command to check the status of the service
 | 
				
			||||||
###                               (only relevant if 'systemctl status' doesn't do a good job)
 | 
					###                               (only relevant if 'systemctl status' doesn't do a good job)
 | 
				
			||||||
@ -318,7 +318,6 @@ yunohost service add $app --description "A short description of the app" --log "
 | 
				
			|||||||
### to proceed if you later realize that you need to enable some flags that
 | 
					### to proceed if you later realize that you need to enable some flags that
 | 
				
			||||||
### weren't enabled on old installs (be careful it'll override the existing
 | 
					### weren't enabled on old installs (be careful it'll override the existing
 | 
				
			||||||
### service though so you should re-provide all relevant flags when doing so)
 | 
					### service though so you should re-provide all relevant flags when doing so)
 | 
				
			||||||
###
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# START SYSTEMD SERVICE
 | 
					# START SYSTEMD SERVICE
 | 
				
			||||||
@ -339,9 +338,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# SETUP FAIL2BAN
 | 
					# SETUP FAIL2BAN
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Configuring fail2ban..." --time --weight=1
 | 
					ynh_script_progression --message="Configuring Fail2Ban..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a dedicated fail2ban config
 | 
					# Create a dedicated Fail2Ban config
 | 
				
			||||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
 | 
					ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -359,7 +358,7 @@ fi
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# RELOAD NGINX
 | 
					# RELOAD NGINX
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
 | 
					ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ynh_systemd_action --service_name=nginx --action=reload
 | 
					ynh_systemd_action --service_name=nginx --action=reload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -70,17 +70,17 @@ ynh_secure_remove --file="$final_path"
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# REMOVE NGINX CONFIGURATION
 | 
					# REMOVE NGINX CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Remove the dedicated nginx config
 | 
					# Remove the dedicated NGINX config
 | 
				
			||||||
ynh_remove_nginx_config
 | 
					ynh_remove_nginx_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# REMOVE PHP-FPM CONFIGURATION
 | 
					# REMOVE PHP-FPM CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Removing PHP-FPM configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Remove the dedicated php-fpm config
 | 
					# Remove the dedicated PHP-FPM config
 | 
				
			||||||
ynh_remove_fpm_config
 | 
					ynh_remove_fpm_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -104,9 +104,9 @@ fi
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# REMOVE FAIL2BAN CONFIGURATION
 | 
					# REMOVE FAIL2BAN CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Removing Fail2ban configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Remove the dedicated fail2ban config
 | 
					# Remove the dedicated Fail2Ban config
 | 
				
			||||||
ynh_remove_fail2ban_config
 | 
					ynh_remove_fail2ban_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
# IMPORT GENERIC HELPERS
 | 
					# IMPORT GENERIC HELPERS
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
 | 
					# 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/_common.sh
 | 
				
			||||||
source /usr/share/yunohost/helpers
 | 
					source /usr/share/yunohost/helpers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -84,7 +84,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# RESTORE FAIL2BAN CONFIGURATION
 | 
					# RESTORE FAIL2BAN CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Restoring the fail2ban configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Restoring the Fail2Ban configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
 | 
					ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
 | 
				
			||||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
 | 
					ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
 | 
				
			||||||
@ -150,7 +150,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# RELOAD NGINX AND PHP-FPM
 | 
					# RELOAD NGINX AND PHP-FPM
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
 | 
					ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ynh_systemd_action --service_name=php$phpversion-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
 | 
				
			||||||
 | 
				
			|||||||
@ -70,7 +70,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
 | 
				
			|||||||
# Backup the current version of the app
 | 
					# Backup the current version of the app
 | 
				
			||||||
ynh_backup_before_upgrade
 | 
					ynh_backup_before_upgrade
 | 
				
			||||||
ynh_clean_setup () {
 | 
					ynh_clean_setup () {
 | 
				
			||||||
	# restore it if the upgrade fails
 | 
						# Restore it if the upgrade fails
 | 
				
			||||||
	ynh_restore_upgradebackup
 | 
						ynh_restore_upgradebackup
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
# Exit if an error occurs during the execution of the script
 | 
					# Exit if an error occurs during the execution of the script
 | 
				
			||||||
@ -81,9 +81,9 @@ ynh_abort_if_errors
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Normalize the URL path syntax
 | 
					# Normalize the URL path syntax
 | 
				
			||||||
# N.B. : this is for app installations before YunoHost 2.7
 | 
					# N.B.: this is for app installations before YunoHost 2.7
 | 
				
			||||||
# where this value might be something like /foo/ or foo/
 | 
					# where this value might be something like /foo/ or foo/
 | 
				
			||||||
# instead of /foo ....
 | 
					# instead of /foo
 | 
				
			||||||
# If nobody installed your app before 2.7, then you may
 | 
					# If nobody installed your app before 2.7, then you may
 | 
				
			||||||
# safely remove this line
 | 
					# safely remove this line
 | 
				
			||||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
 | 
					path_url=$(ynh_normalize_url_path --path_url=$path_url)
 | 
				
			||||||
@ -112,9 +112,9 @@ fi
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# NGINX CONFIGURATION
 | 
					# NGINX CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a dedicated nginx config
 | 
					# Create a dedicated NGINX config
 | 
				
			||||||
ynh_add_nginx_config
 | 
					ynh_add_nginx_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -135,9 +135,9 @@ ynh_system_user_create --username=$app
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# PHP-FPM CONFIGURATION
 | 
					# PHP-FPM CONFIGURATION
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1
 | 
					ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a dedicated php-fpm config
 | 
					# Create a dedicated PHP-FPM config
 | 
				
			||||||
ynh_add_fpm_config
 | 
					ynh_add_fpm_config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -201,9 +201,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# UPGRADE FAIL2BAN
 | 
					# UPGRADE FAIL2BAN
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Reconfiguring fail2ban..." --time --weight=1
 | 
					ynh_script_progression --message="Reconfiguring Fail2Ban..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a dedicated fail2ban config
 | 
					# Create a dedicated Fail2Ban config
 | 
				
			||||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
 | 
					ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
@ -221,7 +221,7 @@ fi
 | 
				
			|||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
# RELOAD NGINX
 | 
					# RELOAD NGINX
 | 
				
			||||||
#=================================================
 | 
					#=================================================
 | 
				
			||||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
 | 
					ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ynh_systemd_action --service_name=nginx --action=reload
 | 
					ynh_systemd_action --service_name=nginx --action=reload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user