2020-05-15 20:07:10 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD RESTORATION STEPS
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
2020-10-05 20:58:38 +02:00
|
|
|
ynh_script_progression --message="Restoring Meilisearch main directory..." --weight=1
|
2020-05-15 20:07:10 +02:00
|
|
|
|
2023-04-17 15:35:40 +02:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2020-05-15 20:07:10 +02:00
|
|
|
|
2023-04-17 15:35:40 +02:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-06-04 10:11:38 +02:00
|
|
|
|
2020-05-15 20:07:10 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC RESTORATION
|
|
|
|
#=================================================
|
|
|
|
# RESTORE SYSTEMD
|
|
|
|
#=================================================
|
2020-10-05 20:58:38 +02:00
|
|
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
2020-05-15 20:07:10 +02:00
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
2020-12-14 09:04:42 +01:00
|
|
|
systemctl enable $app.service --quiet
|
2020-05-15 20:07:10 +02:00
|
|
|
|
2021-10-08 09:25:27 +02:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE LOGROTATE CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
|
|
|
2020-05-15 20:07:10 +02:00
|
|
|
#=================================================
|
|
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
|
|
#=================================================
|
|
|
|
|
2020-12-14 09:04:42 +01:00
|
|
|
yunohost service add $app --description="Opensource next generation search API" --log="/var/log/$app/$app.log"
|
2020-05-15 20:07:10 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2020-10-05 20:58:38 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
2020-05-15 20:07:10 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
2020-05-16 14:28:07 +02:00
|
|
|
# RELOAD NGINX
|
2020-05-15 20:07:10 +02:00
|
|
|
#=================================================
|
2020-10-05 20:58:38 +02:00
|
|
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
2020-05-15 20:07:10 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-10-05 20:58:38 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for Meilisearch" --last
|