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

62 lines
2.2 KiB
Text
Raw Normal View History

2022-04-16 22:59:26 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
2024-01-23 23:44:36 +01:00
ynh_script_progression --message="Restoring the app main directory..." --weight=1
2022-04-16 22:59:26 +02:00
2024-01-23 23:44:36 +01:00
ynh_restore_file --origin_path="$install_dir"
2022-04-16 22:59:26 +02:00
2024-05-04 23:35:16 +02:00
chown -R $app:$app "$install_dir"
2022-04-16 22:59:26 +02:00
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
2024-01-23 23:44:36 +01:00
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
2022-04-16 22:59:26 +02:00
2024-01-23 23:44:36 +01:00
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./appdb.sql
2022-04-16 22:59:26 +02:00
2024-01-23 23:44:36 +01:00
ynh_psql_create_user "$userdata_db_user" "$userdata_db_pwd"
ynh_psql_create_db "$userdata_db_name" "$userdata_db_user"
2024-05-02 23:40:14 +02:00
ynh_psql_connect_as --user=$userdata_db_user --password=$userdata_db_pwd --database=$userdata_db_name < ./userdb.sql
2022-04-16 22:59:26 +02:00
#=================================================
2024-01-23 23:44:36 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2022-04-16 22:59:26 +02:00
#=================================================
2024-01-23 23:44:36 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2022-04-16 22:59:26 +02:00
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
mkdir -p "/var/log/$app"
2024-01-23 23:44:36 +01:00
yunohost service add $app --log="/var/log/$app/$app.log"
2022-04-16 22:59:26 +02:00
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
2024-01-23 23:44:36 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2022-04-16 22:59:26 +02:00
#=================================================
2024-01-23 23:44:36 +01:00
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
2022-04-16 22:59:26 +02:00
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
2024-01-23 23:44:36 +01:00
ynh_script_progression --message="Restoration completed for $app" --last