From 11fffe061009c8b60be5daec1468112802496d63 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 3 Sep 2021 17:19:41 +0200 Subject: [PATCH] new: [etherpad] new charm Signed-off-by: Valentin Lab --- etherpad/README.org | 25 ++++++++++++++ .../hooks/postgres_database-relation-joined | 26 ++++++++++++++ etherpad/metadata.yml | 34 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 etherpad/README.org create mode 100755 etherpad/hooks/postgres_database-relation-joined create mode 100644 etherpad/metadata.yml diff --git a/etherpad/README.org b/etherpad/README.org new file mode 100644 index 0000000..9689cdc --- /dev/null +++ b/etherpad/README.org @@ -0,0 +1,25 @@ +# -*- ispell-local-dictionary: "english" -*- + +#+TITLE: Etherpad Charm + +* Upgrade + +Based on https://github.com/ether/etherpad-lite , following: + +https://github.com/ether/etherpad-lite/blob/develop/doc/docker.md + +Used: + +#+begin_src sh +TAG=1.8.14 +git clone https://github.com/ether/etherpad-lite --depth 1 -b $TAG +docker build --build-arg INSTALL_SOFFICE=1 . -t docker.0k.io/etherpad:${TAG}-soffice +docker push docker.0k.io/etherpad:${TAG}-soffice +#+end_src + +* Admin password + +We choose to NOT include admin panel as it allows to change settings +and install plugins but this will not allow to reproduce an install +easily. We can do this on the =compose.yml= side in a reproducible +manner. \ No newline at end of file diff --git a/etherpad/hooks/postgres_database-relation-joined b/etherpad/hooks/postgres_database-relation-joined new file mode 100755 index 0000000..9d725c9 --- /dev/null +++ b/etherpad/hooks/postgres_database-relation-joined @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +PASSWORD="$(relation-get password)" +USER="$(relation-get user)" +DBNAME="$(relation-get dbname)" + +control=$(echo -en "$USER\0$DBNAME\0$PASSWORD\0$ADMIN_PASSWORD" | md5_compat) + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + DB_TYPE: postgres + DB_HOST: \"$MASTER_TARGET_SERVICE_NAME\" + DB_NAME: \"$DBNAME\" + DB_PASS: \"$PASSWORD\" + DB_USER: \"$USER\" +" + +[ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0 + +relation-set control "$control" + +info "Configured $SERVICE_NAME code for $TARGET_SERVICE_NAME access." diff --git a/etherpad/metadata.yml b/etherpad/metadata.yml new file mode 100644 index 0000000..0963add --- /dev/null +++ b/etherpad/metadata.yml @@ -0,0 +1,34 @@ +name: etherpad +summary: "Etherpad-lite server" +maintainer: "Valentin Lab " +inherit: base-0k +## Custom built from git 1.8.14 https://github.com/ether/etherpad-lite with +## build arg --build-arg INSTALL_SOFFICE=1 +docker-image: docker.0k.io/etherpad:1.8.14-soffice ## custom built from git m etherpad/etherpad +description: | + Etherpad-lite service. + +docker-compose: + environment: + SOFFICE: '/usr/bin/soffice' + +uses: + postgres-database: + #constraint: required | recommended | optional + #auto: pair | summon | none ## default: pair + constraint: required + auto: summon + solves: + database: "main storage" + default-options: + extensions: + - unaccent + web-proxy: + #constraint: required | recommended | optional + #auto: pair | summon | none ## default: pair + constraint: recommended + auto: pair + solves: + proxy: "Public access" + default-options: + target: !var-expand ${MASTER_BASE_SERVICE_NAME}:9001