mirror of
https://github.com/YunoHost-Apps/netdata_ynh.git
synced 2024-09-03 19:46:33 +02:00
68 lines
2.4 KiB
Bash
68 lines
2.4 KiB
Bash
#!/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=$(mktemp -d)
|
|
ynh_setup_source "$NETDATA_TMPDIR" --full_replace=1
|
|
|
|
#=================================================
|
|
# 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
|
|
|
|
# create a temporary file for the log
|
|
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
|
|
|
|
pushd "$NETDATA_TMPDIR"
|
|
# the installer.sh script will append "netdata" after the --install-prefix arg
|
|
./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud >"$tmplog" 2>"$tmplog" || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
|
|
popd
|
|
|
|
# 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
|