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

78 lines
2.9 KiB
Text
Raw Normal View History

2017-11-14 16:05:26 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2022-03-13 15:22:35 +01:00
# IMPORT GENERIC HELPERS
#=================================================
2022-03-13 15:22:35 +01:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2020-11-17 23:51:51 +01:00
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
2017-11-14 16:05:26 +01:00
source /usr/share/yunohost/helpers
2024-01-31 14:44:14 +01:00
#=================================================
# RESTORE THE POSTGRESQL SUPERUSER
#=================================================
ynh_script_progression --message="Restoring the Postgresql superuser..." --weight=1
ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION"
2022-03-13 15:22:35 +01:00
#=================================================
2024-01-30 16:37:46 +01:00
# RESTORE THE APP MAIN DIR
2022-03-13 15:22:35 +01:00
#=================================================
2024-01-30 16:37:46 +01:00
ynh_script_progression --message="Restoring the app main directory..." --weight=1
2022-03-13 15:22:35 +01:00
2024-01-30 16:37:46 +01:00
ynh_restore_file --origin_path="$install_dir"
2022-03-13 15:22:35 +01:00
2024-01-31 14:52:39 +01:00
chown -R "$app:root" "$install_dir"
2017-11-14 16:05:26 +01:00
2022-03-13 15:22:35 +01:00
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
2024-01-30 16:48:42 +01:00
ynh_script_progression --message="Updating python virtualenv..." --weight=5
2017-11-14 16:05:26 +01:00
2024-01-30 16:48:42 +01:00
ynh_install_venv
2024-01-30 16:37:46 +01:00
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/etc/uwsgi/apps-available/$app.ini"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2022-03-13 15:22:35 +01:00
#=================================================
# RESTORE VARIOUS FILES
#=================================================
2024-01-31 19:46:18 +01:00
ynh_script_progression --message="Restoring various files..." --weight=1
2019-06-06 22:39:49 +02:00
2024-01-31 14:52:39 +01:00
ynh_restore_file --origin_path="/var/log/$app/"
chmod -R 750 /var/log/pgadmin
chown -R "$app:root" /var/log/pgadmin
2022-03-14 22:13:23 +01:00
2019-06-06 22:39:49 +02:00
# Restore systemd configuration
2024-01-31 19:46:18 +01:00
ynh_script_progression --message="Reconfiguring application..." --weight=1
2021-03-07 17:35:19 +01:00
ynh_restore_uwsgi_service
2017-11-14 16:05:26 +01:00
2022-03-13 15:22:35 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
2024-01-30 17:03:58 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2022-03-13 15:22:35 +01:00
#=================================================
2024-01-30 17:03:58 +01:00
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
2017-11-14 16:05:26 +01:00
2024-01-30 17:03:58 +01:00
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action="restart" --line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
2019-06-06 22:39:49 +02:00
2024-01-30 17:03:58 +01:00
ynh_systemd_action --service_name=nginx --action=reload
2022-03-13 15:22:35 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2019-06-06 22:39:49 +02:00
ynh_script_progression --message="Restoration completed for $app" --last