Deploy Vaultwarden with PostgreSQL on Railway
Vaultwarden on Railway with PostgreSQL and persistent /data storage.
Just deployed
/var/lib/postgresql/data
vaultwarden
Just deployed
/data
Deploy and Host Vaultwarden with PostgreSQL on Railway
About Hosting
Vaultwarden is a lightweight, self-hostable password manager compatible with Bitwarden clients. This template deploys Vaultwarden on Railway with PostgreSQL for persistent application data and a mounted /data volume for filesystem-backed storage such as attachments.
Railway works well for this setup because it provides managed networking, persistent storage, PostgreSQL, and a generated public domain without requiring you to build the infrastructure stack manually.
Why Deploy Vaultwarden with PostgreSQL on Railway?
This template gives you a practical two-service Vaultwarden setup using the official vaultwarden/server:1.35.4 image. It is intended for users who want a persistent Railway deployment with PostgreSQL and a mounted /data volume.
It is also designed to work correctly before you configure a custom domain. You can deploy first, generate a Railway public domain, and then set DOMAIN afterwards.
Common Use Cases
- Self-hosting a personal or family password manager
- Running Vaultwarden with PostgreSQL instead of SQLite
- Deploying a persistent Vaultwarden instance on Railway
- Starting with a Railway-generated domain and adding a custom domain later
Dependencies for Deployment
Deployment Dependencies
This template includes:
- A
vaultwardenservice running the officialvaultwarden/server:1.35.4Docker image - A
Postgresservice for persistent application data - A persistent
/datavolume attached to Vaultwarden - A healthcheck path using
/alive
Configuration Dependencies
During setup you will provide:
ADMIN_TOKEN
The template also configures:
SIGNUPS_ALLOWED=falseDATABASE_URL=postgresql://${{Postgres.PGUSER}}:${{Postgres.PGPASSWORD}}@${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}
Deploy and Host
Deploy the template first, then generate a Railway public domain for the vaultwarden service.
After Railway assigns the public hostname, set:
DOMAIN=https://
Do not set DOMAIN before the service has a generated Railway domain. If DOMAIN is set too early, Vaultwarden may fail startup with an empty-host validation error.
After deployment, verify:
- the
vaultwardenservice is using port80 /aliveresponds successfully/datais mounted- the PostgreSQL service remains private-only
Template Content
vaultwarden
vaultwarden/server:1.35.4
