Compare commits

..

3 Commits

Author SHA1 Message Date
80d21a411b new backup scripts 2025-04-09 15:13:16 -04:00
6485852ae0 fix typo 2025-03-26 18:11:20 -04:00
5f6b845212 initial 2025-03-26 18:09:15 -04:00
10 changed files with 43 additions and 46 deletions

View File

@ -34,6 +34,3 @@ ORG_NAME="My Organization"
#SSO_APP=mattermost #SSO_APP=mattermost
#SSO_ID= #SSO_ID=
#SECRET_MATTERMOST_SSO_SECRET_VERSION=v1 #SECRET_MATTERMOST_SSO_SECRET_VERSION=v1
## Enable enterprise version (requires a valid license)
#COMPOSE_FILE="$COMPOSE_FILE:compose.license.yml"

View File

@ -79,16 +79,6 @@ This is how to configure your Mattermost server to accept logins from your Authe
- Go to https://YOURAPPNAME/admin_console/authentication/email - Go to https://YOURAPPNAME/admin_console/authentication/email
- Set **Enable sign-in with email** and **Enable sign-in with username** to `false` - Set **Enable sign-in with email** and **Enable sign-in with username** to `false`
## Use a Mattermost Enterprise License
**NOTE: This deploys non-FOSS code and requires you to pay Mattermost for a license to enable features. Not recommended unless you know what you're doing.**
- `abra app config YOURAPPNAME`
- Uncomment the section which starts with `## Enable enterprise version`
- `abra app undeploy YOURAPPNAME`
- `abra app deploy YOURAPPNAME`
# Technical Notes
This recipe inserts a statically-compiled busybox binary from `busybox:1.25-uclibc` into the distroless container, to allow running the custom entrypoint shell script which configures Mattermost.
[`abra`]: https://git.coopcloud.tech/coop-cloud/abra [`abra`]: https://git.coopcloud.tech/coop-cloud/abra
[`coop-cloud/traefik`]: https://git.coopcloud.tech/coop-cloud/traefik [`coop-cloud/traefik`]: https://git.coopcloud.tech/coop-cloud/traefik

View File

@ -1,6 +1,5 @@
export ENTRYPOINT_VERSION=v3 export ENTRYPOINT_VERSION=v1
export MATTERMOST_CONFIG_VERSION=v1 export MATTERMOST_CONFIG_VERSION=v1
export SHELL_VERSION=v1
reset_config() { reset_config() {
cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged

16
backup-mattermost.sh Normal file
View File

@ -0,0 +1,16 @@
if [ "$1" == "pre-backup" ]; then
exit
fi
if [ "$1" == "pre-backup" ]; then
exit
fi
if [ "$1" == "pre-restore" ]; then
# kill the running plugins that need to be overwritten
pkill plugins
fi
if [ "$1" == "post-restore" ]; then
mmctl config reload --local
fi

15
backup-postgres.sh Normal file
View File

@ -0,0 +1,15 @@
if [ "$1" == "pre-backup" ]; then
exit
fi
if [ "$1" == "post-backup" ]; then
exit
fi
if [ "$1" == "pre-restore" ]; then
exit
fi
if [ "$1" == "post-restore" ]; then
pg_restore -U $POSTGRES_USER -d $POSTGRES_DB -c /var/lib/postgresql/data/postgres-backup
fi

Binary file not shown.

View File

@ -1,5 +0,0 @@
version: "3.8"
services:
app:
image: mattermost/mattermost-enterprise-edition:10.11

View File

@ -2,7 +2,7 @@ version: "3.8"
services: services:
app: app:
image: mattermost/mattermost-team-edition:10.11 image: mattermost/mattermost-team-edition:10.5.0
environment: environment:
- TZ - TZ
- MM_SQLSETTINGS_DRIVERNAME=postgres - MM_SQLSETTINGS_DRIVERNAME=postgres
@ -28,14 +28,13 @@ services:
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect" - "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.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}" - "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- "coop-cloud.${STACK_NAME}.version=2.2.0+10.11" - "coop-cloud.${STACK_NAME}.version=1.5.3+9.11.8"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}" - "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
- "backupbot.backup=true" - "backupbot.backup=true"
- "backupbot.backup.path=/mattermost,/etc/ssl" - "backupbot.backup.path=/mattermost,/etc/ssl"
- "backupbot.restore.pre-hook=/restore.sh pre"
- "backupbot.restore.post-hook=/restore.sh post"
configs: configs:
- source: busybox
target: /bin/busybox
mode: 0555
- source: abra_mattermost_entrypoint - source: abra_mattermost_entrypoint
target: /abra-mattermost-entrypoint.sh target: /abra-mattermost-entrypoint.sh
mode: 0555 mode: 0555
@ -59,9 +58,10 @@ services:
deploy: deploy:
labels: labels:
backupbot.backup: "true" backupbot.backup: "true"
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.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} --format=directory -f /var/lib/postgresql/data/postgres-backup"
backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup.sql" backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup"
backupbot.backup.path: "/var/lib/postgresql/data/" backupbot.backup.path: "/var/lib/postgresql/data/"
backupbot.restore.post-hook: "/backup-postgres.sh post"
secrets: secrets:
postgres_password: postgres_password:
@ -72,9 +72,6 @@ configs:
abra_mattermost_entrypoint: abra_mattermost_entrypoint:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION} name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: ./entrypoint.sh file: ./entrypoint.sh
busybox:
name: ${STACK_NAME}_busybox_${SHELL_VERSION}
file: ./bin/busybox
networks: networks:

View File

@ -1,13 +1,4 @@
#!/bin/busybox sh #!/bin/sh
/bin/busybox mkdir /tmp/bin
export PATH=$PATH:/tmp/bin
/bin/busybox ln -s /bin/busybox /tmp/bin/ln
ln -s /bin/busybox /tmp/bin/cat
ln -s /bin/busybox /tmp/bin/echo
ln -s /bin/busybox /tmp/bin/cp
ln -s /bin/busybox /tmp/bin/touch
ln -s /bin/busybox /tmp/bin/rm
set -e set -e
if test -f "/run/secrets/postgres_password"; then if test -f "/run/secrets/postgres_password"; then
pwd=`cat /run/secrets/postgres_password` pwd=`cat /run/secrets/postgres_password`
@ -30,7 +21,5 @@ if ! test -f "/mattermost/config/CoopCloudManaged"; then
cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged
fi fi
rm -rf /tmp/bin # https://github.com/mattermost/mattermost-server/blob/master/build/Dockerfile
/entrypoint.sh "mattermost"
# https://github.com/mattermost/mattermost/blob/master/server/build/Dockerfile
/mattermost/bin/mattermost

View File

@ -1 +0,0 @@
Note that the first time you enable the email or sso configurations it will reset your existing Mattermost configuration.