From bcbe60a8d85f2957bf3a9572c53fae0678c789b7 Mon Sep 17 00:00:00 2001 From: pierre demagny Date: Mon, 25 Sep 2017 22:56:04 +0200 Subject: [PATCH] Add docker swarm mode support (#176) * add docker swarm mode support Signed-off-by: Pierre DEMAGNY * use official prod-web image, respect project's standard directory layout & update readme accordingly. Signed-off-by: Pierre DEMAGNY --- README.md | 21 +++++++++ contrib/swarm/docker-stack.yml | 78 ++++++++++++++++++++++++++++++++++ web/docker-entry.sh | 0 3 files changed, 99 insertions(+) create mode 100644 contrib/swarm/docker-stack.yml mode change 100644 => 100755 web/docker-entry.sh diff --git a/README.md b/README.md index 64ad3c8..7f04bcb 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,27 @@ docker-compose up -d ``` See the [offical Upgrade Guide](http://docs.mattermost.com/administration/upgrade.html) for more details. +## Installation using Docker Swarm Mode + +The following instructions deploy Mattermost in a production configuration using docker swarm mode on one node. +Running containerized applications on multi-node swarms involves specific data portability and replication handling that are not covered here. + +### Requirements + +* [docker] (1.12.0+) + +### Swarm Mode Installation + +First, create mattermost directory structure on the docker hosts: +``` +mkdir -p /var/lib/mattermost/{cert,config,data,logs} +``` + +Then, fire up the stack in your swarm: +``` +docker stack deploy -c contrib/swarm/docker-stack.yml mattermost +``` + ## Known Issues * Do not modify the Listen Address in Service Settings. diff --git a/contrib/swarm/docker-stack.yml b/contrib/swarm/docker-stack.yml new file mode 100644 index 0000000..affbbf2 --- /dev/null +++ b/contrib/swarm/docker-stack.yml @@ -0,0 +1,78 @@ +# This file allow you to run mattermost within your docker swarm mode cluster +# for more informations check: https://docs.docker.com/engine/swarm/ +# +# 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' + +services: + db: + # use official mattermost prod-db image + image: mattermost/mattermost-prod-db:latest + ports: + - "5432" + networks: + - mm-network + volumes: + # use a named-volume for data persistency + - mm-dbdata:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + POSTGRES_USER: mmuser + POSTGRES_PASSWORD: mmuser_password + POSTGRES_DB: mattermost + # 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:latest + ports: + - "8065" + networks: + - mm-network + volumes: + - /var/lib/mattermost/config:/mattermost/config:rw + - /var/lib/mattermost/data:/mattermost/data:rw + - /var/lib/mattermost/logs:/mattermost/logs:rw + - /etc/localtime:/etc/localtime:ro + environment: + DB_HOST: db + DB_PORT_NUMBER: 5432 + MM_USERNAME: mmuser + MM_PASSWORD: mmuser_password + MM_DBNAME: mattermost + # 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:latest + ports: + - "80:80" + - "443:443" + networks: + - mm-network + volumes: + # This directory must have cert files + - /var/lib/mattermost/cert:/cert:ro + - /etc/localtime:/etc/localtime:ro + deploy: + restart_policy: + condition: on-failure + +networks: + mm-network: + +volumes: + mm-dbdata: diff --git a/web/docker-entry.sh b/web/docker-entry.sh old mode 100644 new mode 100755