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 packaging_format = 2
id = "netdata" id = "netdata"
@ -47,10 +49,10 @@ ram.runtime = "50M"
[resources] [resources]
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
url = "https://github.com/netdata/netdata/releases/download/v1.44.1/netdata-v1.44.1.tar.gz" url = "https://github.com/netdata/netdata/releases/download/v1.44.1/netdata-v1.44.1.tar.gz"
sha256 = "77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95" sha256 = "77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95"
autoupdate.strategy = "latest_github_tag" autoupdate.strategy = "latest_github_tag"
[resources.system_user] [resources.system_user]

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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 # 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_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 # 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 # create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.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 # 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 popd
# Specific configuration # Specific configuration
@ -42,7 +42,7 @@ ynh_script_progression --message="Adding system configurations related to $app..
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_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 # 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 ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # 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 # END OF SCRIPT

View file

@ -10,16 +10,13 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# STANDARD REMOVE # REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
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`) # 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 if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
then yunohost service remove "$app"
ynh_script_progression --message="Removing $app service integration..." --weight=2
yunohost service remove $app
fi fi
# Remove the dedicated NGINX config # 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 # create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.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 # 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 popd
# Specific configuration # Specific configuration
configure_netdata 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" 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"
# 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"
#================================================= #=================================================
# START SYSTEMD SERVICE # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -10,45 +10,37 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# CHECK VERSION # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=18
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] # Download, check integrity, uncompress and patch the source from app.src
then NETDATA_TMPDIR=$(mktemp -d)
ynh_script_progression --message="Upgrading source files..." --weight=18 ynh_setup_source "$NETDATA_TMPDIR"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # SPECIFIC UPGRADE
#================================================= #=================================================
# Download, check integrity, uncompress and patch the source from app.src # signal netdata to start saving its database
NETDATA_TMPDIR=$(mktemp -d) # this is handy if your database is big
ynh_setup_source "$NETDATA_TMPDIR" pids=$(pidof netdata)
if [ -n "${pids}" ]; then
#================================================= kill -USR1 ${pids}
# 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
fi 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 # Specific configuration
configure_netdata configure_netdata
@ -60,14 +52,14 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_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 # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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 # END OF SCRIPT

View file

@ -1,7 +1,9 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0 test_format = 1.0
[default] [default]
# ------------ # ------------
# Tests to run # Tests to run
# ------------ # ------------