|  530e8f0194 WAL logs in archive mode will consume a lot more spaces and not useful when backup is off. This fix add ability to switch WAL logs mode based on the backup switch. | ||
|---|---|---|
| app | ||
| db | ||
| web | ||
| .travis.yml | ||
| docker-compose-nossl.yml | ||
| docker-compose-ssl.yml | ||
| LICENSE | ||
| README.md | ||
Dockerfiles for Mattermost in production
Requirement
Installation
Install with SSL certificate
- 
Create a symbolic link docker-compose.ymltodocker-compose-ssl.yml:ln -s docker-compose-ssl.yml docker-compose.yml 
- 
Put your SSL certificate as web/cert/cert.pemand the private key that has no password asweb/cert/private/key-no-password.pem. If you don't have them you may generate a self-signed SSL certificate.
- 
Build and run mattermost docker-compose up -d 
- 
Open https://your.domainwith your web browser.
Install without SSL certificate
- 
Create a symbolic link docker-compose.ymltodocker-compose-nossl.yml:ln -s docker-compose-nossl.yml docker-compose.yml 
- 
Build and run mattermost docker-compose up -d 
- 
Open http://your.domainwith your web browser.
Starting/Stopping
Start
docker-compose start
Stop
docker-compose stop
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 Wel-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.
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 informations
If you want to know how to use docker-compose, see the overview page.
For the server configurations, see prod-ubuntu.rst of mattermost.