Postgres backups and point-in-time recovery on Railway

By Tracklayer · Updated 2026-11-20

Short answer: to restore Postgres on Railway to a point in time, run a Postgres that archives its write-ahead log (WAL) to storage and takes regular base backups. The Tracklayer PITR template does this from the first boot, with a Railway Bucket for the archive, a health-check cron job and a restore slot you drive with one variable. If scheduled dumps and a restore button are enough for you, Databasus is a simpler option for backing up several databases.

Deploy Postgres with PITR on Railway

When this makes sense

Daily dumps can lose a day of data, and they cannot bring back the state just before a bad migration or an accidental DELETE. Point-in-time recovery (PITR) can. Per the template documentation, typical uses are:

Postgres templates people deploy on Railway

TemplateCreatorDeploymentsServices
PostgreSQLRailway Templates394,2571
n8nThalles Passos's Projects5,8502
Langflow–2,8522
pgvectorBrody's Projects2,0771
PostGISRailway Templates1,5051
n8nBruno's Team1,2932
ExpressJS PostgreSQLopqr's Projects1,1012
medusajs ecommerce Nextjs, Postgres, RedisRasmus Puls's Projects1,0364

Railway marketplace data as of 2026-11-19. Full ranking: Best PostgreSQL templates on Railway.

Check each template’s services and volumes. A plain Postgres template does not include backups by itself.

Two approaches

Postgres with PITR Databasus
What it protects One Postgres service Postgres, MySQL, MariaDB and MongoDB, in one or several projects
Backup type Continuous WAL plus weekly full and daily differential Scheduled logical dumps with retention
Restore to a chosen second Yes, inside the window No, restore a whole backup
Where files go A Railway Bucket created by the template A Railway Bucket, or the local volume
Alerts Failed cron runs in PITR Monitor Slack, Telegram, Discord, Teams, Mattermost or webhooks
Estimated cost About $2 idle, about $17 for the 5 GB example About $2 to $3 idle, about $6 to $7 typical

Deploy Postgres with PITR, step by step

These steps use Tracklayer’s PostgreSQL 18 with Point-in-Time Recovery template.

  1. Deploy the template. It creates Postgres 18 (Railway’s postgres-ssl:18 image with pgBackRest), PgBouncer, a PITR Monitor cron service, a Postgres Restore slot and a Bucket. The password is generated at deploy.
  2. Connect your app. Use DATABASE_POOL_URL for application queries and DATABASE_URL for migrations. From outside Railway use DATABASE_PUBLIC_URL with ?sslmode=require. The variable names match Railway’s own Postgres.
  3. Wait for the first full backup. It starts minutes after the first deploy. After that a full runs weekly and a differential daily, and 4 fulls are kept.
  4. Check backup health. Open PITR Monitor and then Cron Runs. Each run logs OK: or FAIL: lines and the restore window. A run that exits with an error is a failed run.
  5. Rehearse a restore before you need one. Pick a UTC time inside the window, set PITR_RESTORE_TARGET_TIME on Postgres Restore (or latest) and deploy. Check the data over railway ssh, copy rows back or point an app at the slot, then wipe the slot’s volume to reset it.

The restore only writes into the slot’s own empty volume. It never touches the live database or the bucket. After losing the Postgres volume, use an explicit time from before the loss, not latest.

Deploy Databasus, step by step

These steps use Tracklayer’s Databasus v3 template, which runs Databasus 3.61.0.

  1. Deploy into the same project as your database and enter your email as DATABASUS_ADMIN_EMAIL. A generated DATABASUS_ADMIN_PASSWORD is set on the service and open sign-up is off.
  2. Sign in. The page shows Sign up first; switch to Sign in.
  3. Add storage. Under Storages add S3 and copy the S3_* values from the service variables, with virtual-hosted style ticked.
  4. Add your database with its private DATABASE_URL, and accept the offer to create a read-only user. Set the schedule, retention and alerts, and run a first backup.
  5. Save the encryption key with railway ssh --service Databasus -- cat /databasus-data/secret.key. Encrypted backups cannot be read without it if the volume is lost.

To restore, open a backup and choose Restore from this backup, then enter an empty target database. The restore replaces whatever the target holds.

What it costs

Railway bills usage, so cost follows memory, volumes, bucket storage and upload traffic. All figures here come from the templates’ own estimates; none are measurements. The PITR template estimates about $2 a month idle, and about $17 a month for a 5 GB database writing about 1 GB of WAL a day, which includes about 25 GB of bucket storage and about 35 GB of monthly uploads counted as egress. Fewer kept fulls or a longer POSTGRES_ARCHIVE_TIMEOUT lower it. Databasus is estimated at about 0.2 GB of RAM at idle, roughly $2 to $3 a month, and about $6 to $7 with daily backups of a few GB.

Limitations and licence notes

Other options

Many teams use both: Databasus for scheduled logical backups across databases, and WAL archiving for rewinding one critical database. For more Postgres variants, see the ranking of Postgres templates on Railway, or browse all guides.

FAQ

What is the difference between a daily dump and point-in-time recovery?

A daily dump can lose up to a day of data and cannot recreate the state just before a bad migration or an accidental DELETE. Point-in-time recovery keeps base backups plus the continuous write-ahead log, so the database can be replayed to a chosen moment inside the retention window.

How far back can the PITR template restore?

It keeps 4 full backups, which the template describes as about 3 to 4 weeks of recovery window, and archives each write-ahead log segment within about a minute of a change. The exact window is logged by each PITR Monitor run.

Has the restore been tested end to end?

Not according to the template's own notes. The restore slot and the monitor were tested against stubs, and the template says the combination on Railway is unverified until you run a restore drill. Run one on a non-critical database before relying on it.

Can Databasus do point-in-time recovery on Railway Postgres?

No. Databasus 3.61 supports point-in-time recovery only with physical PostgreSQL 17+ backups over the replication protocol, which Railway's managed Postgres does not accept from other services by default. The Databasus template therefore offers scheduled logical backups and restores.

What do these backup setups cost?

Both figures are estimates, not measurements. The PITR template author estimates about $2 a month idle and about $17 a month for a 5 GB database writing about 1 GB of WAL a day, including bucket storage and upload egress. Databasus is estimated at about $2 to $3 a month idle and about $6 to $7 with daily backups of a few GB.