Ricardo Schalch
02/27/2024, 8:17 PMversion: "3"
services:
server:
image: prefecthq/prefect:2-python3.11
container_name: prefect-server
restart: always
command: ["prefect", "server", "start"]
entrypoint: "/opt/prefect/entrypoint.sh"
ports:
- "4200:4200"
depends_on:
- postgres
environment:
PREFECT_DEBUG_MODE: "true"
PREFECT_API_DATABASE_CONNECTION_URL: '<postgresql+asyncpg://rbs:123@postgres/prefect>'
PREFECT_API_DATABASE_ECHO: "false"
PREFECT_API_DATABASE_MIGRATE_ON_START: "true"
postgres:
image: postgres:latest
container_name: prefect-db
restart: always
environment:
POSTGRES_PASSWORD: 123
POSTGRES_USER: rbs
POSTGRES_DB: prefect
ports:
- "5432:5432"
expose:
- 5432
volumes:
- db_data:/var/lib/postgresql/data
ui:
image: prefecthq/ui:latest
container_name: prefect-ui
restart: always
depends_on:
- server
ports:
- "8080:8080"
environment:
PREFECT_API_DATABASE_CONNECTION_URL: '<postgresql+asyncpg://rbs:123@postgres/prefect>'
PREFECT_API_DATABASE_ECHO: "false"
PREFECT_API_DATABASE_MIGRATE_ON_START: "true"
PREFECT_SERVER__APOLLO_URL: "/graphql"
PREFECT_API_URL: "/api"
PREFECT_SERVER__BASE_URL: "<http://localhost:4200>"
volumes:
db_data: {}
my main questions are:
1. why the server is not being accessible on my browser through localhost or 127.0.0.1 ... I'm using macos without any firewalls or anything like that. Prefect UI is being accessible through localhost 8080 though
2. I'm also confused where certain env variables goes and the right values for them.
thanks a lotBaker
02/27/2024, 8:45 PMservices:
### PostgreSQL Database
database:
image: postgres:16
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=prefect
expose:
- 5432
volumes:
- postgres:/var/lib/postgresql/data
### Prefect server API
prefect-server:
image: prefecthq/prefect:2-python3.11
restart: always
volumes:
- prefect:/home/ubuntu/.prefect
entrypoint: ["prefect", "server", "start"]
environment:
- PREFECT_SERVER_API_HOST=0.0.0.0
- PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@database:5432/prefect>
ports:
- 4200:4200
depends_on:
- database
volumes:
prefect:
postgres:
Baker
02/27/2024, 8:47 PMRicardo Schalch
02/28/2024, 12:23 PMBaker
02/28/2024, 12:25 PMBaker
02/28/2024, 12:26 PM~/.prefect/profiles.toml
like:
active = "local"
[profiles.local]
PREFECT_API_URL = "<http://127.0.0.1:4200/api>"
PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD = "0"
Baker
02/28/2024, 12:27 PMRicardo Schalch
02/28/2024, 12:28 PMRicardo Schalch
02/28/2024, 12:30 PMBaker
02/28/2024, 1:09 PM"containerDefinitions": [
{
"name": "prefect-worker",
"image": "prefecthq/prefect:2-latest",
"cpu": 512,
"memory": 1024,
"portMappings": [],
"essential": true,
"command": [
"/bin/sh",
"-c",
"pip install prefect-aws && prefect worker start --pool cluster-dev --type ecs"
],
"environment": [
{
"name": "PREFECT_API_URL",
"value": "<http://10.0.2.35:4200/api>"
}
],
"mountPoints": [],
"volumesFrom": []
}
],
Ricardo Schalch
02/28/2024, 1:11 PM