-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.staging.yml
117 lines (110 loc) · 6.29 KB
/
docker-compose.staging.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
version: "3.3"
services:
proxy:
image: traefik:v2.2
networks:
- ${TRAEFIK_PUBLIC_NETWORK?TRAEFIK_PUBLIC_NETWORK variable not set}
- default
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
- --providers.docker
- --providers.docker.constraints=Label(`traefik.constraint-label-stack`, `${TRAEFIK_TAG?TRAEFIK_TAG variable not set}`)
- --providers.docker.exposedbydefault=false
- --providers.docker.swarmmode
- --accesslog
- --log
- --api
deploy:
placement:
constraints:
- node.role == manager
labels:
- traefik.enable=true
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?TRAEFIK_PUBLIC_NETWORK variable not set}
- traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?TRAEFIK_PUBLIC_TAG variable not set}
- traefik.http.middlewares.${STACK_NAME?STACK_NAME variable not set}-https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.${STACK_NAME?STACK_NAME variable not set}-https-redirect.redirectscheme.permanent=true
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-http.rule=Host(`${DOMAIN?DOMAIN variable not set}`) || Host(`www.${DOMAIN?DOMAIN variable not set}`)
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-http.entrypoints=http
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-https.rule=Host(`${DOMAIN?DOMAIN variable not set}`) || Host(`www.${DOMAIN?DOMAIN variable not set}`)
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-https.entrypoints=https
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-https.tls=true
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-https.tls.certresolver=le
- traefik.http.services.${STACK_NAME?STACK_NAME variable not set}-proxy.loadbalancer.server.port=80
- traefik.http.middlewares.${STACK_NAME?STACK_NAME variable not set}-www-redirect.redirectregex.regex=^https?://(www.)?(${DOMAIN?DOMAIN variable not set})/(.*)
- traefik.http.middlewares.${STACK_NAME?STACK_NAME variable not set}-www-redirect.redirectregex.replacement=https://${DOMAIN?DOMAIN variable not set}/$${3}
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-https.middlewares=${STACK_NAME?STACK_NAME variable not set}-www-redirect
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-proxy-http.middlewares=${STACK_NAME?STACK_NAME variable not set}-www-redirect,${STACK_NAME?STACK_NAME variable not set}-https-redirect
backend:
image: dicery-backend_backend:latest
build:
context: .
args:
INSTALL_DEV: ${INSTALL_DEV-false}
depends_on:
- db
env_file:
- .env
environment:
- MODULE_NAME=dicery_backend.main
- SERVER_NAME=${DOMAIN?DOMAIN variable not set}
- SERVER_HOST=https://${DOMAIN?DOMAIN variable not set}
command: /start-reload.sh
deploy:
labels:
- traefik.enable=true
- traefik.constraint-label-stack=${TRAEFIK_TAG?TRAEFIK_TAG variable not set}
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-backend-http.rule=PathPrefix(`/`)
- traefik.http.services.${STACK_NAME?STACK_NAME variable not set}-backend.loadbalancer.server.port=80
db:
image: postgres:12
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
command:
- postgres
# the following lines tell pg server to adjust the TCP keepalive settings explicitly
# instead of reading from the container default, which is likely idle=7200 (seconds).
# The default value in the container is usually much larger than docker-swarm's IPVS default,
# which is 900. (And this is the culprit of the connection will be closed after ~15mins)
- -c
- 'tcp_keepalives_idle=600'
- -c
- 'tcp_keepalives_interval=30'
- -c
- 'tcp_keepalives_count=10'
deploy:
placement:
constraints:
- node.labels.${STACK_NAME?STACK_NAME variable not set}.app-db-data == true
pgadmin:
image: dpage/pgadmin4
networks:
- ${TRAEFIK_PUBLIC_NETWORK?TRAEFIK_PUBLIC_NETWORK variable not set}
- default
depends_on:
- db
env_file:
- .env
deploy:
labels:
- traefik.enable=true
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?TRAEFIK_PUBLIC_NETWORK variable not set}
- traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?TRAEFIK_PUBLIC_TAG variable not set}
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-http.rule=Host(`pgadmin.${DOMAIN?DOMAIN variable not set}`)
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-http.entrypoints=http
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-http.middlewares=${STACK_NAME?STACK_NAME variable not set}-https-redirect
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-https.rule=Host(`pgadmin.${DOMAIN?DOMAIN variable not set}`)
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-https.entrypoints=https
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-https.tls=true
- traefik.http.routers.${STACK_NAME?STACK_NAME variable not set}-pgadmin-https.tls.certresolver=le
- traefik.http.services.${STACK_NAME?STACK_NAME variable not set}-pgadmin.loadbalancer.server.port=5050
volumes:
app-db-data:
networks:
traefik-public:
external: ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-true}