Ferdinand Harmel
11/03/2024, 6:13 PMCan't connect to Server API at <http://127.0.0.1:4200/api>. Check that it's accessible from your machine.
I did some research, and from what I understand, it comes from network issue. But I can't see which one...
Here's my docker-compose:
services:
prefect:
image: 'prefecthq/prefect:3-latest'
depends_on:
postgresql:
condition: service_healthy
environment:
- SERVICE_FQDN_PREFECT_4200
- 'PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgresql:5432/${POSTGRES_DB:-prefect}'
- 'PREFECT_API_KEY=${SERVICE_PASSWORD_APIKEY}'
- 'PREFECT_EXPERIMENTAL_WARN=${PREFECT_EXPERIMENTAL_WARN:-false}'
- 'PREFECT_EXPERIMENTAL_ENABLE_SCHEDULE_CONCURRENCY=${PREFECT_EXPERIMENTAL_ENABLE_SCHEDULE_CONCURRENCY:-false}'
- 'PREFECT_RUNNER_SERVER_ENABLE=${PREFECT_RUNNER_SERVER_ENABLE:-false}'
- 'PREFECT_DEFAULT_WORK_POOL_NAME=${DEFAULT_POOL_NAME:-default}'
- 'PREFECT_API_URL=<http://0.0.0.0:4200/api>'
- 'PREFECT_SERVER_API_HOST=127.0.0.1'
#- 'PREFECT_UI_API_URL=<http://localhost:4200/api>'
#- 'PREFECT_UI_API_URL=<http://127.0.0.1:4200/api>'
command:
- prefect
- server
- start
- '--host'
- 0.0.0.0
- '--port'
- '4200'
healthcheck:
test:
- CMD
- python
- '-c'
- "import requests as r;r.get('<http://127.0.0.1:4200/api/health').raise_for_status(>)"
interval: 5s
timeout: 5s
retries: 3
postgresql:
image: 'postgres:16-alpine'
volumes:
- 'pg-data:/var/lib/postgresql/data'
environment:
- POSTGRES_USER=$SERVICE_USER_POSTGRES
- POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES
- 'POSTGRES_DB=${POSTGRES_DB:-prefect}'
healthcheck:
test:
- CMD-SHELL
- 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'
interval: 5s
timeout: 5s
retries: 3
agent:
image: 'prefecthq/prefect:3-python3.12'
depends_on:
prefect:
condition: service_healthy
entrypoint:
- /opt/prefect/entrypoint.sh
- prefect
- worker
- start
- '--pool=${DEFAULT_POOL_NAME}'
- '--with-healthcheck'
- '--name=${DEFAULT_WORKER_NAME}'
- '--limit=${DEFAULT_POOL_LIMIT}'
environment:
- 'PREFECT_API_URL=<http://prefect:4200/api>'
- 'PREFECT_API_KEY=${SERVICE_PASSWORD_APIKEY}'
- 'DEFAULT_POOL_NAME=${DEFAULT_POOL_NAME:-default}'
- 'DEFAULT_POOL_LIMIT=${DEFAULT_POOL_LIMIT:-1}'
- 'DEFAULT_WORKER_NAME=${DEFAULT_WORKER_NAME:-worker1}'
healthcheck:
test:
- CMD-SHELL
- pwd
interval: 5s
timeout: 5s
retries: 3
Also I tried to relate with this issue, but couldn't see the bottom of it https://linen.prefect.io/t/9562601/hi-guys-hope-someone-can-help-me-with-my-current-problem-i-h
Under the hood coolify use docker-compose, but it shouldn't interfer since it's in the local network of dockers...
I'm a bit confused with this setup, any help is welcome !
Thanks in advance 🙂