-
-
Notifications
You must be signed in to change notification settings - Fork 491
/
docker-stack.yml
45 lines (42 loc) · 1.22 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
version: '3.9'
# a stack-file version of this for running in Swarm services
# Swarm still needs the 3.x version for stacks
services:
node:
# reminder, don't use latest tag in production, use versions created by CI/CD
image: bretfisher/node-docker-good-defaults:latest
ports:
- "80:3000"
environment:
- NODE_ENV=production
- MONGO_USERNAME_FILE=/run/secrets/mongo_root
- MONGO_PASSWORD_FILE=/run/secrets/mongo_root_password
- MONGO_HOSTNAME=mongo
- MONGO_PORT=27017
- MONGO_DATABASE_NAME=example-database
secrets:
- mongo_root
- mongo_root_password
deploy:
replicas: 2
mongo:
image: mongo
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME_FILE=/run/secrets/mongo_root
- MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/mongo_root_password
- MONGO_INITDB_DATABASE=example-database
secrets:
- mongo_root
- mongo_root_password
healthcheck:
test: "[ `echo 'db.runCommand(\"ping\").ok' | mongo localhost/example-database --quiet` ] && echo 0 || echo 1"
interval: 5s
timeout: 5s
retries: 3
secrets:
mongo_root:
external: true
mongo_root_password:
external: true