Deploy Postgres-to-R2 Backup
Auto back up PostgreSQL databases to Cloudflare R2 with optional encryption
pg-r2-backup
BigDaddyAman/pg-r2-backup
Just deployed
Deploy and Host Postgres-to-R2 Backup on Railway
What is Postgres-to-R2 Backup?
Postgres-to-R2 Backup is an automated tool that creates scheduled backups of your PostgreSQL database and uploads them to Cloudflare R2. It supports optional encryption with 7z, configurable retention, and works with both private and public database URLs, making database backups reliable, secure, and fully automated.
About Hosting Postgres-to-R2 Backup
Hosting Postgres-to-R2 Backup on Railway involves creating a new project, configuring environment variables, and deploying the bot. Once deployed, it automatically creates backups at the scheduled time, compresses or encrypts them, and uploads them to your Cloudflare R2 bucket. The bot also deletes older backups beyond your retention limit to save storage space. Railway handles hosting, scaling, and uptime, so you can automate database backups without maintaining servers or cron jobs manually.
Common Use Cases
- Automate daily or hourly PostgreSQL backups
- Secure off-site storage of database snapshots
- Manage backup retention automatically to save storage space
Dependencies for Postgres-to-R2 Backup Hosting
- PostgreSQL database (cloud or self-hosted)
- Cloudflare R2 bucket with API credentials
- Python 3.10+ environment
Deployment Dependencies
- Railway account for hosting and project management
- Python packages listed in
requirements.txt
Cronjob Scheduling via Railway Dashboard
Postgres-to-R2 Backup uses the BACKUP_TIME
environment variable to schedule automated daily backups. Railway’s built-in cronjob system handles execution, so you don’t need to configure cron manually. You can monitor logs, check backup execution times, and troubleshoot directly from the Railway Dashboard.
Why Deploy Postgres-to-R2 Backup 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 Postgres-to-R2 Backup on Railway, you can automate secure PostgreSQL backups with minimal maintenance, freeing up time to focus on your application while ensuring reliable off-site backup storage.
Template Content
pg-r2-backup
BigDaddyAman/pg-r2-backupR2_ENDPOINT
Your Cloudflare R2 endpoint URL
R2_ACCESS_KEY
Cloudflare R2 access key
R2_SECRET_KEY
Cloudflare R2 secret key
R2_BUCKET_NAME
Cloudflare R2 bucket name