You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The worker and deploy scripts are unable to communicate with the API server (in docker compose with nginx reverse proxy), ie, UI: /prefect and API /prefect/api
Compose file:
services:
### Prefect Databasedatabase:
image: postgres:alpinerestart: alwaysenvironment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}networks:
- prefect_networkvolumes:
- ./data/db:/var/lib/postgresql/data### Nginx Reverse Proxynginx:
image: nginx:alpinerestart: alwaysports:
- 8000:80networks:
- ui_networkvolumes:
- ./config/nginx/:/etc/nginx/conf.d/depends_on:
- server### Prefect Server API and UIserver:
image: prefecthq/prefect:3-python3.12restart: alwaysvolumes:
- prefect:/root/.prefectentrypoint: ["/opt/prefect/entrypoint.sh", "prefect", "server", "start"]environment:
- PREFECT_UI_URL=http://0.0.0.0:8000/prefect
- PREFECT_API_URL=http://0.0.0.0:8000/prefect/api
- PREFECT_UI_SERVE_BASE=/prefect# If you want to access Prefect Server UI from anywhere other than the Docker host machine, you will need to change# PREFECT_UI_URL and PREFECT_API_URL to match the external hostname/IP of the host machine. For example:#- PREFECT_UI_URL=http://external-ip/prefect#- PREFECT_API_URL=http://external-ip/prefect/api
- PREFECT_SERVER_API_HOST=${PREFECT_SERVER_API_HOST}
- PREFECT_API_DATABASE_CONNECTION_URL=${PREFECT_API_DATABASE_CONNECTION_URL}# - EXTRA_PIP_PACKAGES=${EXTRA_PIP_PACKAGES}depends_on:
- databasenetworks:
- ui_network
- prefect_network### Auto-discovery and deployment servicedeploy:
image: prefecthq/prefect:3-python3.12restart: "no"working_dir: "/root/flows"volumes:
- "./flows:/root/flows"
- "./deployments:/root/deployments"environment:
# - PREFECT_API_URL=${PREFECT_API_URL:-http://0.0.0.0:8000/prefect/api}
- PREFECT_API_URL=http://0.0.0.0:8000/prefect/api
- WORK_POOL_NAME=${WORK_POOL_NAME}
- WORK_POOL_TYPE=${WORK_POOL_TYPE}depends_on:
- servernetworks:
- ui_network
- prefect_networkentrypoint:
- bash
- -c
- | echo 'Waiting for Prefect server to be ready...' sleep 30 echo 'Creating work pool...' prefect work-pool create $${WORK_POOL_NAME} --type $${WORK_POOL_TYPE} || echo 'Work pool already exists' echo 'Deploying flows...' cd /root/flows # List all Python files for debugging echo 'Found Python files:' find . -name "*.py" -not -path "./__pycache__/*" | head -10 # Find all flow functions and deploy them using xargs echo 'Discovering and deploying flows...' # Create a function to extract flow entrypoints extract_flows() { for py_file in $$(find . -name "*.py" -not -path "./__pycache__/*"); do if grep -q "@flow" "$$py_file"; then # Extract flow function names that follow @flow decorator grep -A 1 "@flow" "$$py_file" | grep "def " | sed 's/def \([^(]*\).*/\1/' | while read flow_func; do if [ ! -z "$$flow_func" ]; then # Output in format: filename:function_name echo "$${py_file#./}:$$flow_func" fi done fi done } # Extract all flows and deploy them using xargs extract_flows | while read entrypoint; do if [ ! -z "$$entrypoint" ]; then flow_name=$$(echo "$$entrypoint" | cut -d':' -f2) deployment_name="$$flow_name-deployment" echo "Deploying: $$entrypoint as $$deployment_name" prefect deploy \ --name "$$deployment_name" \ --pool "$${WORK_POOL_NAME}" \ "$$entrypoint" || echo "Failed to deploy $$entrypoint" fi done echo 'Auto-discovery and deployment completed!'## Prefect Worker (Process-based for local execution)worker:
image: prefecthq/prefect:3-python3.12restart: alwaysentrypoint:
["/opt/prefect/entrypoint.sh","prefect","worker","start","--pool","${WORK_POOL_NAME}","--type","${WORK_POOL_TYPE}",]environment:
- PREFECT_API_URL=http://0.0.0.0:8000/prefect/api# - PREFECT_API_URL=${PREFECT_API_URL:-http://0.0.0.0:8000/prefect/api}# - EXTRA_PIP_PACKAGES=${EXTRA_PIP_PACKAGES}networks:
- ui_network
- prefect_networkvolumes:
- ./flows:/root/flowsdepends_on:
- deployvolumes:
prefect:
networks:
ui_network:
prefect_network:
Uh oh!
There was an error while loading. Please reload this page.
Bug summary
The
worker
anddeploy
scripts are unable to communicate with the API server (in docker compose with nginx reverse proxy), ie, UI:/prefect
and API/prefect/api
Compose file:
NGINX config:
.env
vars:Version info
Additional context
Traceback:
The text was updated successfully, but these errors were encountered: