1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00
This commit is contained in:
Éric Gaspar 2024-08-23 18:05:13 +02:00
parent 557898cd6e
commit 5b42504ca3
5 changed files with 15 additions and 24 deletions

View file

@ -39,7 +39,8 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/var/log/$app" ynh_backup --src_path="/var/log/$app"
ynh_backup --src_path="/etc/systemd/system/$app-daemon.service"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE

View file

@ -16,13 +16,6 @@ source /usr/share/yunohost/helpers
email=$(ynh_user_get_info --username="$admin" --key=mail) email=$(ynh_user_get_info --username="$admin" --key=mail)
timezone=$(cat /etc/timezone) timezone=$(cat /etc/timezone)
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app="$app" --key=email --value="$email"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -48,12 +41,12 @@ ynh_script_progression --message="Adding system configurations related to $app..
# Create a dedicated PHP-FPM configy # Create a dedicated PHP-FPM configy
ynh_add_fpm_config ynh_add_fpm_config
ynh_add_systemd_config --service="$app-daemon" ynh_add_systemd_config
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" yunohost service add "$app" --description="Decentralized Social Network" --log="/var/log/$app/$app.log"
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
@ -90,7 +83,7 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -19,7 +19,7 @@ source /usr/share/yunohost/helpers
if ynh_exec_warn_less yunohost service status "$app" >/dev/null if ynh_exec_warn_less yunohost service status "$app" >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove "$app-daemon" yunohost service remove "$app"
fi fi
#================================================= #=================================================
@ -38,7 +38,7 @@ ynh_remove_logrotate
ynh_remove_fail2ban_config ynh_remove_fail2ban_config
ynh_remove_systemd_config --service="$app-daemon" ynh_remove_systemd_config
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -41,10 +41,10 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app-daemon.service" --quiet systemctl enable "$app-daemon.service" --quiet
yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/var/log/$app" ynh_restore_file --origin_path="/var/log/$app"
@ -54,22 +54,19 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
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
ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" #=================================================
#==============
# FINALIZATION # FINALIZATION
#============== #=================================================
# exit maintenance mode since the app was backed up while in maintenance mode # exit maintenance mode since the app was backed up while in maintenance mode
(cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 0) (cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 0)

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="systemd" ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -54,7 +54,7 @@ fi
ynh_add_systemd_config --service="$app-daemon" ynh_add_systemd_config --service="$app-daemon"
yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" yunohost service add "$app" --description="Decentralized Social Network" --log="/var/log/$app/$app.log"
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$" ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
@ -100,7 +100,7 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT