yunohost-gitea_ynh/scripts/restore

54 lines
1.8 KiB
Plaintext
Raw Normal View History

2018-02-25 21:45:24 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2020-11-17 23:33:50 +01:00
# Load common variables and helpers
source ../settings/scripts/_common.sh
2018-02-25 21:45:24 +01:00
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression "Restoring the app files..."
ynh_restore_everything
2023-11-29 10:58:11 +01:00
_set_permissions
2018-02-25 21:45:24 +01:00
#=================================================
# RESTORE THE MYSQL DATABASE
2018-02-25 21:45:24 +01:00
#=================================================
ynh_script_progression "Restoring the MySQL database..."
2018-02-25 21:45:24 +01:00
ynh_mysql_db_shell < ./db.sql
2018-02-25 21:45:24 +01:00
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
2018-02-25 21:45:24 +01:00
systemctl daemon-reload
2020-12-08 22:06:19 +01:00
systemctl enable "$app".service --quiet
2018-02-25 21:45:24 +01:00
yunohost service add "$app" --log="/var/log/$app/gitea.log"
2019-02-03 15:05:38 +01:00
# SETUP FAIL2BAN
ynh_script_progression "Configuring fail2ban..."
ynh_config_add_fail2ban --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from <HOST>"
2019-02-03 15:05:38 +01:00
2018-02-25 21:45:24 +01:00
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression "Reloading NGINX web server and $app's service..."
2018-02-25 21:45:24 +01:00
# Typically you only have either $app or php-fpm but not both at the same time...
ynh_systemctl --service="$app" --action=start --log_path="/var/log/$app/gitea.log" --wait_until="$systemd_match_start_line"
2018-02-25 21:45:24 +01:00
ynh_systemctl --service=nginx --action=reload
2018-02-25 21:45:24 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2019-10-27 14:54:35 +01:00
ynh_script_progression "Restoration completed for $app"