-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.prod.yaml
79 lines (74 loc) · 2.25 KB
/
docker-compose.prod.yaml
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
version: "3.7"
#service template
x-mongodb:
&mongodb
environment:
MONGO_INITDB_ROOT_USERNAME_FILE: /run/secrets/MONGO_INITDB_ROOT_USERNAME_FILE
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/MONGO_INITDB_ROOT_PASSWORD_FILE
MONGO_DB_ADMIN_USERNAME_FILE: /run/secrets/MONGO_DB_ADMIN_USERNAME_FILE
MONGO_DB_ADMIN_PASSWORD_FILE: /run/secrets/MONGO_DB_ADMIN_PASSWORD_FILE
MONGO_REPLICA_ADMIN_USERNAME_FILE: /run/secrets/MONGO_REPLICA_ADMIN_USERNAME_FILE
MONGO_REPLICA_ADMIN_PASSWORD_FILE: /run/secrets/MONGO_REPLICA_ADMIN_PASSWORD_FILE
MONGO_USER_USERNAME_FILE: /run/secrets/MONGO_USER_USERNAME_FILE
MONGO_USER_PASSWORD_FILE: /run/secrets/MONGO_USER_PASSWORD_FILE
volumes:
- ./entryProd.js:/docker-entrypoint-initdb.d/entry.js
networks:
- maxminded-ntw-swarm
secrets:
- MONGO_INITDB_ROOT_USERNAME_FILE
- MONGO_INITDB_ROOT_PASSWORD_FILE
- MONGO_DB_ADMIN_USERNAME_FILE
- MONGO_DB_ADMIN_PASSWORD_FILE
- MONGO_REPLICA_ADMIN_USERNAME_FILE
- MONGO_REPLICA_ADMIN_PASSWORD_FILE
- MONGO_USER_USERNAME_FILE
- MONGO_USER_PASSWORD_FILE
#docker network create -d overlay --attachable maxminded-ntw-swarm
#docker stack up -c docker.yaml app --with-registry-auth
#List of networks for Docker Swarm
networks:
maxminded-ntw-swarm:
external:
name: maxminded-ntw-swarm
#List of secrets for Docker Swarm
secrets:
MONGO_INITDB_ROOT_USERNAME_FILE:
external: true
MONGO_INITDB_ROOT_PASSWORD_FILE:
external: true
MONGO_DB_ADMIN_USERNAME_FILE:
external: true
MONGO_DB_ADMIN_PASSWORD_FILE:
external: true
MONGO_REPLICA_ADMIN_USERNAME_FILE:
external: true
MONGO_REPLICA_ADMIN_PASSWORD_FILE:
external: true
MONGO_USER_USERNAME_FILE:
external: true
MONGO_USER_PASSWORD_FILE:
external: true
#list of services
services:
mongo1:
<<: *mongodb
deploy:
placement:
constraints:
- node.labels.volume == True
- node.labels.mongo.replica == 1
mongo2:
<<: *mongodb
deploy:
placement:
constraints:
- node.labels.volume == True
- node.labels.mongo.replica == 2
mongo3:
<<: *mongodb
deploy:
placement:
constraints:
- node.labels.volume == True
- node.labels.mongo.replica == 3