-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.production.yml
83 lines (77 loc) · 2.3 KB
/
docker-compose.production.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.9'
services:
api:
image: ${CONTAINER_IMAGE:-backend}
volumes:
- uploads_volume:/usr/src/app/uploads
environment:
PORT: 3000
DB_HOST: db
DB_USER: nestserver
DB_NAME: say_dapp
DB_PASS_FILE: /run/secrets/postgres-password
secrets:
- postgres-password
networks:
- default
- traefik-public
configs:
- source: nest-config
target: /usr/src/app/.env
deploy:
replicas: 1
update_config:
parallelism: 1
order: start-first
placement:
constraints:
- node.labels.${ENVIRONMENT} == true
mode: replicated
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
- traefik.http.routers.${STACK_NAME}-api-http.entrypoints=http
- traefik.http.routers.${STACK_NAME}-api-http.rule=Host(`${DOMAIN?Variable not set}`)
- traefik.http.routers.${STACK_NAME}-api-http.service=${STACK_NAME}-api
- traefik.http.routers.${STACK_NAME}-api-http.middlewares=https-redirect
- traefik.http.routers.${STACK_NAME}-api.entrypoints=https
- traefik.http.routers.${STACK_NAME}-api.rule=Host(`${DOMAIN?Variable not set}`)
- traefik.http.routers.${STACK_NAME}-api.service=${STACK_NAME}-api
- traefik.http.routers.${STACK_NAME}-api.tls=true
- traefik.http.routers.${STACK_NAME}-api.tls.certresolver=le
- traefik.http.services.${STACK_NAME}-api.loadbalancer.server.port=3000
db:
image: postgres:12
secrets:
- postgres-password
environment:
POSTGRES_DB: say_dapp
POSTGRES_USER: nestserver
POSTGRES_PASSWORD_FILE: /run/secrets/postgres-password
volumes:
- postgres_volume:/var/lib/postgresql/data
deploy:
replicas: 1
update_config:
parallelism: 1
order: stop-first
placement:
constraints:
- node.labels.${ENVIRONMENT} == true
volumes:
postgres_volume:
name: "${STACK_NAME}_postgres_volume"
uploads_volume:
name: "${STACK_NAME}_uploads_volume"
networks:
traefik-public:
external: true
secrets:
postgres-password:
name: ${STACK_NAME}-postgres-password
external: true
configs:
nest-config:
name: ${STACK_NAME}.env
external: true