From f65fcc1bedb7a61daa578f58f89bca73ef73e452 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 6 Jan 2024 20:50:12 +0100 Subject: [PATCH] Install in /var/www/$app like any other app .. --- manifest.toml | 1 - scripts/install | 34 ++++++++++++++++------------------ scripts/restore | 28 ++++++++++++---------------- scripts/upgrade | 4 ++-- 4 files changed, 30 insertions(+), 37 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2370d06..907f1e2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -55,7 +55,6 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] - dir = "/opt/__APP__" [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index f53a148..e828f10 100644 --- a/scripts/install +++ b/scripts/install @@ -18,6 +18,22 @@ ynh_script_progression --message="Setting up source files..." --weight=11 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 #================================================= @@ -28,24 +44,6 @@ 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" -#================================================= -# SPECIFIC SETUP -#================================================= -# EXECUTE NETDATA INSTALLER -#================================================= -ynh_script_progression --message="Executing Netdata installer..." --weight=10 - -# create a temporary file for the log -tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log) - -# Launch netdata installation in /opt directory -pushd $NETDATA_TMPDIR - ./netdata-installer.sh --install-prefix /opt --dont-wait --disable-cloud --disable-telemetry --stable-channel >$tmplog 2>$tmplog || ynh_die "FAILED TO COMPILE/INSTALL NETDATA" -popd - -# Specific configuration -configure_netdata - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/restore b/scripts/restore index 0107139..041ebc6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,13 +19,6 @@ ynh_script_progression --message="Restoring Netdata configuration directory..." ynh_restore_file --origin_path="$install_dir/etc/netdata" -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # INSTALL AND RESTORE THE APP CONFIGURATION #================================================= @@ -36,20 +29,23 @@ NETDATA_TMPDIR=$(mktemp -d) ynh_setup_source --dest_dir="$NETDATA_TMPDIR" # create a temporary file for the log -tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log) -# open fd 3 and send it to tmp -exec 3>${tmp} +tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log) -# Launch netdata installation in /opt directory -cd $NETDATA_TMPDIR -./netdata-installer.sh --install-prefix /opt --dont-wait --disable-cloud --disable-telemetry --stable-channel >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA" - -# close fd 3 -exec 3<&- +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 +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7166d6a..743ccef 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,9 +43,9 @@ then # create a temporary file for the log tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log) - # Launch netdata installation in /opt directory pushd $NETDATA_TMPDIR - ./netdata-installer.sh --install-prefix /opt --dont-wait --disable-cloud >$tmplog 2>$tmplog || ynh_die "FAILED TO COMPILE/INSTALL NETDATA" + # 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