1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00
mattermost_ynh/scripts/restore

69 lines
2.3 KiB
Text
Raw Normal View History

2017-09-11 12:05:16 +02:00
#!/bin/bash
2021-01-11 23:46:48 +01:00
#=================================================
# GENERIC START
2017-09-11 12:05:16 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2021-01-11 23:46:48 +01:00
source ../settings/scripts/_common.sh
2017-09-11 12:05:16 +02:00
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
2021-01-11 23:46:48 +01:00
ynh_script_progression --message="Restoring the app main directory..." --weight=2
2017-09-11 12:05:16 +02:00
2023-02-07 22:27:23 +01:00
ynh_restore_file --origin_path="$install_dir"
2017-09-11 12:05:16 +02:00
2023-02-07 22:27:23 +01:00
chown -R $app:www-data "$install_dir"
2021-09-16 11:39:20 +02:00
2017-09-11 12:05:16 +02:00
#=================================================
2021-09-16 11:39:20 +02:00
# RESTORE THE DATA DIRECTORY
#=================================================
2021-09-16 11:39:20 +02:00
ynh_script_progression --message="Restoring the data directory..." --weight=4
2023-02-10 22:41:12 +01:00
ynh_restore_file --origin_path="$data_dir" --not_mandatory
2023-02-10 22:41:12 +01:00
chown -R $app:www-data "$data_dir"
2017-09-11 12:05:16 +02:00
2022-06-22 10:58:12 +02:00
#=================================================
2023-03-07 09:15:05 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2022-06-22 10:58:12 +02:00
#=================================================
2023-03-07 09:15:05 +01:00
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2022-06-22 10:58:12 +02:00
2023-03-07 09:15:05 +01:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2017-09-11 12:05:16 +02:00
2023-03-07 09:15:05 +01:00
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
2017-09-11 12:05:16 +02:00
2021-01-11 23:46:48 +01:00
logs_path="/var/log/$app"
mkdir -p $logs_path
chown -R $app: $logs_path
2017-10-10 12:47:33 +02:00
ynh_restore_file "/etc/systemd/system/$app.service"
2021-01-11 23:46:48 +01:00
systemctl enable $app.service --quiet
2017-09-11 12:05:16 +02:00
2021-01-11 23:46:48 +01:00
yunohost service add $app --description="Collaboration platform built for developers" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
2017-09-11 12:05:16 +02:00
#=================================================
# GENERIC FINALIZATION
#=================================================
2023-03-07 09:15:05 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2017-09-11 12:05:16 +02:00
#=================================================
2023-03-07 09:15:05 +01:00
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Mattermost"
2017-09-11 12:05:16 +02:00
2021-01-11 23:46:48 +01:00
ynh_systemd_action --service_name=nginx --action=reload
2017-10-12 08:08:53 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
# END OF SCRIPT
2017-10-12 08:08:53 +02:00
#=================================================
2021-01-11 23:46:48 +01:00
ynh_script_progression --message="Restoration completed for $app" --last