From 811c3b01a0d7664c064bfb9cb5319aed818c91c7 Mon Sep 17 00:00:00 2001 From: Eric Meehan Date: Mon, 23 Dec 2024 20:07:54 -0500 Subject: [PATCH] Added Webhookd to Grafana --- files/nextcloud-talk-gitea-webhook.sh | 10 ++++++++++ ...oud-talk.sh => nextcloud-talk-grafana-webhook.sh} | 0 tasks/main.yaml | 2 +- tasks/nextcloud.yaml | 10 +++++++++- tasks/webhookd.yaml | 12 ++++++++---- 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 files/nextcloud-talk-gitea-webhook.sh rename files/{message-nextcloud-talk.sh => nextcloud-talk-grafana-webhook.sh} (100%) diff --git a/files/nextcloud-talk-gitea-webhook.sh b/files/nextcloud-talk-gitea-webhook.sh new file mode 100644 index 0000000..e16d6da --- /dev/null +++ b/files/nextcloud-talk-gitea-webhook.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +message="$(echo $1| sed 's/.*"message":"\(.*\).."}/\1/')" + +curl -X POST \ + -H "Content-Type: application/json" \ + -H "OCS-APIRequest: true" \ + https://nextcloud.eom.dev/ocs/v2.php/apps/spreed/api/v1/chat/x3wy62mb \ + -u Gitea:$GITEA_ADMIN_PASSWORD \ + -d "{\"token\": \"x3wy62mb\", \"message\": \"$message\"}" diff --git a/files/message-nextcloud-talk.sh b/files/nextcloud-talk-grafana-webhook.sh similarity index 100% rename from files/message-nextcloud-talk.sh rename to files/nextcloud-talk-grafana-webhook.sh diff --git a/tasks/main.yaml b/tasks/main.yaml index c74d9ac..92367fb 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -3,4 +3,4 @@ - name: Deploy include_tasks: "{{ item }}" loop: - - webhookd.yaml + - nextcloud.yaml diff --git a/tasks/nextcloud.yaml b/tasks/nextcloud.yaml index bc9c3ca..bd95824 100644 --- a/tasks/nextcloud.yaml +++ b/tasks/nextcloud.yaml @@ -17,6 +17,9 @@ release_namespace: nextcloud create_namespace: true values: + image: + pullPolicy: Always + tag: latest nextcloud: host: nextcloud.eom.dev username: nextcloud_admin @@ -25,6 +28,7 @@ proxy.config.php: |- 'https', 'trusted_proxies' => array( 0 => '127.0.0.1', 1 => '10.0.0.0/8', @@ -53,11 +57,15 @@ database: nextcloud persistence: enabled: true - size: 4Ti + size: 8Ti metrics: enabled: true cronjob: enabled: true + redis: + enabled: true + auth: + password: "{{ redis_auth_password }}" ingress: enabled: true className: nginx diff --git a/tasks/webhookd.yaml b/tasks/webhookd.yaml index e72c986..2ed56d0 100644 --- a/tasks/webhookd.yaml +++ b/tasks/webhookd.yaml @@ -7,9 +7,11 @@ kind: ConfigMap metadata: name: scripts - namespace: grafana + namespace: webhookd data: - message-nextcloud-talk.sh: "{{ lookup('file', 'message-nextcloud-talk.sh') }}" + nextcloud-talk-gitea-webhook.sh: "{{ lookup('file', 'nextcloud-talk-gitea-webhook.sh') }}" + nextcloud-talk-grafana-webhook.sh: "{{ lookup('file', 'nextcloud-talk-grafana-webhook.sh') }}" + nextcloud-talk-minecraft-webhook.sh: "{{ lookup('file', 'nextcloud-talk-minecraft-webhook.sh') }}" - name: Create a Deployment for Webhookd k8s: @@ -18,7 +20,7 @@ kind: Deployment metadata: name: webhookd - namespace: grafana + namespace: webhookd spec: replicas: 1 selector: @@ -38,6 +40,8 @@ ports: - containerPort: 8080 env: + - name: GITEA_ADMIN_PASSWORD + value: "{{ gitea_admin_password }}" - name: GRAFANA_ADMIN_PASSWORD value: "{{ grafana_admin_password }}" volumes: @@ -53,7 +57,7 @@ kind: Service metadata: name: webhookd - namespace: grafana + namespace: webhookd spec: selector: app: webhookd