-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathdocker-compose.prefect.yaml
More file actions
74 lines (70 loc) · 2.45 KB
/
Copy pathdocker-compose.prefect.yaml
File metadata and controls
74 lines (70 loc) · 2.45 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
# Development / demo topology for DataPusher+ on Prefect.
#
# Brings up:
# * postgres — shared by Prefect server AND CKAN datastore in dev.
# * prefect-server — UI on http://localhost:4200, no Redis dependency.
# * prefect-worker — process worker subscribed to the ``datapusher-plus``
# work pool.
#
# Operators in production should run their own Postgres and either point
# Prefect at it or use Prefect Cloud. This compose file is for getting
# the stack up locally in one command:
#
# docker compose -f docker-compose.prefect.yaml up
services:
postgres:
image: postgres:14
environment:
POSTGRES_USER: prefect
POSTGRES_PASSWORD: prefect
POSTGRES_DB: prefect
volumes:
- prefect-postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U prefect"]
interval: 5s
timeout: 5s
retries: 5
prefect-server:
image: prefecthq/prefect:3-latest
depends_on:
postgres:
condition: service_healthy
environment:
PREFECT_API_DATABASE_CONNECTION_URL: postgresql+asyncpg://prefect:prefect@postgres:5432/prefect
PREFECT_SERVER_API_HOST: 0.0.0.0
PREFECT_SERVER_UI_API_URL: http://localhost:4200/api
command: prefect server start
ports:
- "4200:4200"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request as u; u.urlopen('http://localhost:4200/api/health', timeout=1)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
prefect-worker:
# The worker image must have CKAN + datapusher-plus installed so it can
# import the flow entrypoint and reach the datastore. In production
# this is a custom image; for the dev compose we bind-mount the source
# tree and install editable so changes are picked up on worker restart.
image: prefecthq/prefect:3-latest
depends_on:
prefect-server:
condition: service_healthy
environment:
PREFECT_API_URL: http://prefect-server:4200/api
# CKAN config must be reachable to the worker — point this at the
# operator's ckan.ini. The dev compose assumes ./ckan.ini is bind-
# mounted into the worker.
CKAN_INI: /etc/ckan/default/ckan.ini
volumes:
- ./:/opt/datapusher-plus
command: >
bash -c "
pip install -e /opt/datapusher-plus &&
prefect worker start --pool datapusher-plus
"
restart: on-failure
volumes:
prefect-postgres: