Backup Postgres to R2

Backup Postgres to R2 (or S3) using Railway's Cron

Deploy Backup Postgres to R2

rclone-postgres-backup

dbanty/rclone-postgres-backup

Just deployed

Deploy and Host Backup Postgres to R2 on Railway

This backup job runs a single time, to be scheduled with Railway's native Cron feature. This should save some compute cost over a long-running job (like the official Railway template).

This template was created for Cloudflare R2, but it uses rclone under the hood, so it can back up to virtually anywhere with a little tweaking.

About Hosting Backup Postgres to R2

To set up properly:

  1. Configure environment variables for your database & R2 bucket
  2. Disable restarts
  3. Set a Cron schedule to back up as often as you'd like in settings

Common Use Cases

  • Back up a Postgres database to R2
  • Back up a Postgres database to S3 using Railway's native Cron instead of a long-running job

Dependencies for Backup Postgres to R2 Hosting

Deployment Dependencies

Implementation Details

Internally, this uses pg_dump to dump the database and rclone to sync the data with a folder in an R2 bucket.

You can modify the generated rclone config to support virtually any other target for the backup.

Why Deploy Backup Postgres to R2 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 Backup Postgres to R2 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.


Template Content

rclone-postgres-backup

dbanty/rclone-postgres-backup

More templates in this category

View Template
Postgres S3 backups
A simple NodeJS app to back up your PostgreSQL database to S3 via a cron

View Template
Tier
A single tool to configure,orchestrate and manage your entire pricing stack

View Template
Trigger.dev
Open source background jobs framework for TypeScript.