-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose.yml
253 lines (253 loc) · 11.9 KB
/
docker-compose.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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
version: '2'
services:
# API Services
cart:
build:
context: .
dockerfile: ./api/cart/Dockerfile
networks:
- web
- backend
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-cart.rule=PathPrefix(`/api/cart`)"
- "traefik.http.routers.microservice-cart.entrypoints=web"
- "traefik.http.routers.microservice-cart.middlewares=microservice-cart-stripprefix,microservice-cart-ratelimit"
- "traefik.http.middlewares.microservice-cart-stripprefix.stripprefix.prefixes=/api/cart"
- "traefik.http.middlewares.microservice-cart-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-cart-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-cart.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-cart.loadbalancer.healthcheck.interval=30s"
content:
build:
context: .
dockerfile: ./api/content/Dockerfile
networks:
- web
environment:
GHOST_KEY: "${GHOST_KEY}"
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-content.rule=PathPrefix(`/api/content`)"
- "traefik.http.routers.microservice-content.entrypoints=web"
- "traefik.http.routers.microservice-content.middlewares=microservice-content-stripprefix,microservice-content-ratelimit"
- "traefik.http.middlewares.microservice-content-stripprefix.stripprefix.prefixes=/api/content"
- "traefik.http.middlewares.microservice-content-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-content-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-content.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-content.loadbalancer.healthcheck.interval=30s"
product:
build:
context: .
dockerfile: ./api/product/Dockerfile
networks:
- web
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-product.rule=PathPrefix(`/api/product`)"
- "traefik.http.routers.microservice-product.entrypoints=web"
- "traefik.http.routers.microservice-product.middlewares=microservice-product-stripprefix,microservice-product-ratelimit"
- "traefik.http.middlewares.microservice-product-stripprefix.stripprefix.prefixes=/api/product"
- "traefik.http.middlewares.microservice-product-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-product-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-product.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-product.loadbalancer.healthcheck.interval=30s"
search:
build:
context: .
dockerfile: ./api/search/Dockerfile
networks:
- web
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-search.rule=PathPrefix(`/api/search`)"
- "traefik.http.routers.microservice-search.entrypoints=web"
- "traefik.http.routers.microservice-search.middlewares=microservice-search-stripprefix,microservice-search-ratelimit"
- "traefik.http.middlewares.microservice-search-stripprefix.stripprefix.prefixes=/api/search"
- "traefik.http.middlewares.microservice-search-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-search-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-search.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-search.loadbalancer.healthcheck.interval=30s"
stock:
build:
context: .
dockerfile: ./api/stock/Dockerfile
networks:
- web
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-stock.rule=PathPrefix(`/api/stock`)"
- "traefik.http.routers.microservice-stock.entrypoints=web"
- "traefik.http.routers.microservice-stock.middlewares=microservice-stock-stripprefix,microservice-stock-ratelimit"
- "traefik.http.middlewares.microservice-stock-stripprefix.stripprefix.prefixes=/api/stock"
- "traefik.http.middlewares.microservice-stock-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-stock-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-stock.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-stock.loadbalancer.healthcheck.interval=30s"
user:
build:
context: .
dockerfile: ./api/user/Dockerfile
networks:
- web
- backend
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-user.rule=PathPrefix(`/api/user`)"
- "traefik.http.routers.microservice-user.entrypoints=web"
- "traefik.http.routers.microservice-user.middlewares=microservice-user-stripprefix,microservice-user-ratelimit"
- "traefik.http.middlewares.microservice-user-stripprefix.stripprefix.prefixes=/api/user"
- "traefik.http.middlewares.microservice-user-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-user-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-user.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-user.loadbalancer.healthcheck.interval=30s"
wishlist:
build:
context: .
dockerfile: ./api/wishlist/Dockerfile
networks:
- web
- backend
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-wishlist.rule=PathPrefix(`/api/wishlist`)"
- "traefik.http.routers.microservice-wishlist.entrypoints=web"
- "traefik.http.routers.microservice-wishlist.middlewares=microservice-wishlist-stripprefix,microservice-wishlist-ratelimit"
- "traefik.http.middlewares.microservice-wishlist-stripprefix.stripprefix.prefixes=/api/wishlist"
- "traefik.http.middlewares.microservice-wishlist-ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.microservice-wishlist-ratelimit.ratelimit.burst=50"
- "traefik.http.services.microservice-wishlist.loadbalancer.healthcheck.path=/_status"
- "traefik.http.services.microservice-wishlist.loadbalancer.healthcheck.interval=30s"
# App Storage
storage:
build:
context: .
dockerfile: ./storage/Dockerfile
depends_on:
- "redis"
networks:
- backend
- db
# App Redis Database
redis:
image: redis
command: bash -c "redis-server --appendonly yes"
volumes:
- './redis/data:/data'
networks:
- db
# App Assets
assets:
build: ./assets
networks:
- web
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-assets.rule=PathPrefix(`/assets`)"
- "traefik.http.routers.microservice-assets.entrypoints=web"
- "traefik.http.routers.microservice-assets.middlewares=microservice-assets-stripprefix,microservice-assets-compress"
- "traefik.http.middlewares.microservice-assets-stripprefix.stripprefix.prefixes=/assets"
- "traefik.http.middlewares.microservice-assets-compress.compress=true"
# App Pim
pim:
build:
context: .
dockerfile: ./pim/Dockerfile
networks:
- web
volumes:
- './pim/docker-db:/db'
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-pim.rule=PathPrefix(`/pim`)"
- "traefik.http.routers.microservice-pim.entrypoints=web"
- "traefik.http.routers.microservice-pim.middlewares=microservice-pim-redirectregex,microservice-pim-basicauth,microservice-pim-stripprefix,microservice-pim-compress"
- "traefik.http.middlewares.microservice-pim-stripprefix.stripprefix.prefixes=/pim"
- "traefik.http.middlewares.microservice-pim-redirectregex.redirectregex.regex=^https?://.*/pim$$"
- "traefik.http.middlewares.microservice-pim-redirectregex.redirectregex.replacement=/pim/"
- "traefik.http.middlewares.microservice-pim-redirectregex.redirectregex.permanent=true"
- "traefik.http.middlewares.microservice-pim-basicauth.basicauth.realm=ACME Data Editor"
- "traefik.http.middlewares.microservice-pim-basicauth.basicauth.users=user:$$apr1$$dSEBmwZg$$sPFS4pJm83oZclLP0bvsK0" # User: user, Password: password
- "traefik.http.middlewares.microservice-pim-compress.compress=true"
# App CMS
cms:
image: ghost:alpine
networks:
- web
volumes:
- './cms/content:/var/lib/ghost/content'
environment:
url: http://localhost/cms
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-cms.rule=PathPrefix(`/cms`)"
- "traefik.http.routers.microservice-cms.entrypoints=web"
- "traefik.http.routers.microservice-cms.middlewares=microservice-cms-redirectregex,microservice-cms-compress"
- "traefik.http.middlewares.microservice-cms-redirectregex.redirectregex.regex=^https?://.*/cms/?$$"
- "traefik.http.middlewares.microservice-cms-redirectregex.redirectregex.replacement=/cms/ghost/"
- "traefik.http.middlewares.microservice-cms-redirectregex.redirectregex.permanent=true"
- "traefik.http.middlewares.microservice-cms-compress.compress=true"
# App Web UI
web:
build:
context: .
dockerfile: ./web/Dockerfile
networks:
- web
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.microservice-web.rule=PathPrefix(`/`)"
- "traefik.http.routers.microservice-web.entrypoints=web"
- "traefik.http.routers.microservice-web.middlewares=microservice-web-compress"
- "traefik.http.middlewares.microservice-web-compress.compress=true"
- "traefik.http.services.microservice-web.loadbalancer.healthcheck.path=/"
- "traefik.http.services.microservice-web.loadbalancer.healthcheck.interval=30s"
traefik:
image: traefik:v2.5
ports:
- "80:80" # <== http
- "8080:8080" # <== dashboard
command:
###
### https://doc.traefik.io/traefik/reference/static-configuration/cli/
###
## API Settings - https://docs.traefik.io/operations/api/, endpoints - https://docs.traefik.io/operations/api/#endpoints ##
- --api.insecure=true
- --api.dashboard=true
- --api.debug=true
## Log Settings (options: ERROR, DEBUG, PANIC, FATAL, WARN, INFO) - https://docs.traefik.io/observability/logs/ ##
- --log.level=INFO
## Provider Settings - https://docs.traefik.io/providers/docker/#provider-configuration ##
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=web
## Entrypoints Settings - https://docs.traefik.io/routing/entrypoints/#configuration ##
- --entrypoints.web.address=:80
## Traefik Pilot
- --pilot.dashboard=false
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- web
labels:
#### Labels define the behavior and rules of the traefik proxy for this container ####
- "traefik.enable=true"
- "traefik.http.routers.api.service=api@internal"
networks:
web:
external: true
backend:
external: false
db:
external: false