Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
182 lines (175 loc) · 4.73 KB
/
Copy pathcompose.yaml
File metadata and controls
182 lines (175 loc) · 4.73 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
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
name: waitqueue
services:
mysql:
image: mysql:8.4.11
restart: unless-stopped
environment:
MYSQL_DATABASE: ${DB_DATABASE:-waitqueue}
MYSQL_USER: ${DB_USER:-waitqueue}
MYSQL_PASSWORD: ${DB_PASSWORD:-waitqueue-local-password}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-waitqueue-local-root-password}
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_bin
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -p\"$${MYSQL_ROOT_PASSWORD}\" --silent"]
interval: 5s
timeout: 5s
retries: 20
start_period: 20s
stop_grace_period: 30s
redis:
image: redis:7.4.10-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
stop_grace_period: 15s
migrate:
build:
context: .
dockerfile: Dockerfile
target: migrate
environment: &api-environment
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: ${DB_DATABASE:-waitqueue}
DB_USER: ${DB_USER:-waitqueue}
DB_PASSWORD: ${DB_PASSWORD:-waitqueue-local-password}
REDIS_HOST: redis
REDIS_PORT: 6379
CHECK_TASK_DIFF_CRON: ${CHECK_TASK_DIFF_CRON:-0 * * * * *}
CRON_TIMEZONE: ${CRON_TIMEZONE:-Asia/Shanghai}
HOOK_TIMEOUT_MS: ${HOOK_TIMEOUT_MS:-10000}
TASK_CLAIM_LEASE_MS: ${TASK_CLAIM_LEASE_MS:-60000}
TASK_MAX_RETRIES: ${TASK_MAX_RETRIES:-5}
TASK_RETRY_BASE_DELAY_MS: ${TASK_RETRY_BASE_DELAY_MS:-1000}
TASK_RETRY_MAX_DELAY_MS: ${TASK_RETRY_MAX_DELAY_MS:-60000}
depends_on:
mysql:
condition: service_healthy
restart: "no"
init: true
read_only: true
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
api:
build:
context: .
dockerfile: Dockerfile
target: api
restart: unless-stopped
environment:
<<: *api-environment
APP_PORT: 3000
WAITQUEUE_API_TOKEN: ${WAITQUEUE_API_TOKEN:-}
HOOK_URL_ALLOWLIST: ${HOOK_URL_ALLOWLIST:-}
HOOK_URL_ALLOW_PRIVATE: ${HOOK_URL_ALLOW_PRIVATE:-false}
REQUEST_BODY_LIMIT_BYTES: ${REQUEST_BODY_LIMIT_BYTES:-32768}
RATE_LIMIT_MAX_REQUESTS: ${RATE_LIMIT_MAX_REQUESTS:-0}
RATE_LIMIT_WINDOW_MS: ${RATE_LIMIT_WINDOW_MS:-60000}
ports:
- "${BIND_ADDRESS:-127.0.0.1}:${API_PORT:-3000}:3000"
depends_on:
migrate:
condition: service_completed_successfully
redis:
condition: service_healthy
healthcheck:
test:
- CMD
- node
- -e
- "fetch('http://127.0.0.1:3000/health/ready').then((response) => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
init: true
read_only: true
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
stop_grace_period: 20s
dashboard:
build:
context: .
dockerfile: Dockerfile
target: dashboard
restart: unless-stopped
environment:
WAITQUEUE_API_URL: http://api:3000
WAITQUEUE_API_TOKEN: ${WAITQUEUE_API_TOKEN:-}
DASHBOARD_ALLOWED_HOSTS: ${DASHBOARD_ALLOWED_HOSTS:-127.0.0.1,localhost,[::1]}
PORT: 3001
HOSTNAME: 0.0.0.0
ports:
- "${BIND_ADDRESS:-127.0.0.1}:${DASHBOARD_PORT:-3001}:3001"
depends_on:
api:
condition: service_healthy
healthcheck:
test:
- CMD
- node
- -e
- "fetch('http://127.0.0.1:3001/').then((response) => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
init: true
read_only: true
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
stop_grace_period: 20s
mock-hook:
profiles: ["demo"]
build:
context: .
dockerfile: Dockerfile
target: mock-hook
environment:
MOCK_HOOK_HOST: 0.0.0.0
MOCK_HOOK_PORT: 3101
ports:
- "${BIND_ADDRESS:-127.0.0.1}:${MOCK_HOOK_PORT:-3101}:3101"
healthcheck:
test:
- CMD
- node
- -e
- "fetch('http://127.0.0.1:3101/health').then((response) => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
init: true
read_only: true
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
volumes:
mysql-data:
redis-data: