1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00
This commit is contained in:
Éric Gaspar 2023-12-28 09:31:32 +01:00
parent 43fdb78d4e
commit 3633e2d0ef
10 changed files with 190 additions and 134 deletions

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/netdata/netdata/releases/download/v1.44.1/netdata-v1.44.1.tar.gz
SOURCE_SUM=77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://raw.githubusercontent.com/netdata/netdata/v1.15.0/packaging/installer/netdata-uninstaller.sh
SOURCE_SUM=a4727069b47138cea5c466bc902934545841c88dc5f641728ef0feb921efd218
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=sh
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=netdata-uninstaller.sh
SOURCE_EXTRACT=false

67
manifest.toml Normal file
View file

@ -0,0 +1,67 @@
packaging_format = 2
id = "netdata"
name = "NetData"
description.en = "Real-time performance and health monitoring"
description.fr = "Monitoring serveur en temps reel"
version = "1.44.1~ynh1"
maintainers = ["JimboJoe"]
[upstream]
license = "GPL-3.0"
website = "http://my-netdata.io"
demo = "https://learn.netdata.cloud/docs/agent/demo-sites/"
admindoc = "https://learn.netdata.cloud/docs"
code = "https://github.com/netdata/netdata"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 11.2"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/netdata"
[install.init_main_permission]
type = "group"
default = false
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[resources]
[resources.sources]
[resources.sources.main]
url = "https://github.com/netdata/netdata/releases/download/v1.44.1/netdata-v1.44.1.tar.gz"
sha256 = "77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95"
[resources.sources.uninstaller]
url = "https://raw.githubusercontent.com/netdata/netdata/v1.15.0/packaging/installer/netdata-uninstaller.sh"
sha256 = "a4727069b47138cea5c466bc902934545841c88dc5f641728ef0feb921efd218"
format = "sh"
rename = "netdata-uninstaller.sh"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl jq nodejs python3-mysqldb libipmimonitoring-dev acl python3-pymongo libuv1-dev liblz4-dev libjudy-dev libssl-dev cmake"
#REMOVEME? pkg_dependencies="zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl jq nodejs python3-mysqldb libipmimonitoring-dev acl python3-pymongo libuv1-dev liblz4-dev libjudy-dev libssl-dev cmake"
#=================================================
# PERSONAL HELPERS
@ -17,12 +17,12 @@ configure_netdata() {
# Set server as registry serveur
sed -i "/^\[registry\]$/,/^\[/ {
s/# enabled = no/enabled = yes/
s@# registry to announce = https://registry.my-netdata.io@registry to announce = https://$domain$path_url@
}" $final_path/etc/netdata/netdata.conf
s@# registry to announce = https://registry.my-netdata.io@registry to announce = https://$domain$path@
}" $install_dir/etc/netdata/netdata.conf
# Opt-out from sending anonymous statistics
# (see https://docs.netdata.cloud/docs/anonymous-statistics/#opt-out)
touch $final_path/etc/netdata/.opt-out-from-anonymous-statistics
touch $install_dir/etc/netdata/.opt-out-from-anonymous-statistics
# Add a web_log entry for every YunoHost domain
netdata_add_yunohost_web_logs
@ -57,9 +57,9 @@ configure_netdata() {
# Add a web_log entry for every YunoHost domain
netdata_add_yunohost_web_logs () {
local web_log_file="$final_path/etc/netdata/go.d/web_log.conf"
local web_log_file="$install_dir/etc/netdata/go.d/web_log.conf"
if [ ! -f $web_log_file ] ; then
cp $final_path/etc/netdata/orig/go.d/web_log.conf $web_log_file
cp $install_dir/etc/netdata/orig/go.d/web_log.conf $web_log_file
fi
if [ -z "$(grep "YUNOHOST" $web_log_file)" ] ; then
echo "# ------------YUNOHOST DOMAINS---------------" >> $web_log_file
@ -77,16 +77,16 @@ EOF
fi
chgrp netdata $web_log_file
# Manage upgrade case from python to go plugin
if [ -f "$final_path/etc/netdata/python.d/web_log.conf" ] ; then
ynh_secure_remove --file="$final_path/etc/netdata/python.d/web_log.conf"
if [ -f "$install_dir/etc/netdata/python.d/web_log.conf" ] ; then
#REMOVEME? ynh_secure_remove --file="$install_dir/etc/netdata/python.d/web_log.conf"
fi
}
# If PostgreSQL is installed, add a PostgreSQL entry using instance password
netdata_add_yunohost_postgres_configuration () {
local postgres_file="$final_path/etc/netdata/go.d/postgres.conf"
local postgres_file="$install_dir/etc/netdata/go.d/postgres.conf"
if [ ! -f $postgres_file ] ; then
cp $final_path/etc/netdata/orig/go.d/postgres.conf $postgres_file
cp $install_dir/etc/netdata/orig/go.d/postgres.conf $postgres_file
fi
if [ -f /etc/yunohost/psql ] && [ -z "$(grep "YUNOHOST" $postgres_file)" ] ; then
cat >> $postgres_file <<EOF
@ -97,7 +97,7 @@ EOF
fi
chgrp netdata $postgres_file
# Manage upgrade case from python to go plugin
if [ -f "$final_path/etc/netdata/python.d/postgres.conf" ] ; then
ynh_secure_remove --file="$final_path/etc/netdata/python.d/postgres.conf"
if [ -f "$install_dir/etc/netdata/python.d/postgres.conf" ] ; then
#REMOVEME? ynh_secure_remove --file="$install_dir/etc/netdata/python.d/postgres.conf"
fi
}

View file

@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
#REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -39,7 +39,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path/etc/netdata"
ynh_backup --src_path="$install_dir/etc/netdata"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -13,52 +13,52 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
#REMOVEME? change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
#REMOVEME? change_path=0
#REMOVEME? if [ "$old_path" != "$new_path" ]
then
change_path=1
#REMOVEME? change_path=1
fi
#=================================================
@ -75,28 +75,30 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
ynh_change_url_nginx_config
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
#REMOVEME? domain="$old_domain"
#REMOVEME? path="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
#REMOVEME? ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
@ -115,14 +117,14 @@ 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="$final_path/var/log/$app/error.log"
ynh_systemd_action --service_name=$app --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT

View file

@ -13,41 +13,41 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/$app
#REMOVEME? install_dir=/opt/$app
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
@ -56,16 +56,16 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=32
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=32
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=11
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
@ -108,7 +108,7 @@ configure_netdata
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --log "$final_path/var/log/netdata/error.log" "$final_path/var/log/netdata/access.log" "$final_path/var/log/netdata/debug.log"
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --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
@ -116,30 +116,30 @@ 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="$final_path/var/log/$app/error.log"
ynh_systemd_action --service_name=$app --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
# Add direct access in the portal to admin only
ynh_permission_update --permission="main" --remove="all_users" --add="$admin"
#REMOVEME? ynh_permission_update --permission="main" --remove="all_users" --add="$admin"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT

View file

@ -12,12 +12,12 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# STANDARD REMOVE
@ -43,10 +43,10 @@ ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=8
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=8
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# UNINSTALLING NETDATA
@ -68,7 +68,7 @@ pushd $tmpdir
exec 3>${tmp}
# Execute the uninstall script
./${UNINSTALL_SCRIPT} --yes --force --env $final_path/etc/netdata/.environment >&3 2>&3
./${UNINSTALL_SCRIPT} --yes --force --env $install_dir/etc/netdata/.environment >&3 2>&3
# close fd 3
exec 3<&-

View file

@ -14,27 +14,27 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#=================================================
# STANDARD RESTORATION STEPS
@ -43,17 +43,17 @@ ynh_script_progression --message="Validating restoration parameters..." --weight
#=================================================
ynh_script_progression --message="Restoring Netdata configuration directory..." --weight=1
ynh_restore_file --origin_path="$final_path/etc/netdata"
ynh_restore_file --origin_path="$install_dir/etc/netdata"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
@ -91,14 +91,14 @@ configure_netdata
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --log "$final_path/var/log/netdata/error.log" "$final_path/var/log/netdata/access.log" "$final_path/var/log/netdata/debug.log"
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --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="start" --log_path="$final_path/var/log/$app/error.log"
ynh_systemd_action --service_name=$app --action="start" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# GENERIC FINALIZATION

View file

@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# CHECK VERSION
@ -30,16 +30,16 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
@ -48,22 +48,22 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# If install_dir doesn't exist, create it
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/opt/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
# If final_path wrongly refers to /var/www
# If install_dir wrongly refers to /var/www
# see http://tldp.org/LDP/abs/html/comparison-ops.html for syntax reference
if [[ $final_path == /var/www* ]]; then
final_path=/opt/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
if [[ $install_dir == /var/www* ]]; then
#REMOVEME? install_dir=/opt/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
@ -121,9 +121,9 @@ ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=7
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=7
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# GENERIC FINALIZATION
@ -132,21 +132,21 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --log "$final_path/var/log/netdata/error.log" "$final_path/var/log/netdata/access.log" "$final_path/var/log/netdata/debug.log"
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --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="$final_path/var/log/$app/error.log"
ynh_systemd_action --service_name=$app --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT