
Deploy Prefect | (Just Updated) Workflow Orchestration, Server + Worker + Postgres, Login Protected
Self-hosted Prefect: server, worker, Postgres, login protected
prefect-worker
Just deployed
postgres
Just deployed
/var/lib/postgresql
Just deployed
Deploy and Host Prefect on Railway
Prefect is an open-source workflow orchestration platform: write Python flows, schedule them, retry them, and watch every run in a web dashboard. This template deploys a complete self-hosted Prefect 3 stack — API server and UI, a process worker, and a Postgres database — with the dashboard and API protected by a login generated at deploy time.
About Hosting Prefect
The template runs three services. prefect is the Prefect server (API and dashboard) backed by a Postgres 18 database whose data lives on a persistent volume, so flow runs, deployments, and schedules survive redeploys. prefect-worker is a process worker that polls the default work pool over Railway's private network and executes your scheduled flow runs. The API and UI sit behind basic authentication: the username is admin and the password is the PREFECT_PASSWORD variable generated on your prefect service. The worker receives the same credentials automatically. To use it from your own machine, run prefect config set PREFECT_API_URL=https:///api and prefect config set PREFECT_API_AUTH_STRING=admin:.
Why Deploy Prefect on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Prefect on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Login protected out of the box — most self-hosted Prefect servers expose an open API; this one generates a password at deploy.
- Worker included — a ready
defaultprocess pool, so scheduled flows run without extra setup. - State survives redeploys — Postgres on a volume, not SQLite on ephemeral disk.
- No variables to fill in — database password, login, and public URL are all wired automatically.
Common Use Cases
- Data pipelines — schedule ETL and ELT jobs with retries, caching, and run history.
- ML and AI workflows — orchestrate training, batch inference, and evaluation runs.
- Automation and cron replacement — turn scripts into observable, retryable scheduled flows.
Dependencies for Prefect Hosting
- A Postgres database (included in this template) with a volume mounted at
/var/lib/postgresql. - A Python environment with the
prefectpackage to write and deploy flows.
Deployment Dependencies
- Prefect — upstream project (Apache-2.0)
- Prefect documentation — flows, deployments, and workers
- Postgres — the database backing the server
Template Content
prefect-worker
prefecthq/prefect:3.8.8-python3.12postgres
postgres:18