-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
105 lines (95 loc) · 2.59 KB
/
docker-compose.yml
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
services:
prefect-server:
image: prefecthq/prefect:2.20-python3.12
ports:
- "4200:4200"
networks:
- prefect-network
environment:
- PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://prefect:admin@postgres:5432/prefect
healthcheck:
test: echo "ready"
interval: 5s
retries: 5
start_period: 5s
timeout: 5s
depends_on:
postgres:
condition: service_healthy
command: ["prefect", "server", "start", "--host", "0.0.0.0"]
mongodb:
image: mongo:latest
ports:
- "27017:27017"
networks:
- prefect-network
volumes:
- type: bind
source: ./db/mongo_data
target: /data/db
prefect-agent:
image: sunbeam-prefect-agent:latest
volumes:
- ./fs_data:/app/fs_data
build:
context: ./pipeline
dockerfile: ./Dockerfile
additional_contexts:
- root=.
depends_on:
prefect-server:
condition: service_healthy
networks:
- prefect-network
environment:
- PREFECT_API_URL=http://172.17.0.1:4200/api
- PREFECT_API_DATABASE_CONNECTION_URL="postgresql+asyncpg://prefect:yourpassword@postgres:5432/prefect"
env_file: "./pipeline/.env"
# Note: the last command blocks (so insert any additonal commands before the last one!)
command: >
sh -c "export $(cat .env | xargs) &&
poetry run prefect work-pool create --type process default-work-pool --overwrite &&
poetry run prefect worker start --pool default-work-pool"
postgres:
image: postgres:13
environment:
POSTGRES_DB: prefect
POSTGRES_USER: prefect
POSTGRES_PASSWORD: admin
ports:
- "5432:5432"
restart: always
networks:
- prefect-network
volumes:
- type: bind
source: ./db/pg_data
target: /var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U prefect -d prefect"]
interval: 10s
retries: 5
start_period: 30s
timeout: 5s
external_api:
image: sunbeam-external-api:latest
build:
context: ./external
dockerfile: ./Dockerfile
additional_contexts:
- root=.
networks:
- prefect-network
ports:
- "8080:8080"
environment:
- PREFECT_API_URL=http://172.17.0.1:4200/api
- PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://prefect:yourpassword@postgres:5432/prefect
depends_on:
prefect-server:
condition: service_healthy
command: >
sh -c "poetry run python external.py"
networks:
prefect-network:
driver: bridge