Compare commits

..

1 Commits

Author SHA1 Message Date
95aab820b1 chore: publish 1.2.3+9.5.9 release 2024-09-06 13:17:39 -07:00
10 changed files with 12 additions and 67 deletions

View File

@ -45,7 +45,7 @@ steps:
from_secret: drone_abra-bot_token
fork: true
repositories:
- toolshed/auto-recipes-catalogue-json
- coop-cloud/auto-recipes-catalogue-json
trigger:
event: tag

View File

@ -1,4 +1,4 @@
TYPE=mattermost-lts
TYPE=mattermost
# Domain of service
DOMAIN=mattermost.example.com

View File

@ -1,4 +1 @@
export ABRA_MATTERMOST_ENTRYPOINT_VERSION=v2
export BUSYBOX_VERSION=v1
export PG_BACKUP_VERSION=v1
export ENTRYPOINT_VERSION=v1

BIN
busybox

Binary file not shown.

View File

@ -2,7 +2,7 @@ version: "3.8"
services:
app:
image: mattermost/mattermost-team-edition:10.11.18
image: mattermost/mattermost-team-edition:9.5.9
environment:
- TZ
- MM_SQLSETTINGS_DRIVERNAME=postgres
@ -28,16 +28,13 @@ services:
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- "coop-cloud.${STACK_NAME}.version=2.1.10+10.11.18"
- "coop-cloud.${STACK_NAME}.version=1.2.3+9.5.9"
- "backupbot.backup=true"
- "backupbot.backup.path=/mattermost,/etc/ssl"
configs:
- source: abra_mattermost_entrypoint
target: /abra-mattermost-entrypoint.sh
mode: 0555
- source: busybox
target: /bin/busybox
mode: 0555
secrets:
- postgres_password
entrypoint: /abra-mattermost-entrypoint.sh
@ -58,13 +55,9 @@ services:
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: "/pg_backup.sh backup"
backupbot.backup.volumes.postgres_data.path: "backup.sql"
backupbot.restore.post-hook: "/pg_backup.sh restore"
configs:
- source: pg_backup
target: /pg_backup.sh
mode: 0555
backupbot.backup.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /var/lib/postgresql/data/postgres-backup.sql"
backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup.sql"
backupbot.backup.path: "/var/lib/postgresql/data/"
secrets:
@ -73,15 +66,9 @@ secrets:
name: ${STACK_NAME}_postgres_password_${SECRET_POSTGRES_PASSWORD_VERSION}
configs:
pg_backup:
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
file: pg_backup.sh
abra_mattermost_entrypoint:
name: ${STACK_NAME}_entrypoint_${ABRA_MATTERMOST_ENTRYPOINT_VERSION}
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: ./entrypoint.sh
busybox:
name: ${STACK_NAME}_busybox_${BUSYBOX_VERSION}
file: ./busybox
networks:
proxy:

6
entrypoint.sh Executable file → Normal file
View File

@ -1,7 +1,7 @@
#!/bin/busybox sh
#!/bin/sh
set -e
if test -f "/run/secrets/postgres_password"; then
pwd=`/bin/busybox cat /run/secrets/postgres_password`
pwd=`cat /run/secrets/postgres_password`
if [ -z $pwd ]; then
echo >&2 "error: /run/secrets/postgres_password is empty"
exit 1
@ -16,4 +16,4 @@ else
fi
# https://github.com/mattermost/mattermost-server/blob/master/build/Dockerfile
/mattermost/bin/mattermost
/entrypoint.sh "mattermost"

View File

@ -1,32 +0,0 @@
#!/bin/bash
# Postgres backup/restore hook for the `postgres` service. Invoked by backupbot-two via:
# backupbot.backup.pre-hook = "/pg_backup.sh backup"
# backupbot.backup.volumes.postgres_data.path = "backup.sql"
# backupbot.restore.post-hook = "/pg_backup.sh restore"
# Backup dumps the DB to backup.sql (gzip) inside the postgres volume; backupbot archives it.
# Restore reimports it. The mattermost app keeps TCP connections open to the DB, so restore must
# terminate them and FORCE-drop before recreating, then reimport the dump deterministically — the
# previous recipe shipped no restore hook (file-level PGDATA restore did not reload into the running
# postgres), so a restored backup silently kept the live (un-restored) state.
set -e
BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
export PGPASSWORD=$(cat "${POSTGRES_PASSWORD_FILE:-/run/secrets/postgres_password}")
DB_USER="${POSTGRES_USER:-mattermost}"
DB_NAME="${POSTGRES_DB:-mattermost}"
function backup {
pg_dump -U "$DB_USER" "$DB_NAME" | gzip > "$BACKUP_FILE"
}
function restore {
psql -U "$DB_USER" -d postgres -c \
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='${DB_NAME}' AND pid<>pg_backend_pid();"
psql -U "$DB_USER" -d postgres -c "DROP DATABASE ${DB_NAME} WITH (FORCE);"
createdb -U "$DB_USER" "$DB_NAME"
gunzip -c "$BACKUP_FILE" | psql -U "$DB_USER" -d "$DB_NAME" -1 -v ON_ERROR_STOP=1 -f -
}
$@

View File

@ -1 +0,0 @@
hotfix: rollback to last functional version

View File

@ -1 +0,0 @@
Mattermost Platform Extended Support Release 10.5.8 contains a high severity level security fix.

View File

@ -1,5 +0,0 @@
the docker containers in 10.11 branch don't contain any unix programs. That
means there's no sh or bash, no cat etc etc. We need to have a shell to run
our entrypoint and export the postgres URL as an env variable. To overcome
this we insert a busybox binary as a config into the container. There's no
action required on the side of the operator but it's important to note.