-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
314 lines (300 loc) · 11.7 KB
/
Copy pathdocker-compose.yml
File metadata and controls
314 lines (300 loc) · 11.7 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# Polyglot demonstration stack. Brings up a standalone Durable Workflow
# server with one MySQL and one Redis instance, plus the workers each
# polyglot scenario needs:
#
# - python-workflow-worker / python_workflow scenario
# Python-authored workflow + Python activities, all polled by a
# single Python worker on `polyglot-python`.
#
# - php-workflow-worker + python-activity-worker / php_to_python scenario
# A real Laravel + Composer-installed durable-workflow PHP SDK
# worker registers the PHP-authored
# `polyglot.php-to-python.PhpToPythonWorkflow` on
# `polyglot-php-to-python`. A separate Python container registers
# the `polyglot.php-to-python.*` activities on the same queue, so
# the workflow's scheduled activities cross the language boundary
# on the wire.
#
# - python-workflow-worker + php-activity-worker / python_to_php scenario
# The Python worker registers a Python-authored workflow on
# `polyglot-python`; that workflow schedules
# `polyglot.python-to-php.*` activities onto
# `polyglot-python-to-php`. A distinct PHP activity worker polls
# that queue, so the reverse activity path also crosses the
# language boundary on the wire.
#
# - php-same-workflow-worker + php-same-activity-worker / php_same_language
# PHP workflow and activity workers share `polyglot-php`, proving the
# PHP runtime still passes the same standalone worker-plane routing
# path used by the cross-language examples.
#
# The repository-root `docker-compose.yml` is intentionally left as the
# single-language Laravel sample. Bring this stack up only when
# exercising polyglot.
x-server-env: &server-env
APP_NAME: "Durable Workflow Server"
APP_ENV: testing
APP_KEY: "base64:dGVzdGluZy1rZXktMTIzNDU2Nzg5MDEyMzQ1Njc4OTA="
APP_DEBUG: "false"
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: durable_workflow
DB_USERNAME: workflow
DB_PASSWORD: workflow
REDIS_HOST: redis
QUEUE_CONNECTION: redis
CACHE_STORE: redis
# Keep server-held worker polls below the Python SDK's CI poll HTTP timeout
# so abandoned client-side requests cannot lease tasks after the client has
# already timed out.
DW_WORKER_POLL_TIMEOUT: "3"
WORKFLOW_SERVER_AUTH_DRIVER: token
WORKFLOW_SERVER_AUTH_TOKEN: "test-token"
x-artifact-defaults:
server-image: &durable-server-image "${DURABLE_SERVER_IMAGE:?run ../scripts/resolve-current-artifacts.sh before starting polyglot compose}"
cli-version: &durable-cli-version "${DURABLE_WORKFLOW_CLI_VERSION:?run ../scripts/resolve-current-artifacts.sh before starting polyglot compose}"
python-sdk-version: &durable-python-sdk-version "${DURABLE_WORKFLOW_PYTHON_SDK_VERSION:?run ../scripts/resolve-current-artifacts.sh before starting polyglot compose}"
php-sdk-pin: &durable-php-sdk-pin "${DURABLE_WORKFLOW_PHP_SDK_PIN:-}"
php-sdk-version: &durable-php-sdk-version "${DURABLE_WORKFLOW_PHP_SDK_VERSION:?run ../scripts/resolve-current-artifacts.sh before starting polyglot compose}"
waterline-pin: &durable-waterline-pin "${DURABLE_WORKFLOW_WATERLINE_PIN:-}"
waterline-version: &durable-waterline-version "${DURABLE_WORKFLOW_WATERLINE_VERSION:?run ../scripts/resolve-current-artifacts.sh before starting polyglot compose}"
services:
mysql:
image: mysql:8.0
environment:
MYSQL_DATABASE: durable_workflow
MYSQL_USER: workflow
MYSQL_PASSWORD: workflow
MYSQL_ROOT_PASSWORD: root
tmpfs:
- /var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 3s
timeout: 2s
retries: 30
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 2s
retries: 10
# Server image pin for the published polyglot conformance smoke.
bootstrap:
image: *durable-server-image
command: ["server-bootstrap"]
environment: *server-env
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
server:
image: *durable-server-image
expose:
- "8080"
environment: *server-env
depends_on:
bootstrap:
condition: service_completed_successfully
mysql:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
interval: 5s
timeout: 3s
retries: 30
python-workflow-worker:
build:
context: ./python_workflow
args:
DURABLE_WORKFLOW_PYTHON_SDK_VERSION: *durable-python-sdk-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
DURABLE_WORKFLOW_POLL_TIMEOUT_SECONDS: "5"
POLYGLOT_PY_TASK_QUEUE: polyglot-python
POLYGLOT_PY2PHP_TASK_QUEUE: polyglot-python-to-php
depends_on:
server:
condition: service_healthy
command: ["python", "workflow.py"]
python-activity-worker:
build:
context: ./python_worker
args:
DURABLE_WORKFLOW_CLI_VERSION: *durable-cli-version
DURABLE_WORKFLOW_PYTHON_SDK_VERSION: *durable-python-sdk-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
DURABLE_WORKFLOW_POLL_TIMEOUT_SECONDS: "5"
POLYGLOT_PHP2PY_TASK_QUEUE: polyglot-php-to-python
depends_on:
server:
condition: service_healthy
php-same-workflow-worker:
build:
context: ..
dockerfile: polyglot/php_worker/Dockerfile
args:
DURABLE_WORKFLOW_PHP_SDK_PIN: *durable-php-sdk-pin
DURABLE_WORKFLOW_PHP_SDK_VERSION: *durable-php-sdk-version
DURABLE_WORKFLOW_WATERLINE_PIN: *durable-waterline-pin
DURABLE_WORKFLOW_WATERLINE_VERSION: *durable-waterline-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
POLYGLOT_PHP_TASK_QUEUE: polyglot-php
depends_on:
server:
condition: service_healthy
command: ["php", "artisan", "app:polyglot-worker", "--task-queue=polyglot-php", "--poll-timeout=5"]
php-same-activity-worker:
build:
context: ..
dockerfile: polyglot/php_worker/Dockerfile
args:
DURABLE_WORKFLOW_PHP_SDK_PIN: *durable-php-sdk-pin
DURABLE_WORKFLOW_PHP_SDK_VERSION: *durable-php-sdk-version
DURABLE_WORKFLOW_WATERLINE_PIN: *durable-waterline-pin
DURABLE_WORKFLOW_WATERLINE_VERSION: *durable-waterline-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
POLYGLOT_PHP_TASK_QUEUE: polyglot-php
depends_on:
server:
condition: service_healthy
command: ["php", "artisan", "app:polyglot-worker", "--mode=activity", "--task-queue=polyglot-php", "--poll-timeout=5"]
php-workflow-worker:
build:
context: ..
dockerfile: polyglot/php_worker/Dockerfile
args:
DURABLE_WORKFLOW_PHP_SDK_PIN: *durable-php-sdk-pin
DURABLE_WORKFLOW_PHP_SDK_VERSION: *durable-php-sdk-version
DURABLE_WORKFLOW_WATERLINE_PIN: *durable-waterline-pin
DURABLE_WORKFLOW_WATERLINE_VERSION: *durable-waterline-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
POLYGLOT_PHP2PY_TASK_QUEUE: polyglot-php-to-python
depends_on:
server:
condition: service_healthy
command: ["php", "artisan", "app:polyglot-worker", "--task-queue=polyglot-php-to-python", "--poll-timeout=5"]
php-activity-worker:
build:
context: ..
dockerfile: polyglot/php_worker/Dockerfile
args:
DURABLE_WORKFLOW_PHP_SDK_PIN: *durable-php-sdk-pin
DURABLE_WORKFLOW_PHP_SDK_VERSION: *durable-php-sdk-version
DURABLE_WORKFLOW_WATERLINE_PIN: *durable-waterline-pin
DURABLE_WORKFLOW_WATERLINE_VERSION: *durable-waterline-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
POLYGLOT_PY2PHP_TASK_QUEUE: polyglot-python-to-php
depends_on:
server:
condition: service_healthy
command: ["php", "artisan", "app:polyglot-worker", "--mode=activity", "--task-queue=polyglot-python-to-php", "--poll-timeout=5"]
waterline:
build:
context: ..
dockerfile: polyglot/php_worker/Dockerfile
args:
DURABLE_WORKFLOW_PHP_SDK_PIN: *durable-php-sdk-pin
DURABLE_WORKFLOW_PHP_SDK_VERSION: *durable-php-sdk-version
DURABLE_WORKFLOW_WATERLINE_PIN: *durable-waterline-pin
DURABLE_WORKFLOW_WATERLINE_VERSION: *durable-waterline-version
environment:
APP_NAME: "Durable Workflow Waterline"
APP_ENV: testing
APP_KEY: "base64:dGVzdGluZy1rZXktMTIzNDU2Nzg5MDEyMzQ1Njc4OTA="
APP_DEBUG: "false"
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: durable_workflow
DB_USERNAME: workflow
DB_PASSWORD: workflow
SHARED_DB_HOST: mysql
SHARED_DB_PORT: 3306
SHARED_DB_DATABASE: durable_workflow
SHARED_DB_USERNAME: workflow
SHARED_DB_PASSWORD: workflow
REDIS_HOST: redis
QUEUE_CONNECTION: redis
CACHE_STORE: redis
WATERLINE_ENGINE_SOURCE: v2
WATERLINE_NAMESPACE: default
WATERLINE_PATH: waterline
WATERLINE_ALLOW_UNAUTHENTICATED: "true"
expose:
- "8081"
depends_on:
server:
condition: service_healthy
mysql:
condition: service_healthy
command: ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8081"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/waterline/api/v2/health"]
interval: 5s
timeout: 3s
retries: 30
smoke:
build:
context: ./python_worker
args:
DURABLE_WORKFLOW_CLI_VERSION: *durable-cli-version
DURABLE_WORKFLOW_PYTHON_SDK_VERSION: *durable-python-sdk-version
environment:
DURABLE_WORKFLOW_SERVER_URL: "http://server:8080"
DURABLE_WORKFLOW_AUTH_TOKEN: "test-token"
DURABLE_WORKFLOW_NAMESPACE: default
DURABLE_SERVER_IMAGE: *durable-server-image
DURABLE_WORKFLOW_CLI_VERSION: *durable-cli-version
DURABLE_WORKFLOW_CLI_PIN: "${DURABLE_WORKFLOW_CLI_PIN:-}"
DURABLE_WORKFLOW_PYTHON_SDK_VERSION: *durable-python-sdk-version
DURABLE_WORKFLOW_PHP_SDK_PIN: *durable-php-sdk-pin
DURABLE_WORKFLOW_PHP_SDK_VERSION: *durable-php-sdk-version
DURABLE_WORKFLOW_WATERLINE_PIN: *durable-waterline-pin
DURABLE_WORKFLOW_WATERLINE_VERSION: *durable-waterline-version
DURABLE_WORKFLOW_WATERLINE_URL: "http://waterline:8081/waterline"
DURABLE_WORKFLOW_ARTIFACT_PROBE_URL: "http://waterline:8081/polyglot/conformance/artifacts"
POLYGLOT_PY_TASK_QUEUE: polyglot-python
POLYGLOT_PHP_TASK_QUEUE: polyglot-php
POLYGLOT_PHP2PY_TASK_QUEUE: polyglot-php-to-python
POLYGLOT_PY2PHP_TASK_QUEUE: polyglot-python-to-php
depends_on:
server:
condition: service_healthy
python-activity-worker:
condition: service_started
php-same-workflow-worker:
condition: service_started
php-same-activity-worker:
condition: service_started
php-workflow-worker:
condition: service_started
php-activity-worker:
condition: service_started
python-workflow-worker:
condition: service_started
waterline:
condition: service_healthy
command: ["bash", "/app/scripts/smoke.sh"]