A working FastAPI + Postgres in fifteen minutes
The FastAPI wizard talks to the same MetalDB you provision in the Databases tab. Connection string is generated, stored in Vault, and injected into the FastAPI container at deploy time.
In the dashboard (UI)
You will visit two wizards: Databases → MetalDB to provision Postgres, then Development → FastAPI to deploy the app pointing at that database.
Provision MetalDB first
Dashboard → Databases → tab "Cloud" → MetalDB card → Deploy. The wizard collects: Target VM Hostname/IP, SSH Username, SSH Key Pair, Database Name, Database User, Database Password, port (default 5432), Postgres Version, and optional replication / backup toggles.
- Use the Test SSH Connection button before clicking Deploy.
- Enable Backup if this is anything other than a throwaway demo — VxCloud will write nightly backups to the same VM (or to S3 if configured).
Wait for MetalDB to come up
The progress bar walks: 10% session start → 40% terraform apply → 70% Postgres systemd unit running → 90% admin role created → 100% connection details written to Vault. The dashboard shows the connection string and pgAdmin URL when ready.
Open the FastAPI wizard
Dashboard → Development → FastAPI Application → Deploy. Step 1 (Server Configuration) is identical to the Next.js flow — pick the same VM you put MetalDB on, or a different VM that can reach it on port 5432.
Step 2 — Application Source (Git)
Paste your FastAPI repo URL. The wizard expects a project with requirements.txt or pyproject.toml at the root and an entry point exposing FastAPI() — the conventional `main.py` with `app = FastAPI()`.
Step 3 — FastAPI Configuration
Set App Name, Python Version (3.12 / 3.11 / 3.10), and worker count for uvicorn/gunicorn. The wizard enables --workers automatically based on the chosen CPU count.
Step 4 — Application Settings + DATABASE_URL
Set App Port (8000), Entry Point (`main.py:app`), Requirements File (`requirements.txt`). In Environment Variables, paste: DATABASE_URL=postgres://<dbuser>:<dbpass>@<vm-ip>:5432/<dbname> Use the credentials Vault wrote when MetalDB came up — the dashboard surfaces them as a copy button on the MetalDB resource page.
Deploy and verify
Hit Deploy. After ~3 minutes you will see the API live at http://<vm-ip>:8000/docs (FastAPI auto-docs). The Monitoring tab shows both resources — MetalDB and the FastAPI service — linked under the same workspace.
Stuck halfway through? Email [email protected] — most replies land within an hour during weekdays.
All guidesWas this page helpful?