Skip to content

Caprover app for backing up postgres database to firebase cloud storage

License

Notifications You must be signed in to change notification settings

GooeyAI/caprover-postgres-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

  1. Server with caprover installed and ready to go
  2. Postgres database on that server (one-click apps rock!)
  3. A google cloud storage bucket with versioning enabled

Usage

  1. Create a caprover app.
  2. Check "Do not expose as web-app"
  3. Specify the following environment variables in the App Configs tab (example)
    • BUCKET_PATH - The gs://<bucket>/<filename>.tar.zst path to the GCS bucket where the db backup should be stored
    • GOOGLE_APPLICATION_CREDENTIALS_JSON - A JSON service account key, that has permission to create/replace objects in above bucket.
    • PGHOST, PGPORT, PGUSER, PGPASSWORD - Should point to your db
  4. Add this github repo in the deployment tab, press force deploy

Restore

Reference: https://www.postgresql.org/docs/current/continuous-archiving.html

  1. Exec into a new container that is running the postgres image
  2. Make sure that $PGDATA is empty
  3. Run this script to download the backup and untar it into the $PGDATA directory
gsutil cp gs://<bucket>/<filename>.tar.zst - | tar -I zstd -xvf - -C $PGDATA
  1. pg_ctl -D $PGDATA reload

About

Caprover app for backing up postgres database to firebase cloud storage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •