Ferdinand Harmel
11/03/2024, 6:15 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'
...
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...Marvin
11/03/2024, 6:15 PMI am using coolify on a GCP VM, I used the template of prefect which was not working when launching with the error :
Can'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.Marvin
11/03/2024, 6:15 PMI am using coolify on a GCP VM, I used the template of prefect which was not working when launching with the error :
Can'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.Marvin
11/03/2024, 6:16 PMI am using coolify on a GCP VM, I used the template of prefect which was not working when launching with the error :
Can'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.Marvin
11/03/2024, 6:16 PMI am using coolify on a GCP VM, I used the template of prefect which was not working when launching with the error :
Can't connect to Server API at <http://127.0.0.1:4200/api>.
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'
#- 'PREFMarvin
11/03/2024, 6:17 PMI am using coolify on a GCP VM, and get this error
Can't connect to Server API at <http://127.0.0.1:4200/api>.
docker-compose:
```services:
prefect:
image: 'prefecthq/prefect:3-latest'
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'
command:
- prefect
- server
- start
- '--host'
- 0.0.0.0
-Marvin
11/03/2024, 6:18 PMPREFECT_SERVER_API_HOST
should reflect an address that other services can reach. Since you are deploying on a GCP VM, consider using 0.0.0.0
so that it's accessible from external calls.
- Similarly, ensure that the API URL uses the public IP of your GCP VM if you're trying to access the Prefect server from outside the VM.
2. Firewall and Network Configuration:
- Ensure that the firewall settings on your GCP VM allow inbound connections on port 4200. You may need to update your network configuration in the GCP Console to allow this.
3. Environment Variables:
- Check if the SERVICE_FQDN_PREFECT_4200
environment variable is correctly set to point to the public IP or hostname of your VM.
4. Docker Network:
- If your Docker containers are running in a network that isolates them, you might need to configure Docker networking options or check if the container can reach 0.0.0.0:4200
.
Considering the Prefect version 3.x based on your Docker image, make sure the server is started with the correct options and bindings. You can refer to the Prefect 3.x documentation for detailed guidance.
Additionally, similar issues have been reported on GitHub PrefectHQ/prefect Issue #10778 which might provide additional insights into resolving unique binding or connection issues specific to your setup.
If after all these checks you are still facing issues, you might want to double-check any recent changes that could have affected the network or server bindings. If you require further assistance, reaching out on Prefect's official forums or GitHub Issues can also be helpful.Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by