1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cinny_ynh.git synced 2024-09-03 18:16:13 +02:00
This commit is contained in:
ericgaspar 2020-08-02 16:00:17 +02:00 committed by Kay0u
parent b0501eade9
commit 644d29331a
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
6 changed files with 25 additions and 26 deletions

View file

@ -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

View file

@ -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

View file

@ -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
@ -176,7 +176,7 @@ 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
@ -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

View file

@ -80,7 +80,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
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
#================================================= #=================================================

View file

@ -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

View file

@ -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