1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Fix typos and follow example_ynh template

This commit is contained in:
Éric Gaspar 2022-10-28 10:59:40 +02:00
parent 319b0119b2
commit 011fc2a6c1
6 changed files with 25 additions and 29 deletions

View file

@ -45,12 +45,16 @@ upstream_version=$(ynh_app_upstream_version)
final_www_path="/var/www/$app" final_www_path="/var/www/$app"
data_path="/home/yunohost.app/matrix-$app" data_path="/home/yunohost.app/matrix-$app"
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
ynh_backup --src_path="$final_www_path" ynh_backup --src_path="$final_www_path"
@ -58,7 +62,6 @@ ynh_backup --src_path="$final_www_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
ynh_backup --src_path "/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path "/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -72,14 +75,12 @@ fi
#================================================= #=================================================
# BACKUP THE POSTGRESQL DATABASE # BACKUP THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_print_info --message="Backing up the PostgreSQL database..."
ynh_psql_dump_db --database="$synapse_db_name" > ${YNH_CWD}/dump.sql ynh_psql_dump_db --database="$synapse_db_name" > ${YNH_CWD}/dump.sql
#================================================= #=================================================
# BACKUP FAIL2BAN CONFIGURATION # BACKUP FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Backing up fail2ban configuration"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
@ -89,14 +90,12 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#================================================= #=================================================
# BACKUP SYNAPSE CONFIG # BACKUP SYNAPSE CONFIG
#================================================= #=================================================
ynh_print_info --message="Backing up synapse configuration..."
ynh_backup --src_path="/etc/matrix-$app" ynh_backup --src_path="/etc/matrix-$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_print_info --message="Backing up systemd configuration..."
ynh_backup --src_path="/etc/default/matrix-$app" ynh_backup --src_path="/etc/default/matrix-$app"
ynh_backup --src_path="/etc/systemd/system/matrix-$app.service" ynh_backup --src_path="/etc/systemd/system/matrix-$app.service"
@ -106,21 +105,18 @@ ynh_backup --src_path="/etc/systemd/system/coturn-$app.service"
#================================================= #=================================================
# BACKUP SYNAPSE DATA # BACKUP SYNAPSE DATA
#================================================= #=================================================
ynh_print_info --message="Backing up synapse data..."
ynh_backup --src_path="$data_path" --is_big=1 ynh_backup --src_path="$data_path" --is_big=1
#================================================= #=================================================
# BACKUP SYNAPSE LOG # BACKUP SYNAPSE LOG
#================================================= #=================================================
ynh_print_info --message="Backing up synapse log..."
ynh_backup --src_path="/var/log/matrix-$app" --is_big=1 ynh_backup --src_path="/var/log/matrix-$app" --is_big=1
#================================================= #=================================================
# BACKUP HOOKS # BACKUP HOOKS
#================================================= #=================================================
ynh_print_info --message="Backing up synapse hook..."
# Copy hook # Copy hook
ynh_backup --src_path "/etc/yunohost/hooks.d/post_cert_update/50-$app" ynh_backup --src_path "/etc/yunohost/hooks.d/post_cert_update/50-$app"

View file

@ -67,7 +67,7 @@ ynh_systemd_action --service_name=matrix-$app.service --action=stop
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating nginx configuration..." ynh_script_progression --message="Updating NGINX configuration..."
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -89,7 +89,7 @@ fi
# UPDATE SYNAPSE CONFIG # UPDATE SYNAPSE CONFIG
#================================================= #=================================================
ynh_script_progression --message="Updating synapse config..." --weight=2 ynh_script_progression --message="Updating Synapse config..." --weight=2
# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times)
# For any update do it in all files # For any update do it in all files
@ -127,7 +127,7 @@ chmod u=rwX,g=rX,o= -R /etc/matrix-$app
#================================================= #=================================================
# RELOAD SERVICES # RELOAD SERVICES
#================================================= #=================================================
ynh_script_progression --message="Restarting synapse services..." --weight=5 ynh_script_progression --message="Restarting Synapse services..." --weight=5
ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=coturn-$app.service --action=restart
ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300

View file

@ -197,7 +197,7 @@ chown $synapse_user:root -R $final_www_path
# CREATE SYNAPSE CONFIG # CREATE SYNAPSE CONFIG
#================================================= #=================================================
ynh_script_progression --message="Creating synapse config..." --weight=3 ynh_script_progression --message="Creating Synapse config..." --weight=3
# Go in virtualenvironnement # Go in virtualenvironnement
set +u; set +u;
@ -237,7 +237,7 @@ ynh_add_systemd_config --service=coturn-$app --template=coturn-synapse.service
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=2 ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_script_progression --message="Configuring application..." ynh_script_progression --message="Configuring application..."
@ -255,7 +255,7 @@ ynh_add_nginx_config app
#================================================= #=================================================
# SET SYNAPSE CONFIG # SET SYNAPSE CONFIG
#================================================= #=================================================
ynh_script_progression --message="Configuring synapse..." --weight=2 ynh_script_progression --message="Configuring Synapse..." --weight=2
# Find password for turnserver and database # Find password for turnserver and database
turnserver_pwd=$(ynh_string_random --length=30) turnserver_pwd=$(ynh_string_random --length=30)
@ -283,7 +283,7 @@ ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml"
#================================================= #=================================================
# SET COTURN CONFIG # SET COTURN CONFIG
#================================================= #=================================================
ynh_script_progression --message="Configuring coturn..." --weight=1 ynh_script_progression --message="Configuring Coturn..." --weight=1
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
@ -381,7 +381,7 @@ yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port
#================================================= #=================================================
# RELOAD SERVICES # RELOAD SERVICES
#================================================= #=================================================
ynh_script_progression --message="Restarting synapse services..." --weight=11 ynh_script_progression --message="Restarting Synapse services..." --weight=11
ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=coturn-$app.service --action=restart
ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300
@ -389,7 +389,7 @@ ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Syn
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Configuring fail2ban..." --weight=10 ynh_script_progression --message="Configuring Fail2Ban..." --weight=10
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files

View file

@ -93,7 +93,7 @@ ynh_secure_remove --file=/etc/nginx/conf.d/${server_name}.d/${app}_server_name.c
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration" --weight=2 ynh_script_progression --message="Removing NGINX web server configuration" --weight=2
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -129,7 +129,7 @@ closeport $turnserver_alt_tls_port
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing fail2ban configuration..." --weight=8 ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8
# Remove the dedicated fail2ban config # Remove the dedicated fail2ban config
ynh_remove_fail2ban_config ynh_remove_fail2ban_config

View file

@ -101,7 +101,7 @@ install_sources
# RESTORE FAIL2BAN CONFIGURATION # RESTORE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Reload fail2ban..." --weight=6 ynh_script_progression --message="Reload Fail2Ban..." --weight=6
ynh_systemd_action --action=restart --service_name=fail2ban ynh_systemd_action --action=restart --service_name=fail2ban
#================================================= #=================================================
@ -155,7 +155,7 @@ fi
#================================================= #=================================================
# RECONFIGURE THE TURNSERVER # RECONFIGURE THE TURNSERVER
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring coturn..." --weight=23 ynh_script_progression --message="Reconfiguring Coturn..." --weight=23
# To be sure that at the restoration the IP address in coturn config is the same as the real address we remake the coturn config # To be sure that at the restoration the IP address in coturn config is the same as the real address we remake the coturn config
@ -227,7 +227,7 @@ chown $synapse_user:root -R $final_www_path
#================================================= #=================================================
# RELOAD NGINX, SYNAPSE AND COTURN # RELOAD NGINX, SYNAPSE AND COTURN
#================================================= #=================================================
ynh_script_progression --message="Restarting synapse services..." --weight=7 ynh_script_progression --message="Restarting Synapse services..." --weight=7
ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=coturn-$app.service --action=restart
ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300
@ -256,7 +256,7 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --type="restore"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
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

View file

@ -318,7 +318,7 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_script_progression --message="Configuring application..." ynh_script_progression --message="Configuring application..."
@ -330,7 +330,7 @@ then
ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
fi fi
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config app ynh_add_nginx_config app
#================================================= #=================================================
@ -338,7 +338,7 @@ ynh_add_nginx_config app
#================================================= #=================================================
# UPDATE COTURN CONFIG # UPDATE COTURN CONFIG
#================================================= #=================================================
ynh_script_progression --message="Updating coturn config..." --weight=1 ynh_script_progression --message="Updating Coturn config..." --weight=1
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
@ -397,7 +397,7 @@ ynh_add_systemd_config --service=coturn-$app --template=coturn-synapse.service
#================================================= #=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=8 ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
@ -480,7 +480,7 @@ ynh_app_setting_set --app=$app --key=synapse_version --value=$upstream_version
#================================================= #=================================================
# RELOAD SERVICES # RELOAD SERVICES
#================================================= #=================================================
ynh_script_progression --message="Restarting synapse services..." --weight=5 ynh_script_progression --message="Restarting Synapse services..." --weight=5
ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=coturn-$app.service --action=restart
ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300