forked from 3cqs-coder/SymBot
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-stack.yml
More file actions
173 lines (163 loc) · 4.61 KB
/
docker-compose-stack.yml
File metadata and controls
173 lines (163 loc) · 4.61 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
version: '3.9'
x-logging:
&default-logging
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
tag: "{{.Name}}"
services:
database:
image: mongo:${MONGO_VERSION}
entrypoint: [ "/usr/bin/mongod", "--keyFile", "/run/secrets/mongo-keyfile", "--replSet", "${REPLICASET_NAME}", "--dbpath", "/data/db", "--bind_ip", "0.0.0.0"]
secrets:
- source: mongo-keyfile
mode: 0400
configs:
- mongo-healthcheck
volumes:
- mongodata:/data/db:rw
- mongoconfigdb:/data/configdb:rw
networks:
- backend
healthcheck:
test: ["CMD", "bash", "/mongo-healthcheck"]
interval: 1m
timeout: 15s
retries: 3
start_period: 10s
deploy:
mode: global
restart_policy:
condition: on-failure
update_config:
parallelism: 1
delay: 1m30s
monitor: 15s
logging: *default-logging
dbcontroller:
image: jackietreehorn/mongo-replica-ctrl:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
OVERLAY_NETWORK_NAME: ${BACKEND_NETWORK_NAME}
MONGO_SERVICE_NAME: ${MONGO_SERVICE_URI}
REPLICASET_NAME: ${REPLICASET_NAME}
MONGO_PORT: 27017
MONGO_ROOT_USERNAME: ${MONGO_ROOT_USERNAME}
MONGO_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD}
INITDB_DATABASE: ${INITDB_DATABASE}
INITDB_USER: ${INITDB_USER}
INITDB_PASSWORD: ${INITDB_PASSWORD}
DEBUG: 0
entrypoint: python /src/db-replica_ctrl.py
networks:
- backend
depends_on:
- database
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role==manager]
restart_policy:
condition: on-failure
update_config:
parallelism: 1
delay: 1m
monitor: 10s
logging: *default-logging
web:
image: jackietreehorn/symbot:noconfig
environment:
SYMBOT_DB_USER: ${INITDB_USER} # future use in app.json "mongo_db_url"
SYMBOT_DB_PASSWORD: ${INITDB_PASSWORD} # future use in app.json "mongo_db_url"
SYMBOT_DB: ${INITDB_DATABASE} # future use in app.json "mongo_db_url"
REPLICASET_NAME: ${REPLICASET_NAME} # future use in app.json "mongo_db_url"
MONGODB_URI: mongodb://${INITDB_USER}:${INITDB_PASSWORD}@database/${INITDB_DATABASE}?replicaSet=${REPLICASET_NAME}
depends_on:
- database
- dbcontroller
volumes:
- weblogs:/usr/src/app/logs:rw
# - ../logs:/usr/src/app/logs:rw #shared storage (glusterfs, etc)
networks:
- backend
ports:
- 3000:3000
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
interval: 1m
timeout: 30s
retries: 6
start_period: 10s
deploy:
mode: replicated
restart_policy:
condition: on-failure
replicas: 1
placement:
max_replicas_per_node: 1
update_config:
parallelism: 1
delay: 1m
monitor: 15s
logging: *default-logging
mongo-express:
image: mongo-express:latest
networks:
- backend
ports:
- 3010:8081
environment:
ME_CONFIG_OPTIONS_EDITORTHEME: "ambiance"
ME_CONFIG_BASICAUTH: "true"
ME_CONFIG_BASICAUTH_USERNAME: ${MONGO_ROOT_USERNAME}
ME_CONFIG_BASICAUTH_PASSWORD: ${MONGO_ROOT_PASSWORD}
ME_CONFIG_MONGODB_ENABLE_ADMIN: "true"
ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_ROOT_USERNAME}
ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_ROOT_PASSWORD}
# ME_CONFIG_MONGODB_SERVER: database
# ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_MONGODB_URL: mongodb://${MONGO_ROOT_USERNAME}:${MONGO_ROOT_PASSWORD}@database:27017?replicaSet=${REPLICASET_NAME}
depends_on:
- web
healthcheck:
test: wget -nv -t1 --spider 'http://${MONGO_ROOT_USERNAME}:${MONGO_ROOT_PASSWORD}@127.0.0.1:8081' || exit 1
interval: 5m
timeout: 30s
retries: 6
start_period: 1m
deploy:
mode: replicated
restart_policy:
condition: on-failure
replicas: 1
placement:
max_replicas_per_node: 1
update_config:
parallelism: 1
delay: 1m
monitor: 15s
logging: *default-logging
configs:
mongo-healthcheck:
file: mongo-healthcheck
secrets:
mongo-keyfile:
external: true
volumes:
# NOTE: Must use 'external' for db volumes so they're not recreated during redeployments
mongodata:
external: true
name: ${STACK_NAME}_mongodata
mongoconfigdb:
external: true
name: ${STACK_NAME}_mongoconfigdb
weblogs:
external: true
name: ${STACK_NAME}_weblogs
networks:
backend:
name: ${BACKEND_NETWORK_NAME}
external: true