Manual fork of official GitHub repository for docker deployment of Mattermost https://github.com/mattermost/mattermost-docker
This repository has been archived on 2021-08-31. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Pan Luo 82f13b1e4c Move enterprise version into this branch (#94)
Since the only difference is mattermost package and  we don't want
to maintain two difference branches, just moved the enterprise version
into a alternative dockerfile
2017-03-13 15:26:45 -07:00
app Move enterprise version into this branch (#94) 2017-03-13 15:26:45 -07:00
contrib/kubernetes k8s: Move files for k8s into contrib directory 2016-10-08 19:12:56 +09:00
db make use of postgres image db init script, use their variable naming … (#100) 2017-02-23 13:32:24 -08:00
web simplify reverse proxy (#98) 2017-02-26 00:30:03 -08:00
.gitignore Move enterprise version into this branch (#94) 2017-03-13 15:26:45 -07:00
.travis.yml make use of postgres image db init script, use their variable naming … (#100) 2017-02-23 13:32:24 -08:00
docker-compose-v1.yml Move enterprise version into this branch (#94) 2017-03-13 15:26:45 -07:00
docker-compose.yml Move enterprise version into this branch (#94) 2017-03-13 15:26:45 -07:00
Dockerrun.aws.json aws: Upgrade to Mattermost 3.1.0 2016-06-21 19:20:34 +09:00
LICENSE Add README and LICENSE 2015-11-30 17:58:11 +09:00
MAINTENANCE.md Updating based on xcompass feedback 2017-02-04 08:39:32 -08:00
README.aws.md Support aws beanstalk 2016-04-25 00:36:38 +09:00
README.md Move enterprise version into this branch (#94) 2017-03-13 15:26:45 -07:00

Production Docker deployment for Mattermost

This project enables deployment of a Mattermost server in a multi-node production configuration using Docker.

Build Status

Notes:

  • The default Mattermost edition for this repo has changed from team edition to enterprise edition. Please see Choose Edition section.
  • To install this Docker project on AWS Elastic Beanstalk please see AWS Elastic Beanstalk Guide.
  • To install Mattermost without Docker directly onto a Linux-based operating systems, please see Admin Guide.

Installation using Docker Compose

The following instructions deploy Mattermost in a production configuration using multi-node Docker Compose set up.

Requirements

Choose Edition to Install

If you want to install enterprise edition, you can skip this section.

To install the team edition, comment out the following line in docker-compose.yaml file:

```
dockerfile: Dockerfile-enterprise
```

Database

Make sure to set the appropriate values for MM_USERNAME, MM_PASSWORD and MM_DBNAME.

Install with SSL certificate

  1. Put your SSL certificate as ./volumes/web/cert/cert.pem and the private key that has no password as ./volumes/web/cert/key-no-password.pem. If you don't have them you may generate a self-signed SSL certificate.

  2. Build and run mattermost

    docker-compose up -d
    
  3. Open https://your.domain with your web browser.

Install without SSL certificate

  1. Build and run mattermost

    docker-compose up -d
    
  2. Open http://your.domain with your web browser.

Starting/Stopping

Start

docker-compose start

Stop

docker-compose stop

Update

Make sure to backup Mattermost data before proceeding.

docker-compose down
git pull
docker-compose build
docker-compose up -d

Removing

Remove the containers

docker-compose stop && docker-compose rm

Remove the data and settings of your mattermost instance

sudo rm -rf volumes

Database Backup

When AWS S3 environment variables are specified on db docker container, it enables Wal-E backup to S3.

docker run -d --name mattermost-db \
    -e AWS_ACCESS_KEY_ID=XXXX \
    -e AWS_SECRET_ACCESS_KEY=XXXX \
    -e WALE_S3_PREFIX=s3://BUCKET_NAME/PATH \
    -e AWS_REGION=us-east-1
    -v ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
    -v /etc/localtime:/etc/localtime:ro
    db

All four environment variables are required. It will enable completed WAL segments sent to archive storage (S3). The base backup and clean up can be done through the following command:

# base backup
docker exec mattermost-db su - postgres sh -c "/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /var/lib/postgresql/data"
# keep the most recent 7 base backups and remove the old ones
docker exec mattermost-db su - postgres sh -c "/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e delete --confirm retain 7"

Those tasks can be executed through a cron job or systemd timer.

Customization

Customization can be done through environment variables.

Mattermost App Image

  • MM_USERNAME: database username, must be the same as one in DB image
  • MM_PASSWORD: database password, must be the same as one in DB image
  • MM_DBNAME: database name, must be the same as one in DB image
  • DB_HOST: database host address
  • DB_PORT_5432_TCP_PORT: database port
  • MM_CONFIG: configuration file location. It can be used when config is mounted in a different location.

Mattermost DB Image

  • MM_USERNAME: database username, must be the same as on in App image
  • MM_PASSWORD: database password, must be the same as on in App image
  • MM_DBNAME: database name, must be the same as on in App image
  • AWS_ACCESS_KEY_ID: aws access key, used for db backup
  • AWS_SECRET_ACCESS_KEY: aws secret, used for db backup
  • WALE_S3_PREFIX: aws s3 bucket name, used for db backup
  • AWS_REGION: aws region, used for db backup

Mattermost Web Image

  • MATTERMOST_ENABLE_SSL: whether to enable SSL
  • PLATFORM_PORT_80_TCP_PORT: port that Mattermost image is listening on

Upgrading to Team Edition 3.0.x from 2.x

You need to migrate your database before upgrading mattermost to 3.0.x from 2.x. Run these commands in the latest mattermost-docker directory.

docker-compose rm -f app
docker-compose build app
docker-compose run app -upgrade_db_30
docker-compose up -d

See the offical Upgrade Guide for more details.

Known Issues

  • Do not modify the Listen Address in Service Settings.
  • Rarely 'app' container fails to start because of "connection refused" to database. Workaround: Restart the container.

More information

If you want to know how to use docker-compose, see the overview page.

If you want to run Mattermost on Kubernetes you can start with the manifest examples in the kubernetes folder

For the server configurations, see prod-ubuntu.rst of mattermost.