From cb64af866832d3e290e03df052e2acd8ff74e622 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 26 Aug 2024 02:23:42 +0200 Subject: [PATCH] add settings for Prometheus metrics (#156) Co-authored-by: yunohost-bot --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_id.md | 2 +- README_ru.md | 2 +- README_zh_Hans.md | 2 +- conf/config.yaml | 8 ++++---- config_panel.toml | 38 ++++++++++++++++++++++++++++++++++++++ manifest.toml | 2 +- scripts/install | 10 ++++++++++ scripts/upgrade | 35 +++++++++++++++++++++++++---------- 13 files changed, 86 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index f9005d9..05ecfb2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**Shipped version:** 0.16.0~ynh1 +**Shipped version:** 0.16.0~ynh2 ## Screenshots diff --git a/README_es.md b/README_es.md index d4b4d8d..ccd4765 100644 --- a/README_es.md +++ b/README_es.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**Versión actual:** 0.16.0~ynh1 +**Versión actual:** 0.16.0~ynh2 ## Capturas diff --git a/README_eu.md b/README_eu.md index 4091c67..0e9217c 100644 --- a/README_eu.md +++ b/README_eu.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**Paketatutako bertsioa:** 0.16.0~ynh1 +**Paketatutako bertsioa:** 0.16.0~ynh2 ## Pantaila-argazkiak diff --git a/README_fr.md b/README_fr.md index d7af524..7a343e5 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,7 +27,7 @@ Les admins sont **vivement encouragé-e-s à lire la documentation** de ce paque Veuillez noter que ce paquet utilise la ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), veuillez la lire et l'accepter avant de procéder à l'installation. -**Version incluse :** 0.16.0~ynh1 +**Version incluse :** 0.16.0~ynh2 ## Captures d’écran diff --git a/README_gl.md b/README_gl.md index 68a7a1d..2e24a98 100644 --- a/README_gl.md +++ b/README_gl.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**Versión proporcionada:** 0.16.0~ynh1 +**Versión proporcionada:** 0.16.0~ynh2 ## Capturas de pantalla diff --git a/README_id.md b/README_id.md index 22b88d6..7ced292 100644 --- a/README_id.md +++ b/README_id.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**Versi terkirim:** 0.16.0~ynh1 +**Versi terkirim:** 0.16.0~ynh2 ## Tangkapan Layar diff --git a/README_ru.md b/README_ru.md index 19198b6..01709fa 100644 --- a/README_ru.md +++ b/README_ru.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**Поставляемая версия:** 0.16.0~ynh1 +**Поставляемая версия:** 0.16.0~ynh2 ## Снимки экрана diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 2968bf5..4ae4090 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -27,7 +27,7 @@ Admins are **strongly encouraged to read the documentation** of this package aft Please note that this package uses the ["i'm so tired" software license 1.0](https://github.com/YunoHost-Apps/gotosocial_ynh/blob/master/LICENSE), please read it and accept it before proceeding with installation. -**分发版本:** 0.16.0~ynh1 +**分发版本:** 0.16.0~ynh2 ## 截图 diff --git a/conf/config.yaml b/conf/config.yaml index aabc557..6d46770 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -862,19 +862,19 @@ tracing-insecure-transport: false # Bool. Enable OpenTelemetry based metrics support. # Default: false -metrics-enabled: false +metrics-enabled: __METRICS_ENABLED__ # Bool. Enable HTTP Basic Authentication for Prometheus metrics endpoint. # Default: false -metrics-auth-enabled: false +metrics-auth-enabled: __METRICS_AUTH_ENABLED__ # String. Username for Prometheus metrics endpoint. # Default: "" -metrics-auth-username: "" +metrics-auth-username: __METRICS_AUTH_USERNAME__ # String. Password for Prometheus metrics endpoint. # Default: "" -metrics-auth-password: "" +metrics-auth-password: __METRICS_AUTH_PASSWORD__ ################################ ##### HTTP CLIENT SETTINGS ##### diff --git a/config_panel.toml b/config_panel.toml index 40fa7bb..f83f6b3 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -475,6 +475,44 @@ help = "Settings pertaining to... OpenID Connect" help.fr = "Lier les utilisateurs authentifiés par OIDC aux utilisateurs existants sur la base de leur adresse email. Ceci est principalement destiné à des fins de migration si vous utilisiez des versions antérieures de GTS qui ne corrélaient les utilisateurs qu'avec leur adresse email. Dans la plupart des cas, cette valeur doit être fixée à false." type = "select" + #################### + #### OBSERVABILITY SETTINGS + #################### + +[main.observability] + +name = "Metrics settings" + +help = "Settings pertaining to OpenTelemetry based metrics support." + + [main.observability.metrics_enabled] + ask.en = "Enable OpenTelemetry based metrics support?" + ask.fr = "Activer les métriques basées sur OpenTelemetry ?" + bind = "metrics-enabled:__INSTALL_DIR__/config.yaml" + choices = [ "true", "false" ] + default = "false" + type = "select" + + [main.observability.metrics_auth_enabled] + ask.en = "Enable HTTP Basic Authentication for Prometheus metrics endpoint?" + ask.fr = "Activer l'authentification basique HTTP pour le point de terminaison des métriques Prometheus ?" + bind = "metrics-auth-enabled:__INSTALL_DIR__/config.yaml" + choices = [ "true", "false" ] + default = "false" + type = "select" + + [main.observability.metrics_auth_username] + ask.en = "Username for Prometheus metrics endpoint." + ask.fr = "Identifiant pour le point de terminaison des métriques Prometheus." + bind = "metrics-auth-username:__INSTALL_DIR__/config.yaml" + type = "string" + + [main.observability.metrics_auth_password] + ask.en = "Password for Prometheus metrics endpoint." + ask.fr = "Mot de passe pour le point de terminaison des métriques Prometheus." + bind = "metrics-auth-password:__INSTALL_DIR__/config.yaml" + type = "password" + #################### #### ADVANCED SETTINGS #################### diff --git a/manifest.toml b/manifest.toml index 1ff5728..3a14582 100644 --- a/manifest.toml +++ b/manifest.toml @@ -9,7 +9,7 @@ description.gl = "Un servidor áxil para a rede social ActivityPub" description.ca = "Un servidor de xarxa social basat en ActivityPub" description.fr = "Serveur de réseau social véloce basé sur ActivityPub" -version = "0.16.0~ynh1" +version = "0.16.0~ynh2" maintainers = [ "OniriCorpe" ] diff --git a/scripts/install b/scripts/install index 778b7c9..60ca806 100755 --- a/scripts/install +++ b/scripts/install @@ -72,6 +72,11 @@ smtp_password="$mail_pwd" smtp_from="$app@$domain" smtp_disclose_recipients="false" +metrics_enabled="false" +metrics_auth_enabled="false" +metrics_auth_username="" +metrics_auth_password="" + advanced_cookies_samesite="lax" advanced_rate_limit_requests="300" @@ -143,6 +148,11 @@ ynh_app_setting_set --app="$app" --key=smtp_password --value="$smtp_password" ynh_app_setting_set --app="$app" --key=smtp_from --value="$smtp_from" ynh_app_setting_set --app="$app" --key=smtp_disclose_recipients --value="$smtp_disclose_recipients" +ynh_app_setting_set --app="$app" --key=metrics_enabled --value="$metrics_enabled" +ynh_app_setting_set --app="$app" --key=metrics_auth_enabled --value="$metrics_auth_enabled" +ynh_app_setting_set --app="$app" --key=metrics_auth_username --value="$metrics_auth_username" +ynh_app_setting_set --app="$app" --key=metrics_auth_password --value="$metrics_auth_password" + ynh_app_setting_set --app="$app" --key=advanced_cookies_samesite --value="$advanced_cookies_samesite" ynh_app_setting_set --app="$app" --key=advanced_rate_limit_requests --value="$advanced_rate_limit_requests" diff --git a/scripts/upgrade b/scripts/upgrade index 532f64d..815d804 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -153,7 +153,7 @@ if ynh_compare_current_package_version --comparison lt --version 0.7.1~ynh1 || [ then # updating parameters advanced_rate_limit_requests="300" - # declaration of new parameter + # declaration of new parameters instance_expose_suspended_web="false" # registration of parameters ynh_app_setting_set --app="$app" --key=advanced_rate_limit_requests --value="$advanced_rate_limit_requests" @@ -163,7 +163,7 @@ fi # Upgrade from <0.8.0~ynh2: (also upgrade from packaging v1) if ynh_compare_current_package_version --comparison lt --version 0.8.0~ynh2 || [ -z "${smtp_host:-}" ] || [ -z "${smtp_username:-}" ] then - # declaration of new parameter + # declaration of new parameters smtp_host="127.0.0.1" smtp_port="25" smtp_username="$app" @@ -213,16 +213,16 @@ fi # Upgrade from <0.10.0~ynh1: if ynh_compare_current_package_version --comparison lt --version 0.10.0~ynh1 || [ -z "${accounts_custom_css_length:-}" ] then - # declaration of new parameter + # declaration of new parameters accounts_custom_css_length="10000" - # registration of parameter + # registration of parameters ynh_app_setting_set --app="$app" --key=accounts_custom_css_length --value="$accounts_custom_css_length" fi # Upgrade from <0.11.0~ynh1: if ynh_compare_current_package_version --comparison lt --version 0.11.0~ynh1 || [ -z "$cache_memory_target" ] then - # declaration of new parameter + # declaration of new parameters cache_memory_target="100MiB" instance_inject_mastodon_version="false" # update default config @@ -232,7 +232,7 @@ then media_remote_cache_days="7" ynh_app_setting_set --app="$app" --key=media_remote_cache_days --value="$media_remote_cache_days" fi - # registration of parameter + # registration of parameters ynh_app_setting_set --app="$app" --key=cache_memory_target --value="$cache_memory_target" ynh_app_setting_set --app="$app" --key=instance_inject_mastodon_version --value="$instance_inject_mastodon_version" fi @@ -240,16 +240,16 @@ fi # Upgrade from <0.12.0~ynh1: if ynh_compare_current_package_version --comparison lt --version 0.12.0~ynh1 || [ -z "${instance_federation_mode:-}" ] then - # declaration of new parameter + # declaration of new parameters instance_federation_mode="blocklist" - # registration of parameter + # registration of parameters ynh_app_setting_set --app="$app" --key=instance_federation_mode --value="$instance_federation_mode" fi # Upgrade from <0.12.1~ynh2: if ynh_compare_current_package_version --comparison lt --version 0.12.1~ynh2 || [ -z "${oidc_enabled:-}" ] then - # declaration of new parameter + # declaration of new parameters oidc_enabled="false" oidc_idp_name="" oidc_skip_verification="false" @@ -257,7 +257,7 @@ then oidc_client_id="" oidc_client_secret="" oidc_link_existing="false" - # registration of parameter + # registration of parameters ynh_app_setting_set --app="$app" --key=oidc_enabled --value="$oidc_enabled" ynh_app_setting_set --app="$app" --key=oidc_idp_name --value="$oidc_idp_name" ynh_app_setting_set --app="$app" --key=oidc_skip_verification --value="$oidc_skip_verification" @@ -287,6 +287,21 @@ then ynh_app_setting_delete --app="$app" --key=accounts_approval_required fi +# Upgrade from <0.16.0~ynh2: +if ynh_compare_current_package_version --comparison lt --version 0.16.0~ynh1 || [ -z "${metrics_enabled:-}" ] +then + # declaration of new parameters + metrics_enabled="false" + metrics_auth_enabled="false" + metrics_auth_username="" + metrics_auth_password="" + # registration of parameters + ynh_app_setting_set --app="$app" --key=metrics_enabled --value="$metrics_enabled" + ynh_app_setting_set --app="$app" --key=metrics_auth_enabled --value="$metrics_auth_enabled" + ynh_app_setting_set --app="$app" --key=metrics_auth_username --value="$metrics_auth_username" + ynh_app_setting_set --app="$app" --key=metrics_auth_password --value="$metrics_auth_password" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================