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

Update restore

This commit is contained in:
Thomas 2023-07-10 08:30:57 +02:00 committed by GitHub
parent dd1af19293
commit 8a905103f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,26 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE LOGROTATE
#=================================================
ynh_script_progression --message="Configuring logrotate to manage application logfiles" --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --specific_user=$app
touch /var/log/$app/$app.log
chown -R $app:www-data /var/log/$app/
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -17,34 +37,37 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chown -R $app: "$install_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
# RESTORE SYSTEMD
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/${app}.service"
systemctl enable "${app}.service" --quiet
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=5
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
yunohost service add "${app}" --description="Fittrackee main service" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
yunohost service add $app --description="Machine Translation API" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_systemd_action --service_name="${app}" --action="start"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload