R
Railway2mo ago
AraGon

cloudflare R2 postgres backups with cron

hey , i have found this great template https://github.com/railwayapp-templates/postgres-s3-backups it looks like it does the job , but i would like to know if there is any version of this template that uses railway built in corn job so it will run the server based on some corn ( 7days or so )
GitHub
GitHub - railwayapp-templates/postgres-s3-backups: A simple Node ap...
A simple Node app to automatically backup PostgreSQL databases to an S3 bucket - railwayapp-templates/postgres-s3-backups
Solution:
that template actually does have support for railway's native cron, simply enable your desired cron expression in the service settings, then set a SINGLE_SHOT_MODE service variable to true this will cause the app to instantly start the backend when ran and then exit when it's done it's backup allowing you to use it with railways native cron!
Jump to solution
11 Replies
Percy
Percy2mo ago
Project ID: N/A
AraGon
AraGon2mo ago
N/A
Solution
Brody
Brody2mo ago
that template actually does have support for railway's native cron, simply enable your desired cron expression in the service settings, then set a SINGLE_SHOT_MODE service variable to true this will cause the app to instantly start the backend when ran and then exit when it's done it's backup allowing you to use it with railways native cron!
AraGon
AraGon2mo ago
great stuff! , thank you
Brody
Brody2mo ago
let me know if it works for you!
AraGon
AraGon2mo ago
hey @Brody 1 - for the region should i enter WEUR for : Western Europe (WEUR) 2 - for the endpoint should i enter the S3 API when using r2 ? thats what i understand
Brody
Brody2mo ago
for the region you should use auto and for the endpoint, you use the endpoint that cloudflare gave you
AraGon
AraGon2mo ago
should i sleep for the prv db ?
Brody
Brody2mo ago
no, it handles that itself it uses pg_isready instead
AraGon
AraGon2mo ago
works great with no effort ! thanks brody
Brody
Brody2mo ago
awesome! I'll update those variable descriptions to include info on what to use if using cloudflare r2