-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.prod.yml
108 lines (101 loc) · 2.3 KB
/
docker-compose.prod.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
# modify from
# mongo-cluster: https://github.com/yeasy/docker-compose-files/blob/master/mongo_cluster/docker-compose.yml
# ngix : https://github.com/socketio/socket.io/blob/master/examples/cluster-nginx/docker-compose.yml
version: '3'
services:
nginx:
build: ./nginx
links:
- api-primary
- api-secondary
ports:
- '3000:80'
api-primary:
build: ./api
command: npm run dev
container_name: api_primary
environment:
NODE_ENV: development
MONGODB_HOST: mongodb://mongo1
EXPRESS_IP: '0.0.0.0'
links:
- 'redis'
- 'mongo1'
expose:
- '3000'
volumes:
- ./api:/home/app/wongwan/api
- /home/app/wongwan/api/node_modules
depends_on:
- mongosetup
- mongo1
- redis
api-secondary:
build: ./api
command: npm run dev
container_name: api_secondary
environment:
NODE_ENV: development
MONGODB_HOST: mongodb://mongo1
EXPRESS_IP: '0.0.0.0'
links:
- 'redis'
- 'mongo1'
expose:
- '3000'
volumes:
- ./api:/home/app/wongwan/api
- /home/app/wongwan/api/node_modules
depends_on:
- mongosetup
- mongo1
- redis
redis:
image: redis:3.0.7
container_name: redis-ww
expose:
- '6379' # Redis default port
volumes:
- ./redisdata:/data
mongo3:
image: mongo:3.4.3
hostname: mongo3
expose:
- "27017"
- "28017"
restart: always
entrypoint: [ "/usr/bin/mongod", "--replSet", "rs", "--rest", "--httpinterface" ]
mongo2:
image: mongo:3.4.3
hostname: mongo2
expose:
- "27017"
- "28017"
restart: always
entrypoint: [ "/usr/bin/mongod", "--replSet", "rs", "--rest", "--httpinterface" ]
mongo1:
image: mongo:3.4.3
hostname: mongo1
expose:
- "27017"
- "28017"
links:
- mongo2:mongo2
- mongo3:mongo3
restart: always
entrypoint: [ "/usr/bin/mongod", "--replSet", "rs", "--rest", "--httpinterface" ]
mongosetup:
image: mongo:3.4.3
container_name: db_ww_prod
links:
- mongo1:mongo1
- mongo2:mongo2
- mongo3:mongo3
volumes:
- ./scripts:/scripts
ports:
- '27017:27017'
restart: always
entrypoint: [ "bash", "/scripts/mongosetup.sh" ]
# volumes:
# db-data: