From 91d601ad36bb725af826337c789a47c1521f2ff2 Mon Sep 17 00:00:00 2001 From: Boris Gallet Date: Mon, 20 Nov 2023 11:50:40 +0100 Subject: [PATCH] new: [rallly] new charm --- rallly/README.org | 33 +++++++++++++++++++ rallly/hooks/init | 21 ++++++++++++ .../hooks/postgres_database-relation-joined | 18 ++++++++++ rallly/hooks/smtp_server-relation-joined | 20 +++++++++++ rallly/hooks/web_proxy-relation-joined | 13 ++++++++ rallly/metadata.yml | 32 ++++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 rallly/README.org create mode 100755 rallly/hooks/init create mode 100755 rallly/hooks/postgres_database-relation-joined create mode 100755 rallly/hooks/smtp_server-relation-joined create mode 100755 rallly/hooks/web_proxy-relation-joined create mode 100644 rallly/metadata.yml diff --git a/rallly/README.org b/rallly/README.org new file mode 100644 index 0000000..7ba499a --- /dev/null +++ b/rallly/README.org @@ -0,0 +1,33 @@ +# -*- ispell-local-dictionary: "english" -*- + +* Info + +From: https://github.com/lukevella/rallly + +* Usage + +Config info : https://support.rallly.co/self-hosting/configuration-options + +Need a complete SMTP config to be functionnal + +#+begin_src yaml +rallly: + charm: rallly + docker-compose: + options: + secret: <> + support_email: # email used for support + # OPTIONAL + allowed_emails: "*@example.coop, test@example2.com" # All by default if not set + + +smtp-extern: + charm: smtp-extern + options: + host: + port: <465> + secure: "true" + user: + password: + +#+end_src \ No newline at end of file diff --git a/rallly/hooks/init b/rallly/hooks/init new file mode 100755 index 0000000..4208c1e --- /dev/null +++ b/rallly/hooks/init @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +secret=$(options-get secret) || exit 1 +support_email=$(options-get support_email) || exit 1 +allowed_emails=$(options-get allowed_emails) || true + +if [[ -z "$allowed_emails" ]]; then + allowed_emails=* +fi + +init-config-add "\ + $MASTER_BASE_SERVICE_NAME: + environment: + SECRET_PASSWORD: \"$secret\" + SUPPORT_EMAIL: \"$support_email\" + ALLOWED_EMAILS: \"$allowed_emails\" + NEXT_PUBLIC_BASE_URL: http://localhost:8082/ + +" diff --git a/rallly/hooks/postgres_database-relation-joined b/rallly/hooks/postgres_database-relation-joined new file mode 100755 index 0000000..d46bff4 --- /dev/null +++ b/rallly/hooks/postgres_database-relation-joined @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +PASSWORD="$(relation-get password)" +USER="$(relation-get user)" +DBNAME="$(relation-get dbname)" + + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + DATABASE_URL: \"postgres://$USER:$PASSWORD@$TARGET_SERVICE_NAME/$DBNAME\" +" + + +info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access." diff --git a/rallly/hooks/smtp_server-relation-joined b/rallly/hooks/smtp_server-relation-joined new file mode 100755 index 0000000..9ac799c --- /dev/null +++ b/rallly/hooks/smtp_server-relation-joined @@ -0,0 +1,20 @@ +#!/bin/bash + +host=$(relation-get host) || exit 1 +port=$(relation-get port) || exit 1 +secure=$(relation-get secure) || exit 1 +user=$(relation-get user) || exit 1 +password=$(relation-get password) || exit 1 + + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + SMTP_HOST: \"$host\" + SMTP_PORT: \"$port\" + SMTP_SECURE: \"${secure,,}\" + SMTP_USER: \"${user//\$/\$\$}\" + SMTP_PWD: \"${password//\$/\$\$}\" +" + diff --git a/rallly/hooks/web_proxy-relation-joined b/rallly/hooks/web_proxy-relation-joined new file mode 100755 index 0000000..f1dc38c --- /dev/null +++ b/rallly/hooks/web_proxy-relation-joined @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +DOMAIN=$(relation-get domain) || exit 1 + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + NEXT_PUBLIC_BASE_URL: https://$DOMAIN + +" \ No newline at end of file diff --git a/rallly/metadata.yml b/rallly/metadata.yml new file mode 100644 index 0000000..fb1db2f --- /dev/null +++ b/rallly/metadata.yml @@ -0,0 +1,32 @@ +docker-image: docker.0k.io/rallly:3.3.0 + +uses: + postgres-database: + #constraint: required | recommended | optional + #auto: pair | summon | none ## default: pair + constraint: required + auto: summon + solves: + database: "main storage" + default-options: + extensions: + - pgcrypto + - citext + web-proxy: + constraint: recommended + auto: pair + solves: + proxy: "Public access" + default-options: + target: !var-expand ${MASTER_BASE_SERVICE_NAME}:3000 + smtp-server: + constraint: required + auto: pair + solves: + proxy: "Public access" + backup: + constraint: recommended + auto: pair + solves: + backup: "Automatic regular backup" + default-options: