peertube-search-index_ynh/scripts/restore

65 lines
2.3 KiB
Text
Raw Permalink Normal View History

2020-10-31 14:18:46 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2021-04-09 23:48:21 +02:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2020-10-31 14:18:46 +01:00
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
2024-02-28 12:03:57 +01:00
# INSTALL NODEJS
2020-10-31 14:18:46 +01:00
#=================================================
2024-02-28 12:03:57 +01:00
ynh_script_progression --message="Reinstalling NodeJS..."
2020-10-31 14:18:46 +01:00
2024-02-28 12:03:57 +01:00
ynh_install_nodejs --nodejs_version="$NODEJS_VERSION"
2020-10-31 14:18:46 +01:00
#=================================================
2024-02-28 12:03:57 +01:00
# START ELASTICSEARCH
2020-10-31 14:18:46 +01:00
#=================================================
2024-02-28 12:03:57 +01:00
ynh_script_progression --message="Starting elasticsearch..."
2020-10-31 14:18:46 +01:00
2024-02-28 12:03:57 +01:00
systemctl enable elasticsearch.service --quiet
systemctl start elasticsearch.service
2020-10-31 14:18:46 +01:00
#=================================================
2021-04-09 23:48:21 +02:00
# RESTORE THE APP MAIN DIR
2020-10-31 14:18:46 +01:00
#=================================================
2021-04-09 23:48:21 +02:00
ynh_script_progression --message="Restoring the app main directory..."
2024-02-28 12:03:57 +01:00
ynh_restore_file --origin_path="$install_dir"
2020-10-31 14:18:46 +01:00
2024-02-28 12:03:57 +01:00
chmod -R o-rwx "$install_dir"
chown -R "$app:$app" "$install_dir"
2020-10-31 14:18:46 +01:00
#=================================================
2024-02-28 12:03:57 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2020-10-31 14:18:46 +01:00
#=================================================
2024-02-28 12:03:57 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2020-10-31 14:18:46 +01:00
2024-02-28 12:03:57 +01:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2020-10-31 14:18:46 +01:00
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
2024-02-28 12:03:57 +01:00
systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="$app search index daemon"
2022-01-07 04:00:37 +01:00
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
2020-10-31 14:18:46 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-02-28 12:03:57 +01:00
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
2020-10-31 14:18:46 +01:00
2024-02-28 12:03:57 +01:00
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Server listening on port"
2020-10-31 14:18:46 +01:00
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"