#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=18 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= # 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" #================================================= # SPECIFIC UPGRADE #================================================= # signal netdata to start saving its database # this is handy if your database is big pids=$(pidof netdata) if [ -n "${pids}" ]; then kill -USR1 ${pids} fi 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 #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config 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="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last