Repository navigation
Expand file tree
/
Copy pathdocker-compose.staging.yml
More file actions
106 lines (100 loc) · 2.46 KB
/
Copy pathdocker-compose.staging.yml
File metadata and controls
106 lines (100 loc) · 2.46 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
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
image: ${REGISTRY:-ghcr.io}/${IMAGE_NAME:-yuciferr/task-management}:staging
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
environment:
- NODE_ENV=staging
- PORT=${PORT:-3000}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB:-task_management_staging}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD}
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:${PORT:-3000}/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 30s
networks:
- frontend
- backend
postgres:
image: postgres:14-alpine
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB:-task_management_staging}
volumes:
- postgres_staging_data:/var/lib/postgresql/data
deploy:
placement:
constraints: [node.role == manager]
endpoint_mode: dnsrr
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- backend
redis:
image: redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD}
volumes:
- redis_staging_data:/data
deploy:
placement:
constraints: [node.role == manager]
endpoint_mode: dnsrr
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- backend
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/staging/nginx.staging.conf:/etc/nginx/nginx.conf:ro
- ./nginx/staging/certs:/etc/nginx/certs:ro
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 10s
order: start-first
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 30s
timeout: 3s
retries: 3
networks:
- frontend
volumes:
postgres_staging_data:
driver: local
redis_staging_data:
driver: local
networks:
frontend:
driver: overlay
backend:
driver: overlay
internal: true