forked from mattermost/mattermost-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-stack.yml
143 lines (138 loc) · 4.12 KB
/
docker-stack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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 deploy -c docker-stack.yml [STACK NAME]`
#
# In this case `mattermost` is going to be stack name, so the command will be:
#
# `docker stack deploy -c docker-stack.yml mattermost`
#
# From now on all the services that belong to this stack will be prefixed with `mattermost_`
# this file defines 2 services, these are going to be mattermost_db and mattermost_app,
# 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.7'
networks:
# network for App <-> DB transactions
mm-in:
driver: overlay
internal: true
# this network faces the outside world
mm-out:
driver: overlay
internal: false
secrets:
mm_db_user:
external: true
mm_db_password:
external: true
mm_db_name:
external: true
volumes:
mm_db_data:
services:
db:
# use official mattermost prod-db image
image: acrlakshman/mattermost-prod-db:latest
networks:
- mm-in
volumes:
- type: volume
source: mm_db_data
target: /var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
secrets:
- mm_db_user
- mm_db_password
- mm_db_name
environment:
- POSTGRES_USER=DOCKERSECRET:mm_db_user
- POSTGRES_PASSWORD=DOCKERSECRET:mm_db_password
- POSTGRES_DB=DOCKERSECRET:mm_db_name
# 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
delay: 10s
max_attempts: 3
replicas: 1
placement:
constraints: [node.role == manager]
app:
# custom image
image: acrlakshman/mattermost-team:5.21.0
ports:
- "7070:8000"
networks:
- mm-in
- mm-out
volumes:
- type: bind
source: ./volumes/app/mattermost/config
target: /mattermost/config
- type: bind
source: ./volumes/app/mattermost/data
target: /mattermost/data
- type: bind
source: ./volumes/app/mattermost/logs
target: /mattermost/logs
- type: bind
source: ./volumes/app/mattermost/plugins
target: /mattermost/plugins
- /etc/localtime:/etc/localtime:ro
secrets:
- mm_db_user
- mm_db_password
- mm_db_name
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=DOCKERSECRET:mm_db_user
- MM_PASSWORD=DOCKERSECRET:mm_db_password
- MM_DBNAME=DOCKERSECRET:mm_db_name
# 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
delay: 10s
max_attempts: 3
replicas: 1
depends_on:
- db
visualizer:
image: dockersamples/visualizer:stable
ports:
- "7071:8080"
stop_grace_period: 1m30s
networks:
- mm-out
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 3
placement:
constraints: [node.role == manager]