Skip to content

Instantly share code, notes, and snippets.

@devkoriel
Created March 12, 2019 12:25
Show Gist options
  • Save devkoriel/9bf04f399b572e6ced4d78488aa0b73d to your computer and use it in GitHub Desktop.
Save devkoriel/9bf04f399b572e6ced4d78488aa0b73d to your computer and use it in GitHub Desktop.
Mattermost docker-compose.yml
# This file allows you to run mattermost within your docker swarm mode cluster
# for more informations check: https://docs.docker.com/engine/swarm/
#
# Simply run:
#
# `docker stack up [STACK NAME] -c docker-stack.yml`
#
# In this case `mattermost` is going to be stack name, so the command will be:
#
# `docker stack up mattermost -c docker-stack.yml`
#
# From now on all the services that belong to this stack will be prefixed with `mattermost_`
# this file defines 3 services, these are going to be mattermost_db, mattermost_app and mattermost_web,
# each of these names is the service's hostname as well, they can communicate
# with each other easily by using the hostname instead of the ip or exposing ports to the host.
#
# As a side note, images tagged as latest are pulled by default,
# that means there's no need to use `image:latest`
#
# use latest compose v3.3 file format for optimal compatibility with latest docker release and swarm features.
# see https://docs.docker.com/compose/compose-file/compose-versioning/#version-3
# and https://docs.docker.com/compose/compose-file/compose-versioning/#version-33
# and https://docs.docker.com/compose/compose-file/compose-versioning/#upgrading
version: '3.3'
networks:
# network for App <-> DB transactions
mm-in:
driver: overlay
internal: true
# this network faces the outside world
mm-out:
driver: overlay
internal: false
volumes:
mm-dbdata:
services:
db:
# use official mattermost prod-db image
image: mattermost/mattermost-prod-db
networks:
- mm-in
volumes:
# use a named-volume for data persistency
- mm-dbdata:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
environment:
- POSTGRES_USER=mattermost
- POSTGRES_PASSWORD=<POSTGRES_비밀번호>
- POSTGRES_DB=mattermostdb
# uncomment the following to enable backup
# - AWS_ACCESS_KEY_ID=XXXX
# - AWS_SECRET_ACCESS_KEY=XXXX
# - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH
# - AWS_REGION=us-east-1
deploy:
restart_policy:
condition: on-failure
app:
# use official mattermost prod-app image
image: mattermost/mattermost-prod-app
networks:
- mm-in
- mm-out
volumes:
- /<MATTERMOST_디렉토리>/mattermost/config:/mattermost/config:rw
- /<MATTERMOST_디렉토리>/mattermost/data:/mattermost/data:rw
- /<MATTERMOST_디렉토리>/mattermost/logs:/mattermost/logs:rw
- /<MATTERMOST_디렉토리>/mattermost/plugins:/mattermost/plugins:rw
- /etc/localtime:/etc/localtime:ro
environment:
# use service's hostname
- DB_HOST=db
# talk to the port within the overlay network
# without (over)exposing ports
- DB_PORT_NUMBER=5432
- MM_USERNAME=mattermost
- MM_PASSWORD=<POSTGRES_비밀번호>
- MM_DBNAME=mattermostdb
# pass the edition to be used, default is enterprise
# setting this env var will make the app use the team edition
- edition=team
# in case your config is not in default location
# - MM_CONFIG=/mattermost/config/config.json
deploy:
restart_policy:
condition: on-failure
web:
# use official mattermost prod-web image
image: mattermost/mattermost-prod-web
ports:
- "<HOST_포트>:80"
networks:
- mm-out
volumes:
# This directory must have cert files
- /<MATTERMOST_디렉토리>/cert:/cert:ro
- /etc/localtime:/etc/localtime:ro
environment:
# use app service's hostname
- APP_HOST=app
# talk to the port within the overlay network
# without (over)exposing ports
- APP_PORT_NUMBER=8000
deploy:
restart_policy:
condition: on-failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment