#!/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 APP MAIN DIR #================================================= ynh_script_progression --message="Restoring Netdata configuration directory..." --weight=1 ynh_restore_file --origin_path="$install_dir/etc/netdata" #================================================= # INSTALL AND RESTORE THE APP CONFIGURATION #================================================= ynh_script_progression --message="Reinstalling Netdata..." --weight=18 # Download, check integrity, uncompress and patch the source from app.src NETDATA_TMPDIR="$install_dir/netdata_install" mkdir -p $NETDATA_TMPDIR ynh_setup_source --dest_dir="$NETDATA_TMPDIR" GO_TMPDIR="$install_dir/go_install" mkdir -p $GO_TMPDIR ynh_setup_source --source_id="go" --dest_dir="$GO_TMPDIR" export PATH="$GO_TMPDIR/bin:$PATH" export GOPATH="$GO_TMPDIR/go/" export HOME=${HOME:-"/root/"} pushd "$NETDATA_TMPDIR" # the installer.sh script will append "netdata" after the --install-prefix arg ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel popd ynh_secure_remove --file=$NETDATA_TMPDIR ynh_secure_remove --file=$GO_TMPDIR # Specific configuration configure_netdata #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= 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" yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name="$app" --action="start" --log_path="$install_dir/var/log/$app/error.log" ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Restoration completed for $app" --last