From ee905417dda391ec31789d0d5d6580bfd1483d27 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 6 Mar 2022 19:14:13 +0100 Subject: [PATCH 1/4] Apply last example_ynh --- check_process | 2 +- manifest.json | 8 ++++---- scripts/install | 2 +- scripts/remove | 5 ++++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/check_process b/check_process index 6fc1eed..009626c 100644 --- a/check_process +++ b/check_process @@ -3,8 +3,8 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=1 + admin="john" port="3000" ; Checks pkg_linter=1 diff --git a/manifest.json b/manifest.json index 94e1850..0a1db7b 100644 --- a/manifest.json +++ b/manifest.json @@ -38,14 +38,14 @@ "example": "/grafana", "default": "/grafana" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", "default": false + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/install b/scripts/install index 6be2207..7e06f80 100644 --- a/scripts/install +++ b/scripts/install @@ -25,8 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/remove b/scripts/remove index 96a02d0..821bf0d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -27,7 +27,7 @@ db_user=$db_name # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# 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 grafana-server >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=1 @@ -62,6 +62,9 @@ ynh_remove_app_dependencies #================================================= # SPECIFIC REMOVE #================================================= +# REMOVE VARIOUS FILES +#================================================= +ynh_script_progression --message="Removing various files..." # If NetData is installed, configure it not to feed InfluxDB any more netdata_conf="/opt/netdata/etc/netdata/netdata.conf" From d50ad8e6deecc2bb1531123811e6122b67075af7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 6 Mar 2022 19:14:26 +0100 Subject: [PATCH 2/4] fix backup/restore --- scripts/backup | 2 +- scripts/restore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index 7ff261f..f3b6604 100644 --- a/scripts/backup +++ b/scripts/backup @@ -74,7 +74,7 @@ fi ynh_backup --src_path="/etc/influxdb" ynh_backup --src_path="/etc/$app" -ynh_backup --src_path="/var/lib/grafana/plugins" +ynh_backup --src_path="/var/lib/grafana/plugins" --not_mandatory #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/restore b/scripts/restore index 5aebe16..2477044 100644 --- a/scripts/restore +++ b/scripts/restore @@ -76,7 +76,7 @@ ynh_script_progression --message="Restoring various files..." --weight=2 ynh_restore_file --origin_path="/etc/influxdb" ynh_restore_file --origin_path="/etc/grafana" -ynh_restore_file --origin_path="/var/lib/grafana/plugins" +ynh_restore_file --origin_path="/var/lib/grafana/plugins" --not_mandatory #================================================= # RESTORE THE INFLUXDB DATABASE From 3c22493cef41f4eff6f9a1ff07f7befa4612113c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 8 Mar 2022 00:22:57 +0100 Subject: [PATCH 3/4] Check upgrade from current version --- check_process | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check_process b/check_process index 009626c..aa03cb6 100644 --- a/check_process +++ b/check_process @@ -15,6 +15,8 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=893b873f00c2f9793369b7cd5d034b06605aaa8a + # 8.3.3~ynh1 + upgrade=1 from_commit=993c3b904f558057de4278c1833448fc124e8626 backup_restore=1 multi_instance=0 port_already_use=1 From 4fa92ee917dd20741348bf1f41780f500ad6cc68 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 8 Mar 2022 20:43:51 +0100 Subject: [PATCH 4/4] Workaround for missing "/var/lib/grafana/plugins" --- scripts/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index d75e109..a6bda64 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,6 +36,10 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 +# Workaround for missing "/var/lib/grafana/plugins" +mkdir -p "/var/lib/grafana/plugins" +chown -R $app:$app "/var/lib/grafana/plugins" + # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () {