Prefect server
Self-host your own Prefect server instance.
After installing Prefect, you have a Python SDK client that can communicate with either Prefect Cloud or a self-hosted Prefect server, backed by a database and a UI.
Prefect Cloud and self-hosted Prefect server share a common set of capabilities. Prefect Cloud provides the additional features required by organizations such as RBAC, Audit logs, and SSO. See the Prefect Cloud overview for more information.
We recommend using the same version of prefect
for the client and server.
Old clients are compatible with new servers, but new clients can be incompatible with old servers as new fields are added to the REST API.
The server will typically return a 422 status code if any issues occur.
The Prefect database
The Prefect database persists data to track the state of your flow runs and related Prefect concepts, including:
- Flow run and task run state
- Run history
- Logs
- Deployments
- Flow and task run concurrency limits
- Storage blocks for flow and task results
- Variables
- Artifacts
- Work pool status
Prefect supports the following databases:
- SQLite (default): Recommended for lightweight, single-server deployments. SQLite requires essentially no setup.
- PostgreSQL: Best for production use, high availability, and multi-server deployments. Requires additional setup. Prefect uses the
pg_trgm
extension, so it must be installed and enabled.
Database migrations
Prefect uses Alembic to manage database migrations. Alembic is a database migration tool that provides a framework for generating and applying schema changes to a database.
When you start a Prefect server, it automatically runs any necessary migrations. You can also manage migrations manually using the CLI.
How to guides
- Self-host via CLI - Start a local server instance
- Self-host via Docker - Run server in containers
- Scale self-hosted Prefect - Deploy multiple server instances for high availability