1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/planka_ynh.git synced 2024-09-03 20:06:00 +02:00
planka_ynh/scripts/restore

63 lines
2.1 KiB
Text
Raw Normal View History

2023-12-13 21:25:13 +01:00
#!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
2024-06-23 21:23:05 +02:00
ynh_script_progression "Restoring the app main directory..."
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_restore "$install_dir"
2023-12-13 21:25:13 +01:00
2023-12-13 23:01:52 +01:00
chmod -R o-rwx "$install_dir"
2023-12-13 21:25:13 +01:00
chown -R $app:www-data "$install_dir"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
2024-06-23 21:23:05 +02:00
ynh_script_progression "Reinstalling dependencies..."
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_nodejs_install
2023-12-13 21:25:13 +01:00
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
2024-06-23 21:23:05 +02:00
ynh_script_progression "Restoring the MySQL database..."
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_psql_db_shell < ./db.sql
2023-12-13 21:25:13 +01:00
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
2024-06-23 21:23:05 +02:00
ynh_script_progression "Restoring system configurations related to $app..."
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_restore "/etc/systemd/system/$app.service"
2023-12-13 21:25:13 +01:00
systemctl enable $app.service --quiet
yunohost service add $app --description="Realtime kanban board for workgroups" --log="/var/log/$app/$app.log"
2024-06-23 21:23:05 +02:00
ynh_restore "/etc/fail2ban/jail.d/$app.conf"
ynh_restore "/etc/fail2ban/filter.d/$app.conf"
ynh_systemctl --action=restart --service=fail2ban
2023-12-13 21:47:23 +01:00
2023-12-13 21:25:13 +01:00
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
2024-06-23 21:23:05 +02:00
ynh_script_progression "Reloading NGINX web server and $app's service..."
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_systemctl --service=$app --action="start" --log_path="systemd"
2023-12-13 21:25:13 +01:00
2024-06-23 21:23:05 +02:00
ynh_systemctl --service=nginx --action=reload
2023-12-13 21:25:13 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2024-06-23 21:23:05 +02:00
ynh_script_progression "Restoration completed for $app"