Postgres backups to R2 - Cloudflare

Description: A Bun service to backup a MySQL database to R2 - Clouflare

Category: Automation

URL: https://railway.app/template/P8o9wl

Completed

10 Replies

pawelkrystkiewiczPRO

a year ago

I have an error:
"pgdump: detail: server version: 16.0 (Debian 16.0-1.pgdg120+1); pgdump version: 15.6"
What can I do about it?


a year ago

No hard feelings for the template creator, but I'm really not sure why this template exists, I can say from experience that the Postgres S3 backups template from Railway works with Cloudflare R2 just fine, and it uses the correct pg_dump version 16.

https://railway.app/template/I4zGrH


pawelkrystkiewiczPRO

a year ago

Ok, thanks


No hard feelings for the template creator, but I'm really not sure why this template exists, I can say from experience that the Postgres S3 backups template from Railway works with Cloudflare R2 just fine, and it uses the correct pg_dump version 16.

https://railway.app/template/I4zGrH

I created this template for two reasons:

  • I wanted to use the cron job provided by Railway, not through code. I don't want to keep my server running 24/7 spending resources.

  • I use the variables from R2 that are already shared with other services.


I have an error:
"pgdump: detail: server version: 16.0 (Debian 16.0-1.pgdg120+1); pgdump version: 15.6"
What can I do about it?

It became outdated, i'm going to fix that, thanks.


a year ago

I wanted to use the cron job provided by Railway, not through code. I don't want to keep my server running 24/7 spending resources.

That's fair, but there is an open PR to achieve that functionally with Railway's template.

I use the variables from R2 that are already shared with other services.

Nothing is stopping you from doing that with Railway's template.

While utilizing Railway's scheduler is a good improvement, but overall this seems more like a personal project that was published as a template.

Upon further inspection, it looks like you read the entire backup file into memory with a buffer before uploading it, as opposed to using streams.

It might be best to unpublish this template to prevent further confusion from users.


I wanted to use the cron job provided by Railway, not through code. I don't want to keep my server running 24/7 spending resources.

That's fair, but there is an open PR to achieve that functionally with Railway's template.

I use the variables from R2 that are already shared with other services.

Nothing is stopping you from doing that with Railway's template.

While utilizing Railway's scheduler is a good improvement, but overall this seems more like a personal project that was published as a template.

Upon further inspection, it looks like you read the entire backup file into memory with a buffer before uploading it, as opposed to using streams.

It might be best to unpublish this template to prevent further confusion from users.

That's why templates are there, to people share and choose which one it's the best for their use case.
I deleted it. :)


a year ago

Absolutely, but the average user doesn't want to have to sort through duplicate templates, they just want something that works, duplicate templates lower the developer experience and affect the platform's image of simplicity.

Thank you for understanding.


jacksonkasi0TRIAL

5 months ago

Hi everyone!

I came across a repository that might be a great solution for PostgreSQL backups and restores using Cloudflare R2. It's called Postgres R2 Backup & Restore via Docker & Deno. This system automates backups/restores and includes features like:

- Local and Cloud Backups: Easily create and store backups in Cloudflare R2.

- Automated Cron Jobs: Automate the backup process with customizable schedules.

- Docker Integration: Portable workflows with Docker containers.

- Retention Policies: Automatically cleans up older backups locally and on R2.

- Ease of Use: Simple commands for backup and restore tasks using Deno.

Why You Might Like It:

- It supports PostgreSQL 16 (compatible with your environment).

- Includes ready-to-use Dockerfiles for backups and restores.

- Integrates well with Cloudflare R2, with built-in multipart upload handling.

- Clear folder structure and scripts for automation make it beginner-friendly.

If you’re still looking for an efficient way to handle PostgreSQL backups with R2, I recommend checking it out! The setup instructions are straightforward, and the repository provides a lot of flexibility for customizing your workflow.

Here’s the link: Postgres R2 Backup & Restore via Docker & Deno.

Would love to hear how it works for you if you give it a shot!


5 months ago

For what it's worth, we now have platform native backups, making backup templates for the most part outdated.

https://docs.railway.com/reference/backups


Status changed to Completed brody 5 months ago