Self-host Prefect with Levelrail
Python-native workflow orchestration with scheduling, retries, and a dashboard for every flow run.
- AuthorPrefectHQ
- LicenceApache-2.0
- Memory1 GiB
- Archarm64
- Services2
How to self-host Prefect
-
Pull the images
2 images are pulled on your server.
Show images
postgres:16-alpineprefecthq/prefect:3-latest
-
Create the app
2 services start in a single Compose app, with 2 named volume mounts for your data, on port 4200.
-
Fill in the secrets
2 secrets are generated and stored encrypted, 3 settings are preset, you do not have to fill in anything.
-
Open it
Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.
Prefect requirements
- Memory
- About 1 GiB
- Architectures
- amd64 image published, arm64 image published
- Ports
- 4200
- Domain
- Optional, an sslip.io address is used without one
- Settings
- none to fill in
- License
- Apache-2.0, permissive license
- Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.
- Host ports. It publishes port 4200 on the host, so open them in the VPS firewall only if you want that.
Install Levelrail first
On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then Prefect. New to Levelrail? Install it on a fresh VPS first.
docker pull ghcr.io/glincker/levelrail:latest Then levelrail-cli login --device. See Getting started and the Prefect docs page.
Deploy Prefect your way
Every format below deploys the same pinned images. Pick the one that fits how you work.
Deploy Prefect from the CLI
levelrail-cli templates deploy prefect --name my-prefect Deploy Prefect with the API
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://levelrail.example.com/api/v1/service-templates/prefect/deploy Prefect configuration
Prefect services
| Service | Image | Ports | Volumes |
|---|---|---|---|
| db | postgres:16-alpine | none | prefect_db_data -> /var/lib/postgresql/data |
| prefect | prefecthq/prefect:3-latest | 4200 | prefect_data -> /data |
Prefect environment variables
| Variable | Service | Value |
|---|---|---|
| POSTGRES_DB | db | Preset by the template |
| POSTGRES_PASSWORD | db | Generated at deploy |
| POSTGRES_USER | db | Preset by the template |
| PREFECT_API_DATABASE_CONNECTION_URL | prefect | Generated at deploy |
| PREFECT_HOME | prefect | Preset by the template |
Ports and volumes
- Ports
- 4200
- Volumes
- 2 named mounts: prefect_db_data -> /var/lib/postgresql/data, prefect_data -> /data
Prefect FAQ
How much memory does Prefect need?
The catalog lists about 1 GiB of memory for Prefect across its 2 services.
Does Prefect run on arm64?
For Prefect, an arm64 image is published; amd64 is image published.
What licence is Prefect under?
Prefect is licensed under Apache-2.0, which is permissive, with few conditions on reuse.
Does Prefect need configuration before it starts?
No. The template fills in its own defaults and generates secrets at deploy time.
Which database does Prefect bundle?
The template includes Postgres, running as its own service.
Which ports does Prefect use?
Prefect listens on port 4200 inside the stack.
Where does Prefect keep its data?
In named volumes: prefect_db_data mounted at /var/lib/postgresql/data and prefect_data mounted at /data.
Can I deploy Prefect on Dokploy or Dokku?
The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list has an entry with the id prefect for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image postgres:16-alpine, prefecthq/prefect:3-latest is what you deploy there.