-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
83 lines (77 loc) · 2.55 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
version: "3.8"
services:
db:
image: postgres:latest
restart: always
networks:
- main
volumes:
- ./data:/var/lib/postgresql/data
adminer:
networks:
- main
image: adminer
ports:
- 8080:8080
traefik:
image: traefik:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "80:80"
# Traefik has to be in all networks in order to resolve properly the containers it is trying to contact
networks:
- main
core_api:
restart: always
# deploy:
# mode: replicated
# replicas: 2
build:
context: .
dockerfile: ./core_api/Dockerfile
args:
NPM_TOKEN: ${NPM_TOKEN}
networks:
- main
- database
depends_on:
- db
labels:
- traefik.enable=true
# https://community.traefik.io/t/solved-strange-504-gateway-timeout-behaviour/10573
# TODO: Verify if its efficient...
- traefik.docker.network=composite_main
- traefik.http.services.core_api.loadbalancer.server.port=3002
- traefik.http.services.core_api.loadBalancer.sticky.cookie.name=server_id
- traefik.http.services.core_api.loadBalancer.sticky.cookie.httpOnly=true
- traefik.http.middlewares.core_api_middleware.headers.accessControlAllowCredentials=true
- traefik.http.middlewares.core_api_middleware.headers.accessControlAllowHeaders=Content-Type,Authorization,baggage,sentry-trace
- traefik.http.middlewares.core_api_middleware.headers.accessControlAllowMethods=GET,POST,DELETE,PATCH
- traefik.http.routers.core_api.rule=Host(`core-api.composite`)
- traefik.http.middlewares.core_api_middleware.headers.accesscontrolalloworiginlist=http://front.composite
- traefik.http.routers.core_api.middlewares=core_api_middleware
front:
restart: always
build:
context: .
dockerfile: ./front/Dockerfile
args:
NPM_TOKEN: ${NPM_TOKEN}
env_file:
- ./front/.env
networks:
- main
labels:
- traefik.enable=true
- traefik.http.services.front.loadbalancer.server.port=3000
- traefik.http.routers.front.rule=Host(`front.composite`)
networks:
main:
name: composite_main
database:
name: composite_database
# Note to myself in order to stop losing precious life time:
# With the directive "traefik.docker.network=", I should not reference the network alias,
# like it is done to associate service and network with the docker-compose spec.
# I should reference the network name, the one that is printed when you do "docker network ls"