Compare commits

...

35 Commits

Author SHA1 Message Date
2d10d73582 mmctl patch draft 2025-05-22 12:25:49 -04:00
b8ea370933 add backup handler scripts 2025-05-22 00:48:23 -04:00
726e3ab5c3 new backup scripts 2025-04-17 15:17:07 -04:00
54d8ac8954 fix typo 2025-04-17 15:17:07 -04:00
8629fd77e9 initial 2025-04-17 15:17:07 -04:00
5f0295b98a chore: publish 2.1.0+10.5.0 release 2025-04-16 12:45:26 -04:00
6268af51ff Merge pull request 'Add support for enterprise license' (#4) from license-support into main
Reviewed-on: #4
2025-04-16 15:49:43 +00:00
e3268bc404 Add support for enterprise license 2025-04-11 11:14:24 -04:00
27faf7a644 add release notes
Some checks failed
continuous-integration/drone/push Build is failing
2025-02-11 15:16:22 -05:00
6964fbdd6d chore: publish 2.0.0+10.5.0 release
Some checks failed
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2025-02-11 15:15:11 -05:00
c96bd2478e Merge pull request 'Add SSO and Email support' (#3) from sso into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #3
2025-02-11 20:09:26 +00:00
5e320b516d reload mattermost config using mmctl. Fix readme typo
Some checks failed
continuous-integration/drone/pr Build is failing
2025-02-11 15:07:18 -05:00
c173127cf8 add config reset command
Some checks failed
continuous-integration/drone/pr Build is failing
2025-02-10 18:14:12 -05:00
c2d2272621 add env 2025-02-10 17:51:32 -05:00
107bc2fca9 SSO and email support added 2025-02-10 17:48:48 -05:00
4e635659e1 sso support wip 2025-02-10 13:32:14 -05:00
cdc7d659a0 working on sso support 2025-02-09 14:47:02 -05:00
f58c9a2aab chore: publish 1.5.3+9.11.8 release
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
2025-01-23 16:15:49 +01:00
18cf2d21cc chore: publish 1.5.2+9.11.7 release
Some checks failed
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2025-01-23 14:14:46 +05:00
fc31939b5e Update .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
2025-01-08 10:09:13 -08:00
b1427c9a1e chore: publish 1.5.1+9.11.6 release
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is failing
2024-12-12 10:35:55 +01:00
2e177985f8 chore: publish 1.5.0+9.11.5 release
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
2024-11-21 14:13:55 +05:00
8e63b9839d chore: publish 1.4.2+9.5.12 release
Some checks failed
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2024-11-07 16:18:32 +01:00
c83e59cfc5 chore: publish 1.4.1+9.5.11 release
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
2024-11-07 12:11:48 +05:00
142cd05e01 chore: publish 1.4.0+9.5.12 release
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
2024-11-07 11:26:56 +05:00
be6939d39b chore: publish 1.3.0+9.11.3 release
Some checks failed
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2024-10-25 13:56:39 +02:00
1bbc0bc5e3 chore: publish 1.2.5+9.5.11 release
Some checks failed
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2024-10-17 18:18:28 +05:00
91136d15a7 chore: publish 1.2.4+9.5.10 release
Some checks failed
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2024-10-03 11:11:54 -07:00
bf7466f8b2 chore: publish 1.2.2+9.5.9 release
Some checks failed
continuous-integration/drone/push Build is failing
2024-09-02 19:24:15 +02:00
33466a38cf chore: publish 1.2.1+9.5.8 release
Some checks failed
continuous-integration/drone/push Build is failing
2024-07-25 10:53:53 -07:00
4c6dca85fa chore: publish 1.2.0+9.5.7 release
Some checks failed
continuous-integration/drone/push Build is failing
2024-07-04 13:56:57 -07:00
2e366449bf chore: publish 1.1.0+9.5.6 release 2024-06-06 11:03:21 -07:00
a5ba7e60e7 chore: publish 1.0.0+9.5.4 release 2024-05-02 14:10:21 -07:00
3wc
fdd0610784 Update recipe metadata
Some checks failed
continuous-integration/drone/push Build is failing
2024-03-30 16:33:50 -03:00
3wc
de797a654a chore: publish 0.3.8+8.1.12 release
Some checks failed
continuous-integration/drone/push Build is failing
2024-03-28 15:50:36 -03:00
16 changed files with 270 additions and 15 deletions

View File

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

View File

@ -9,8 +9,31 @@ LETS_ENCRYPT_ENV=production
# Secret Versions
SECRET_POSTGRES_PASSWORD_VERSION=v1
COMPOSE_FILE="compose.yml"
# Container Settings
## Timezone inside the containers. The value needs to be in the form 'Europe/Berlin'.
## A list of these tz database names can be looked up at Wikipedia
## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=UTC
ORG_NAME="My Organization"
## Email Support
#COMPOSE_FILE="$COMPOSE_FILE:compose.email.yml"
#ORG_EMAIL_ADDRESS="youruser@youremail.org"
#SMTP_USER="youruser"
#SECRET_SMTP_PASS_VERSION=v1
#SMTP_HOST=""
#SMTP_PORT=587
#SMTP_SECURITY=STARTTLS #TLS or STARTTLS
## SSO config
#COMPOSE_FILE="$COMPOSE_FILE:compose.sso.yml"
#SSO_DOMAIN=accounts.example.com
#SSO_APP=mattermost
#SSO_ID=
#SECRET_MATTERMOST_SSO_SECRET_VERSION=v1
## Enable enterprise version (requires a valid license)
#COMPOSE_FILE="$COMPOSE_FILE:compose.license.yml"

View File

@ -2,14 +2,14 @@
<!-- metadata -->
* **Category**:
* **Status**:
* **Image**:
* **Healthcheck**: N
* **Backups**: N
* **Email**:
* **Tests**: N
* **SSO**: N
* **Category**: Apps
* **Status**: 3
* **Image**: [`mattermost/mattermost-team-edition`](https://hub.docker.com/r/mattermost/mattermost-team-edition), 4, upstream
* **Healthcheck**: No
* **Backups**: Yes
* **Email**: 1
* **Tests**: 2
* **SSO**: No
<!-- endmetadata -->
@ -24,5 +24,68 @@
5. `abra app deploy YOURAPPNAME`
6. Open the configured domain in your browser to finish set-up
## Enable Email
**WARNING: Following these steps will overwrite the configuration of your Mattermost instance. Probably only run it on a fresh deployment.**
- `abra app config YOURAPPNAME`
- Uncomment the section starting with **Email Support**
- `abra app secret i YOURAPPNAME smtp_pass v1 'yourSMTPpassword'`
- `abra app undeploy YOURAPPNAME`
- `abra app deploy YOURAPPNAME`
- `abra app command -C YOURAPPNAME app reset_config` <- This will overwrite your configuration
## Enable SSO with Authentik
This is how to configure your Mattermost server to accept logins from your Authentik SSO provider.
### Configure Authentik
#### Create a property mapping
- Log in as administrator of your Authentik instance
- Go to https://authentik.yourserver.org/if/admin/#/core/property-mappings and choose **Create**
- Choose Scope Mapping
- Name: `Mattermost ID`
- Scope Name: `id`
- Description: *optional own description*
- Expression: `return { "id": request.user.id }`
- Create another Scope Mapping
- Name: `Mattermost Username`
- Scope Name: `username`
- Description: *optional own description*
- Expression: `return { "username": request.user.username }`
#### Create Application and Provider
- Go to https://authentik.yourserver.org/if/admin/#/core/applications and choose **Create With Wizard**
- Application Name: mattermost
- **Next**
- Choose OAuth2/OIDC
- Set Authorization flow: `default-provider-authorization-implicit-consent (Authorize Application)`
- Copy the **Client ID** and **Client Secret**, you'll need them later
- Add Redirect URIs:
- https://mattermost.yourserver.org/login/gitlab/complete
- https://mattermost.yourserver.org/signup/gitlab/complete
- Expand Advanced Protocol Settings
- Under Scopes, select `Mattermost ID` and `Mattermost Username`, and click the > to add them to **Selected Scopes**
- **Submit**
### Configure Mattermost
**WARNING: Following these steps will overwrite the configuration of your Mattermost instance. Probably only run it on a fresh deployment.**
- `abra app configure YOURAPPNAME`
- Uncomment the section starting with `## SSO config`
- Set `SSO_ID` to the value you saved when configuring Authentik
- `abra app secret insert YOURAPPNAME mattermost_sso_secret v1 <the authentik provider secret you saved>`
- `abra app undeploy YOURAPPNAME`
- `abra app deploy YOURAPPNAME`
- `abra app command -C YOURAPPNAME app reset_config` <- This will overwrite your configuration
### Disable non-SSO login (Optional)
- Ensure that your SSO user has the **System Admin** role: https://YOURAPPNAME/admin_console/user_management/users
- Go to https://YOURAPPNAME/admin_console/authentication/email
- 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`
[`abra`]: https://git.coopcloud.tech/coop-cloud/abra
[`coop-cloud/traefik`]: https://git.coopcloud.tech/coop-cloud/traefik

View File

@ -1 +1,7 @@
export ENTRYPOINT_VERSION=v1
export MATTERMOST_CONFIG_VERSION=v1
reset_config() {
cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged
mmctl config reload --local
}

21
backup-mattermost.sh Normal file
View File

@ -0,0 +1,21 @@
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 -f '.*plugins'
sleep 40
pkill -f '.*plugins'
sleep 40
pkill -f '.*plugins'
fi
if [ "$1" == "post-restore" ]; then
# kill mattermost so that the container restarts
pkill -f mattermost
fi

19
backup-postgres.sh Normal file
View File

@ -0,0 +1,19 @@
if [ "$1" == "pre-backup" ]; then
# Remove any existing db dump and then create a new one
rm -rf /var/lib/postgresql/data/postgres-backup
PGPASSWORD=$(cat ${POSTGRES_PASSWORD_FILE}) pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} --format=directory -f /var/lib/postgresql/data/postgres-backup
exit
fi
if [ "$1" == "post-backup" ]; then
rm -rf /var/lib/postgresql/data/postgres-backup
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

20
compose.email.yml Normal file
View File

@ -0,0 +1,20 @@
version: "3.8"
services:
app:
configs:
- source: mattermost_config
target: /config-to-copy.json
secrets:
- smtp_pass
secrets:
smtp_pass:
external: true
name: ${STACK_NAME}_smtp_pass_${SECRET_SMTP_PASS_VERSION}
configs:
mattermost_config:
name: ${STACK_NAME}_mattermost_config_${MATTERMOST_CONFIG_VERSION}
file: ./config.json.tmpl
template_driver: golang

5
compose.license.yml Normal file
View File

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

20
compose.sso.yml Normal file
View File

@ -0,0 +1,20 @@
version: "3.8"
services:
app:
configs:
- source: mattermost_config
target: /config-to-copy.json
secrets:
- mattermost_sso_secret
secrets:
mattermost_sso_secret:
external: true
name: ${STACK_NAME}_mattermost_sso_secret_${SECRET_MATTERMOST_SSO_SECRET_VERSION}
configs:
mattermost_config:
name: ${STACK_NAME}_mattermost_config_${MATTERMOST_CONFIG_VERSION}
file: ./config.json.tmpl
template_driver: golang

View File

@ -2,7 +2,7 @@ version: "3.8"
services:
app:
image: mattermost/mattermost-team-edition:8.1.11
image: mattermost/mattermost-team-edition:10.5.0
environment:
- TZ
- MM_SQLSETTINGS_DRIVERNAME=postgres
@ -28,13 +28,23 @@ 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=0.3.7+8.1.11"
- "coop-cloud.${STACK_NAME}.version=2.1.0+10.5.0"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
- "backupbot.backup=true"
- "backupbot.backup.path=/mattermost,/etc/ssl"
- "backupbot.restore.pre-hook=/backup.sh pre-restore"
- "backupbot.restore.post-hook=/backup.sh post-restore"
configs:
- source: abra_mattermost_entrypoint
target: /abra-mattermost-entrypoint.sh
mode: 0555
- source: backup-mattermost
target: /backup.sh
mode: 0777
- source: mattermost-config
target: /config-to-copy.json
- source: config-patch
target: /config-patch.json
secrets:
- postgres_password
entrypoint: /abra-mattermost-entrypoint.sh
@ -48,6 +58,10 @@ services:
- POSTGRES_USER=mattermost
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
- POSTGRES_DB=mattermost
configs:
- source: backup-postgres
target: /backup.sh
mode: 0777
secrets:
- postgres_password
networks:
@ -55,10 +69,10 @@ services:
deploy:
labels:
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.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup.sql"
backupbot.backup.path: "/var/lib/postgresql/data/"
backupbot.backup.pre-hook: "/backup.sh pre-backup"
backupbot.backup.post-hook: "/backup.sh post-backup"
backupbot.restore.post-hook: "/backup.sh post-restore"
secrets:
postgres_password:
@ -69,6 +83,20 @@ configs:
abra_mattermost_entrypoint:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: ./entrypoint.sh
backup-mattermost:
name: backup-mattermost
file: ./backup-mattermost.sh
backup-postgres:
name: backup-postgres
file: ./backup-postgres.sh
mattermost_config:
name: ${STACK_NAME}_mattermost_config_${MATTERMOST_CONFIG_VERSION}
file: ./config.json.tmpl
template_driver: golang
config_patch:
name: ${STACK_NAME}_config_patch_${MATTERMOST_CONFIG_PATCH_VERSION}
file: ./config-patch.json.tmpl
template_driver: golang
networks:
proxy:

View File

@ -0,0 +1,18 @@
{
"EmailSettings": {
"FeedbackName": "{{ env "ORG_NAME" }}",
"FeedbackEmail": "{{ env "ORG_EMAIL_ADDRESS" }}",
"ReplyToAddress": "{{ env "ORG_EMAIL_ADDRESS" }}",
"EnableSMTPAuth": true,
"SMTPUsername": "{{ env "SMTP_USER" }}",
"SMTPPassword": "{{ secret "smtp_pass" }}",
"SMTPServer": "{{ env "SMTP_HOST" }}",
"SMTPPort": "{{ env "SMTP_PORT" }}",
"ConnectionSecurity": "{{ env "SMTP_SECURITY" }}",
},
"SupportSettings": {
"SupportEmail": "{{ env "ORG_EMAIL_ADDRESS" }}"
},
"CoopCloudManaged": {
}
}

8
config-patch.json.tmpl Normal file
View File

@ -0,0 +1,8 @@
{
"ServiceSettings": {
"EnableLocalMode": true,
"LocalModeSocketLocation": "/var/tmp/mattermost_local.socket"
},
"CoopCloudManaged": {
}
}

View File

@ -0,0 +1,16 @@
{
"GitLabSettings": {
"Enable": true,
"Secret": "{{ secret "mattermost_sso_secret" }}",
"Id": "{{ env "SSO_ID" }}",
"Scope": "",
"AuthEndpoint": "https://{{ env "SSO_DOMAIN" }}/application/o/authorize/",
"TokenEndpoint": "https://{{ env "SSO_DOMAIN" }}/application/o/token/",
"UserAPIEndpoint": "https://{{ env "SSO_DOMAIN" }}/application/o/userinfo/",
"DiscoveryEndpoint": "https://{{ env "SSO_DOMAIN" }}/application/o/{{ env "SSO_APP" }}/.well-known/openid-configuration",
"ButtonText": "{{ env "ORG_NAME" }}",
"ButtonColor": "#ff0000"
},
"CoopCloudManaged": {
}
}

View File

@ -15,5 +15,11 @@ else
exit 1
fi
# If the default Mattermost config hasn't already been replaced
# by the templated config this recipe generates, replace it
if ! test -f "/mattermost/config/CoopCloudManaged"; then
cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged
fi
# https://github.com/mattermost/mattermost-server/blob/master/build/Dockerfile
/entrypoint.sh "mattermost"
/entrypoint.sh "mattermost"

1
release/1.4.1+9.5.11 Normal file
View File

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

1
release/2.0.0+10.5.0 Normal file
View File

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