1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00
netdata_ynh/scripts/install

59 lines
2.2 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="Setting up source files..." --weight=11
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
#=================================================
# BUILD
#=================================================
ynh_script_progression --message="Executing Netdata installer..." --weight=10
# 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 --disable-telemetry --stable-channel >"$tmplog" 2>"$tmplog" || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# Specific configuration
configure_netdata
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Adding 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=2
# Start a systemd service
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last