-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.small-cluster.yml
More file actions
210 lines (196 loc) · 6.67 KB
/
Copy pathdocker-compose.small-cluster.yml
File metadata and controls
210 lines (196 loc) · 6.67 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: durable-workflow-server-small-cluster
x-server-image: &server-image ${DW_SMALL_CLUSTER_IMAGE:-durable-workflow/server-small-cluster:local}
x-server-build: &server-build
context: .
args:
WORKFLOW_PACKAGE_SOURCE: ${WORKFLOW_PACKAGE_SOURCE:-}
WORKFLOW_PACKAGE_REF: ${WORKFLOW_PACKAGE_REF:-}
WORKFLOW_PACKAGE_COMMIT: ${WORKFLOW_PACKAGE_COMMIT:-}
x-server-environment: &server-environment
APP_NAME: "Durable Workflow Server"
APP_ENV: testing
APP_VERSION: ${APP_VERSION:-2.4.40}
APP_DEBUG: "false"
DW_SERVER_KEY: ${DW_SERVER_KEY:-base64:5Zt4nUhlCm3DD0nLXZJQdHiwPfb56yGo9gNV/g3jYbY=}
DB_CONNECTION: ${DW_SMALL_CLUSTER_DB:-mysql}
DB_HOST: ${DW_SMALL_CLUSTER_DB_HOST:-mysql}
DB_PORT: ${DW_SMALL_CLUSTER_DB_PORT:-3306}
DB_DATABASE: ${DB_DATABASE:-durable_workflow}
DB_USERNAME: ${DB_USERNAME:-workflow}
DB_PASSWORD: ${DB_PASSWORD:-workflow}
REDIS_HOST: redis
QUEUE_CONNECTION: redis
CACHE_STORE: redis
DW_AUTH_DRIVER: token
DW_AUTH_TOKEN: ${DW_AUTH_TOKEN:-small-cluster-token}
DW_PRINCIPAL_TOKENS: ${DW_PRINCIPAL_TOKENS:-${WORKFLOW_SERVER_PRINCIPAL_TOKENS:-}}
DW_RUNTIME_CREDENTIALS_ENABLED: ${DW_RUNTIME_CREDENTIALS_ENABLED:-${WORKFLOW_SERVER_RUNTIME_CREDENTIALS_ENABLED:-false}}
DW_AUTH_BACKWARD_COMPATIBLE: "true"
DW_EXTERNAL_PAYLOAD_S3_ACCESS_KEY_ID: ${DW_EXTERNAL_PAYLOAD_S3_ACCESS_KEY_ID:-}
DW_EXTERNAL_PAYLOAD_S3_SECRET_ACCESS_KEY: ${DW_EXTERNAL_PAYLOAD_S3_SECRET_ACCESS_KEY:-}
DW_EXTERNAL_PAYLOAD_S3_SESSION_TOKEN: ${DW_EXTERNAL_PAYLOAD_S3_SESSION_TOKEN:-}
DW_EXTERNAL_PAYLOAD_S3_REGION: ${DW_EXTERNAL_PAYLOAD_S3_REGION:-us-east-1}
DW_EXTERNAL_PAYLOAD_S3_BUCKET: ${DW_EXTERNAL_PAYLOAD_S3_BUCKET:-}
DW_EXTERNAL_PAYLOAD_S3_ENDPOINT: ${DW_EXTERNAL_PAYLOAD_S3_ENDPOINT:-}
DW_EXTERNAL_PAYLOAD_S3_USE_PATH_STYLE_ENDPOINT: ${DW_EXTERNAL_PAYLOAD_S3_USE_PATH_STYLE_ENDPOINT:-false}
DW_WORKER_POLL_TIMEOUT: "1"
DW_WORKER_POLL_INTERVAL_MS: "100"
DW_ENV_AUDIT_STRICT: "1"
services:
bootstrap:
image: *server-image
build: *server-build
command: ["server-bootstrap"]
healthcheck:
disable: true
environment:
<<: *server-environment
DW_SERVER_ID: bootstrap
depends_on:
redis:
condition: service_healthy
server-a:
image: *server-image
build: *server-build
ports:
- "${DW_SMALL_CLUSTER_SERVER_A_PORT:-18084}:8080"
environment:
<<: *server-environment
DW_SERVER_ID: server-a
DW_SERVER_TOPOLOGY_SHAPE: standalone_server
DW_SERVER_PROCESS_CLASS: server_http_node
depends_on:
bootstrap:
condition: service_completed_successfully
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/ready"]
interval: 10s
timeout: 5s
retries: 6
server-b:
image: *server-image
build: *server-build
ports:
- "${DW_SMALL_CLUSTER_SERVER_B_PORT:-18085}:8080"
environment:
<<: *server-environment
DW_SERVER_ID: server-b
DW_SERVER_TOPOLOGY_SHAPE: standalone_server
DW_SERVER_PROCESS_CLASS: server_http_node
depends_on:
bootstrap:
condition: service_completed_successfully
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/ready"]
interval: 10s
timeout: 5s
retries: 6
queue-worker:
image: *server-image
build: *server-build
command: ["php", "artisan", "queue:work", "redis", "--sleep=1", "--tries=3", "--max-time=3600"]
healthcheck:
test: ["CMD", "server-process-healthcheck", "worker"]
interval: 5s
timeout: 3s
retries: 3
start_period: 5s
restart: unless-stopped
environment:
<<: *server-environment
DW_SERVER_ID: queue-worker
DW_SERVER_TOPOLOGY_SHAPE: standalone_server
DW_SERVER_PROCESS_CLASS: worker_node
depends_on:
bootstrap:
condition: service_completed_successfully
redis:
condition: service_healthy
scheduler:
image: *server-image
build: *server-build
init: true
# Include an unscoped repair pass for remote SDK task queues.
command: >-
sh -c 'while true; do php artisan schedule:evaluate --limit=100 --json; if [ "$$DW_V2_MATCHING_ROLE_QUEUE_WAKE" != "false" ] && [ "$$DW_V2_MATCHING_ROLE_QUEUE_WAKE" != "0" ]; then php artisan workflow:v2:repair-pass --json; fi; php artisan activity:timeout-enforce --limit=100; php artisan external-payloads:cleanup --limit=100 --json; php artisan history:prune --limit=100; sleep 10; done'
healthcheck:
test: ["CMD", "server-process-healthcheck", "scheduler"]
interval: 5s
timeout: 3s
retries: 3
start_period: 5s
environment:
<<: *server-environment
DW_SERVER_ID: scheduler
DW_SERVER_TOPOLOGY_SHAPE: standalone_server
DW_SERVER_PROCESS_CLASS: scheduler_node
depends_on:
bootstrap:
condition: service_completed_successfully
redis:
condition: service_healthy
load-balancer:
image: nginx:1.27-alpine
ports:
- "${DW_SMALL_CLUSTER_LB_PORT:-18086}:8080"
command:
- /bin/sh
- -ec
- |
cat >/etc/nginx/conf.d/default.conf <<'NGINX'
upstream durable_workflow_api {
server server-a:8080;
server server-b:8080;
}
server {
listen 8080;
location / {
proxy_http_version 1.1;
proxy_set_header Host $$host;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
proxy_pass http://durable_workflow_api;
}
}
NGINX
exec nginx -g 'daemon off;'
depends_on:
server-a:
condition: service_healthy
server-b:
condition: service_healthy
mysql:
image: mysql:${MYSQL_VERSION:-8.0}
profiles: ["mysql"]
environment:
MYSQL_DATABASE: ${DB_DATABASE:-durable_workflow}
MYSQL_USER: ${DB_USERNAME:-workflow}
MYSQL_PASSWORD: ${DB_PASSWORD:-workflow}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 5s
timeout: 3s
retries: 30
pgsql:
image: postgres:${POSTGRES_VERSION:-16-alpine}
profiles: ["pgsql"]
environment:
POSTGRES_DB: ${DB_DATABASE:-durable_workflow}
POSTGRES_USER: ${DB_USERNAME:-workflow}
POSTGRES_PASSWORD: ${DB_PASSWORD:-workflow}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
interval: 5s
timeout: 3s
retries: 30
redis:
image: redis:${REDIS_VERSION:-7-alpine}
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10