-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdocker-compose.common.yml
More file actions
180 lines (160 loc) · 5.18 KB
/
docker-compose.common.yml
File metadata and controls
180 lines (160 loc) · 5.18 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
174
175
176
177
178
179
180
version: '3.7'
x-shared-constants: &shared-constants-volume
volumes:
- type: bind
source: ./shared-constants
target: /usr/local/shared-constants
read_only: true
x-multi-service-backend: &multi-service-backend
<<: *shared-constants-volume
build:
context: ./services/backend-api
depends_on:
- postgres-main
- redis-main
restart: unless-stopped
environment:
- RUBY_ENV=production
- POSTGRES_HOST=postgres-main
- POSTGRES_DB=${POSTGRES_MAIN_DB}
- POSTGRES_USER=${POSTGRES_MAIN_USER}
- POSTGRES_PASSWORD=${POSTGRES_MAIN_PASSWORD}
- RABBITMQ_ERLANG_COOKIE
- RABBITMQ_DEFAULT_USER
- RABBITMQ_DEFAULT_PASS
services:
traefik-gateway:
image: traefik:v1.7.16-alpine
volumes:
- ./services/traefik-gateway:/etc/traefik
- /var/run/docker.sock:/var/run/docker.sock # this gives Traefik access to Docker runtime data including the config-related labels used below
restart: always
depends_on:
- passportjs-auth
ports: [ "80:80" ]
frontend-web:
<<: *shared-constants-volume
build:
context: ./services/frontend-web
ports: [ "8080:8080" ]
labels:
# "skipAuth" and "webDefault" are segment names we define for routing rules
- "traefik.enable=true"
- "traefik.skipAuth.priority=20"
- "traefik.skipAuth.frontend.rule=PathPrefix:/static/,/assets/,/favicon."
- "traefik.webDefault.priority=10"
- "traefik.webDefault.frontend.rule=PathPrefix:/"
- "traefik.webDefault.frontend.auth.forward.address=${INTERNAL_AUTH_CHECK}"
- "traefik.webDefault.frontend.auth.forward.authResponseHeaders=${INTERNAL_AUTH_HEADERS}"
restart: unless-stopped
environment:
- WEBSTACK_HOST
- WEBSTACK_PROTOCOL
- WEBSOCKET_WEBSTACK_HOST
- NODE_ENV=production
backend-api:
<<: *multi-service-backend
ports: [ "3000:3000" ]
labels:
- "traefik.enable=true"
- "traefik.backendApi.priority=50"
- "traefik.backendApi.frontend.rule=PathPrefix:/api/,/guest/api/"
- "traefik.backendApi.frontend.auth.forward.address=${INTERNAL_AUTH_CHECK}"
- "traefik.backendApi.frontend.auth.forward.authResponseHeaders=${INTERNAL_AUTH_HEADERS}"
command: [ "bundle", "exec", "puma", "-p", "3000", "config.ru" ]
background-worker:
<<: *multi-service-backend
labels:
- "traefik.enable=false"
command: [ "/bin/sh", "-c", "./bin/start_background_workers.rb" ]
passportjs-auth:
<<: *shared-constants-volume
build:
context: ./services/passportjs-auth
depends_on:
- redis-main
ports: [ "4001:4001" ]
restart: unless-stopped
environment:
- PASSPORTJS_AUTH_PORT=4001
- NODE_ENV=production
- WEBSTACK_HOST
- WEBSOCKET_WEBSTACK_HOST
- WEBSTACK_PROTOCOL
- AUTH_SESSION_SECRET
- GITHUB_CLIENT_ID
- GITHUB_CLIENT_SECRET
- INTERNAL_AUTH_HEADERS
labels:
- "traefik.enable=true"
- "traefik.frontend.priority=90"
- "traefik.frontend.rule=PathPrefix:/auth/"
command: [ "yarn", "start" ]
websocket-push:
<<: *shared-constants-volume
build:
context: ./services/websocket-push
ports: [ "8001:8001" ]
depends_on:
- redis-main
command: [ "yarn", "start" ]
environment:
- WEBSOCKET_PUSH_PORT=8001
- NODE_ENV=production
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.websocketPush.priority=40"
- "traefik.websocketPush.frontend.rule=PathPrefix:/server_notifications/"
- "traefik.websocketPush.frontend.auth.forward.address=${INTERNAL_AUTH_CHECK}"
- "traefik.websocketPush.frontend.auth.forward.authResponseHeaders=${INTERNAL_AUTH_HEADERS}"
- "traefik.backend.loadbalancer.stickiness=true"
- "traefik.backend.loadbalancer.stickiness.cookieName=websocket_push"
redis-main:
build:
context: ./services/redis-main
ports: [ "6379:6379" ]
volumes:
- type: bind
source: ./mounted-volumes/redis-main
target: /data
# "consistency"for macosx host/container file sharing. "delegated" means container is authoritative. (Use "cached" for source code.)
consistency: delegated
restart: always
labels:
- "traefik.enable=false"
postgres-main:
image: postgres:11.3-alpine
ports: [ "5432:5432"]
volumes:
- type: bind
source: ./mounted-volumes/postgres-main
target: /var/lib/postgresql/data
consistency: delegated
environment:
- POSTGRES_DB=${POSTGRES_MAIN_DB}
- POSTGRES_USER=${POSTGRES_MAIN_USER}
- POSTGRES_PASSWORD=${POSTGRES_MAIN_PASSWORD}
restart: always
labels:
- "traefik.enable=false"
rabbitmq-broker:
build:
context: ./services/rabbitmq-broker
ports:
- "5672:5672"
hostname: rabbitmq-broker
container_name: rabbitmq-broker
volumes:
- type: bind
source: ./mounted-volumes/rabbitmq-broker
target: /var/lib/rabbitmq
consistency: delegated
environment:
- RABBITMQ_NODENAME=rabbit@rabbitmq-broker
- RABBITMQ_ERLANG_COOKIE
- RABBITMQ_DEFAULT_USER
- RABBITMQ_DEFAULT_PASS
restart: always
labels:
- "traefik.enable=false"