From 3e969b6b9ef7ec6679adb19fca8ca0cd28467add Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Tue, 23 May 2023 12:38:16 +0200 Subject: [PATCH] feat: add monitoring --- .env.sample | 7 +++++ abra.sh | 1 + compose.monitoring.yml | 26 ++++++++++++++++ icons/monitoring.svg | 70 ++++++++++++++++++++++++++++++++++++++++++ monitoring.yaml.tmpl | 43 ++++++++++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 compose.monitoring.yml create mode 100644 icons/monitoring.svg create mode 100644 monitoring.yaml.tmpl diff --git a/.env.sample b/.env.sample index 76d6707..bf175c1 100644 --- a/.env.sample +++ b/.env.sample @@ -72,6 +72,13 @@ COPY_ASSETS="$COPY_ASSETS icon.png|app:/web/dist/assets/icons/" # SECRET_VIKUNJA_SECRET_VERSION=v1 # APP_ICONS="$APP_ICONS vikunja:~/.abra/recipes/authentik/icons/vikunja.svg" +# COMPOSE_FILE="$COMPOSE_FILE:compose.monitoring.yml" +# MONITORING_DOMAIN=monitoring.example.com +# SECRET_MONITORING_ID_VERSION=v1 +# SECRET_MONITORING_SECRET_VERSION=v1 +# APP_ICONS="$APP_ICONS monitoring:~/.abra/recipes/authentik/icons/monitoring.png" + # APPLICATIONS='{"Calendar": "https://nextcloud.example.com/apps/calendar/", "Rallly":"https://rallly.example.cloud/"}' # APP_ICONS="$APP_ICONS Calendar:~/.abra/recipes/authentik/icons/calendar.svg" # APP_ICONS="$APP_ICONS Rallly:~/.abra/recipes/authentik/icons/rallly.png" + diff --git a/abra.sh b/abra.sh index 4c74c45..c9140e7 100644 --- a/abra.sh +++ b/abra.sh @@ -10,6 +10,7 @@ export WORDPRESS_CONFIG_VERSION=v1 export MATRIX_CONFIG_VERSION=v1 export WEKAN_CONFIG_VERSION=v3 export VIKUNJA_CONFIG_VERSION=v1 +export MONITORING_CONFIG_VERSION=v1 customize() { if [ -z "$1" ] diff --git a/compose.monitoring.yml b/compose.monitoring.yml new file mode 100644 index 0000000..b39990b --- /dev/null +++ b/compose.monitoring.yml @@ -0,0 +1,26 @@ +version: "3.8" +services: + worker: + secrets: + - monitoring_id + - monitoring_secret + environment: + - MONITORING_DOMAIN + configs: + - source: monitoring + target: /blueprints/monitoring.yaml + +secrets: + monitoring_id: + external: true + name: ${STACK_NAME}_monitoring_id_${SECRET_MONITORING_ID_VERSION} + monitoring_secret: + external: true + name: ${STACK_NAME}_monitoring_secret_${SECRET_MONITORING_SECRET_VERSION} + + +configs: + monitoring: + name: ${STACK_NAME}_monitoring_${MATRIX_CONFIG_VERSION} + file: monitoring.yaml.tmpl + template_driver: golang diff --git a/icons/monitoring.svg b/icons/monitoring.svg new file mode 100644 index 0000000..54be1e2 --- /dev/null +++ b/icons/monitoring.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + diff --git a/monitoring.yaml.tmpl b/monitoring.yaml.tmpl new file mode 100644 index 0000000..ff42697 --- /dev/null +++ b/monitoring.yaml.tmpl @@ -0,0 +1,43 @@ +version: 1 +metadata: + labels: + blueprints.goauthentik.io/instantiate: "true" + name: monitoring + +entries: + +- attrs: + access_code_validity: minutes=1 + authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]] + client_id: {{ secret "monitoring_id" }} + client_secret: {{ secret "monitoring_secret" }} + client_type: confidential + include_claims_in_id_token: true + issuer_mode: per_provider + name: Matrix + property_mappings: + - !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]] + - !Find [authentik_providers_oauth2.scopemapping, [scope_name, email]] + - !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]] + signing_key: !Find [authentik_crypto.certificatekeypair, [name, authentik Self-signed Certificate]] + sub_mode: user_username + token_validity: days=30 + conditions: [] + id: monitoring_provider + identifiers: + pk: 9994 + model: authentik_providers_oauth2.oauth2provider + state: present + +- attrs: + meta_launch_url: https://{{ env "MONITORING_DOMAIN" }} + open_in_new_tab: true + policy_engine_mode: any + provider: !KeyOf monitoring_provider + slug: monitoring + conditions: [] + id: monitoring_application + identifiers: + name: Monitoring + model: authentik_core.application + state: present