From 4adb59d822edd0f836e5c2da4ac98ed028aca8f0 Mon Sep 17 00:00:00 2001 From: Boris Gallet Date: Tue, 12 Nov 2024 16:04:30 +0100 Subject: [PATCH] chg: [mattermost] update image to ``5.30.1`` --- mattermost/hooks/init | 2 +- .../hooks/postgres_database-relation-joined | 17 ++++++----------- mattermost/hooks/web_proxy-relation-joined | 12 ++++++++++++ mattermost/metadata.yml | 9 ++++----- 4 files changed, 23 insertions(+), 17 deletions(-) create mode 100755 mattermost/hooks/web_proxy-relation-joined diff --git a/mattermost/hooks/init b/mattermost/hooks/init index 216ceaa..1c0a8af 100755 --- a/mattermost/hooks/init +++ b/mattermost/hooks/init @@ -15,7 +15,7 @@ ## checking permission of base directory ## -dirs=("$SERVICE_CONFIGSTORE/mattermost/"{config,plugins} "$SERVICE_DATASTORE/mattermost/"{data,logs}) +dirs=("$SERVICE_DATASTORE/mattermost/"{data,logs,config,plugins}) for dir in "${dirs[@]}"; do mkdir -p "$dir" find "$dir" \! -uid 2000 -print0 | while read-0 f; do diff --git a/mattermost/hooks/postgres_database-relation-joined b/mattermost/hooks/postgres_database-relation-joined index de1b7d3..b604a4d 100755 --- a/mattermost/hooks/postgres_database-relation-joined +++ b/mattermost/hooks/postgres_database-relation-joined @@ -10,21 +10,16 @@ PORT="$(relation-get port)" control=$(p0 "$USER" "$DBNAME" "$PASSWORD" "$HOST" "$PORT" | md5_compat) + +## Used doc from https://github.com/mattermost/docker/blob/main/env.example config-add "\ services: $MASTER_BASE_SERVICE_NAME: environment: - DB_HOST: $HOST - DB_PORT_NUMBER: $PORT - MM_DBNAME: $DBNAME - MM_PASSWORD: $PASSWORD - MM_USERNAME: $USER -" - -if [ -e "$SERVICE_CONFIGSTORE/mattermost/config/config.json" ]; then - sed -ri 's/(^\s+"DataSource": "postgres:[^:]+:)([^@]+)@/\1'"$PASSWORD"'@/' \ - "$SERVICE_CONFIGSTORE/mattermost/config/config.json" || exit 1 -fi + MM_SQLSETTINGS_DRIVERNAME: postgres + MM_SQLSETTINGS_DATASOURCE: \"postgres://${USER}:${PASSWORD}@${HOST}:${PORT}/${DBNAME}?sslmode=disable&connect_timeout=10\" +" || exit 17 + [ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0 diff --git a/mattermost/hooks/web_proxy-relation-joined b/mattermost/hooks/web_proxy-relation-joined new file mode 100755 index 0000000..7ab7770 --- /dev/null +++ b/mattermost/hooks/web_proxy-relation-joined @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +URL="$(relation-get url)" || exit 1 + +config-add "\ +services: + $MASTER_BASE_SERVICE_NAME: + environment: + MM_SERVICESETTINGS_SITEURL=${URL} +" diff --git a/mattermost/metadata.yml b/mattermost/metadata.yml index c0d0f47..419b362 100644 --- a/mattermost/metadata.yml +++ b/mattermost/metadata.yml @@ -1,14 +1,13 @@ description: "Mattermost" maintainer: "Valentin Lab " ## We fix image here to be sure of what we install -docker-image: docker.0k.io/mattermost-team:5.15.0 +docker-image: docker.0k.io/mattermost-team:5.30.1 # docker-image: docker.0k.io/mattermost-enterprise -config-resources: - - /mattermost/config - - /mattermost/plugins data-resources: - /mattermost/data - /mattermost/logs + - /mattermost/config + - /mattermost/plugins host-resources: - /etc/localtime:ro @@ -38,4 +37,4 @@ uses: RewriteCond %{REQUEST_URI} /api/v[0-9]+/(users/)?websocket [NC,OR] RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR] RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC] - RewriteRule .* ws://${MASTER_BASE_SERVICE_NAME}:8000%{REQUEST_URI} [P,QSA,L] + RewriteRule .* ws://${MASTER_BASE_SERVICE_NAME}:8065%{REQUEST_URI} [P,QSA,L]