<@ULVA73B9P> are there instructions on how to inst...
# ask-marvin
k
@Marvin are there instructions on how to install prefect server on a VM?
m
thought for 395.8 seconds
Yes! Here are the official ways to run a self‑hosted Prefect Server on a VM (Prefect 3.x), with docs and quick-start steps. Core docs - Prefect Server overview - Start the server via CLI (bare metal) - Run with Docker Compose (recommended on VMs) - Run as a single Docker container - Server settings reference Option A — Bare-metal (no Docker) 1) Install and start
Copy code
# on your VM
python3 -m venv /opt/prefect
source /opt/prefect/bin/activate
pip install -U prefect

# optional: for production, point Prefect Server at Postgres
export PREFECT_SERVER_DATABASE_CONNECTION_URL='<postgresql+asyncpg://user:pass@db-host:5432/prefect>'

# start Prefect Server (serves API + UI)
prefect server start --host 0.0.0.0 --port 4200
2) Connect clients/workers to your VM
Copy code
# on machines running flows/workers
export PREFECT_API_URL="http://<vm-ip>:4200/api"
Notes: - For quick tests, the server can run with SQLite; for production use PostgreSQL. Ensure
pg_trgm
is enabled in Postgres for text search (CREATE EXTENSION pg_trgm). - Migrations run automatically on start; you can also manage them with: -
prefect server database upgrade|downgrade|reset
Option B — Docker Compose (typical for VMs) - The docs include a ready-to-use docker-compose.yaml that brings up Prefect Server and a Postgres database: - Docker Compose guide - Steps (summary): - Copy the compose file from the docs - Set
PREFECT_SERVER_DATABASE_CONNECTION_URL
to your Postgres service (e.g., `postgresql+asyncpg://prefect:prefect@postgres:5432/prefect`) -
docker compose up -d
- Access the UI at
http://<vm-ip>:4200
and set
PREFECT_API_URL="http://<vm-ip>:4200/api"
on your clients/workers Security and production hardening - Reverse proxy/TLS and external URLs: Advanced self-hosting - Auth, headers, and UI/API URL config: Security settings If you share your VM OS and whether you prefer Docker or bare-metal—and if you’ll use Postgres—I can tailor a concrete install script or a docker-compose.yaml for you.