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

Some small cleanup

This commit is contained in:
Salamandar 2024-02-04 18:47:11 +01:00
parent d64763e576
commit 91365a4c12
7 changed files with 49 additions and 61 deletions

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "netdata"

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
@ -39,7 +39,7 @@ ynh_replace_string --match_string="registry to announce = https://$old_domain$ol
#=================================================
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"
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT

View file

@ -26,9 +26,9 @@ 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
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"
./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
@ -42,7 +42,7 @@ ynh_script_progression --message="Adding system configurations related to $app..
# 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"
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
@ -50,7 +50,7 @@ yunohost service add $app --description "Real-time performance and health monito
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"
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT

View file

@ -10,16 +10,13 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=2
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi
# Remove the dedicated NGINX config

View file

@ -31,34 +31,29 @@ ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
# create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
pushd $NETDATA_TMPDIR
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"
./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
#=================================================
# RESTORE THE NGINX CONFIGURATION
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
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"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
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"
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_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="$app" --action="start" --log_path="$install_dir/var/log/$app/error.log"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -10,45 +10,37 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
ynh_script_progression --message="Upgrading source files..." --weight=18
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=18
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
#=================================================
# SPECIFIC UPGRADE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# signal netdata to start saving its database
# this is handy if your database is big
pids=$(pidof netdata)
[ ! -z "${pids}" ] && kill -USR1 ${pids}
# 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
# 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
@ -60,14 +52,14 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
# 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"
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"
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]