|
| 1 | +# documentation: https://www.prefect.io/ |
| 2 | +# slogan: Prefect is an orchestration and observability platform that empowers developers to build and scale workflows quickly. |
| 3 | +# tags: workflow, orchestration, data-pipeline, python, automation, data-processing, data-integration, etl |
| 4 | +# logo: svgs/prefect.png |
| 5 | +# port: 4200 |
| 6 | + |
| 7 | +version: "3" |
| 8 | + |
| 9 | +volumes: |
| 10 | + pg_data: |
| 11 | + |
| 12 | +services: |
| 13 | + prefect: |
| 14 | + image: "prefecthq/prefect:3-latest" |
| 15 | + restart: always |
| 16 | + depends_on: |
| 17 | + postgresql: |
| 18 | + condition: service_healthy |
| 19 | + environment: |
| 20 | + - SERVICE_FQDN_PREFECT_4200 |
| 21 | + - PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgresql:5432/${POSTGRES_DB:-prefect} |
| 22 | + - PREFECT_API_KEY=${SERVICE_PASSWORD_APIKEY} |
| 23 | + - PREFECT_EXPERIMENTAL_WARN=true |
| 24 | + - PREFECT_EXPERIMENTAL_ENABLE_SCHEDULE_CONCURRENCY=true |
| 25 | + - PREFECT_RUNNER_SERVER_ENABLE=true |
| 26 | + - PREFECT_DEFAULT_WORK_POOL_NAME=${DEFAULT_POOL_NAME:-default} |
| 27 | + command: |
| 28 | + - prefect |
| 29 | + - server |
| 30 | + - start |
| 31 | + - "--host" |
| 32 | + - 0.0.0.0 |
| 33 | + - "--port" |
| 34 | + - "4200" |
| 35 | + healthcheck: |
| 36 | + test: |
| 37 | + - CMD |
| 38 | + - python |
| 39 | + - "-c" |
| 40 | + - "import requests as r;r.get('http://127.0.0.1:4200/api/health').raise_for_status()" |
| 41 | + interval: 5s |
| 42 | + timeout: 5s |
| 43 | + retries: 3 |
| 44 | + postgresql: |
| 45 | + image: "postgres:16-alpine" |
| 46 | + restart: always |
| 47 | + volumes: |
| 48 | + - "pg_data:/var/lib/postgresql/data" |
| 49 | + environment: |
| 50 | + - POSTGRES_USER=$SERVICE_USER_POSTGRES |
| 51 | + - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES |
| 52 | + - POSTGRES_DB=${POSTGRES_DB:-prefect} |
| 53 | + healthcheck: |
| 54 | + test: |
| 55 | + - CMD-SHELL |
| 56 | + - "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}" |
| 57 | + interval: 5s |
| 58 | + timeout: 5s |
| 59 | + retries: 3 |
| 60 | + agent: |
| 61 | + image: "prefecthq/prefect:3-python3.12" |
| 62 | + restart: always |
| 63 | + depends_on: |
| 64 | + prefect: |
| 65 | + condition: service_healthy |
| 66 | + entrypoint: |
| 67 | + - /opt/prefect/entrypoint.sh |
| 68 | + - prefect |
| 69 | + - worker |
| 70 | + - start |
| 71 | + - "--pool=$${DEFAULT_POOL_NAME}" |
| 72 | + - "--with-healthcheck" |
| 73 | + - "--name=$${DEFAULT_WORKER_NAME}" |
| 74 | + - "--limit=$${DEFAULT_POOL_LIMIT}" |
| 75 | + environment: |
| 76 | + - PREFECT_API_URL=http://prefect:4200/api |
| 77 | + - PREFECT_API_KEY=${SERVICE_PASSWORD_APIKEY} |
| 78 | + - DEFAULT_POOL_NAME=${DEFAULT_POOL_NAME:-default} |
| 79 | + - DEFAULT_POOL_LIMIT=${DEFAULT_POOL_LIMIT:-1} |
| 80 | + - DEFAULT_WORKER_NAME=${DEFAULT_WORKER_NAME:-worker1} |
| 81 | + healthcheck: |
| 82 | + test: |
| 83 | + - CMD-SHELL |
| 84 | + - pwd |
| 85 | + interval: 5s |
| 86 | + timeout: 5s |
| 87 | + retries: 3 |
0 commit comments