Skip to content

A Dockerized solution to backup a PostgreSQL database and upload it to Google Drive.

License

Notifications You must be signed in to change notification settings

appzic/backup-psql-to-gdrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backup PostgreSQL to Google Drive

This project provides a Dockerized solution to back up a PostgreSQL database and upload the backup file to Google Drive.

Prerequisites

  • Docker
  • Google Cloud Service Account with Google Drive API enabled

Setup

  1. Pull the Docker image:

    docker pull appzic/backup-psql-to-gdrive
  2. Set the following environment variables:

    • DB_NAME: Your PostgreSQL database name
    • DB_USER: Your PostgreSQL database user
    • DB_PASSWORD: Your PostgreSQL database password
    • DB_HOST: Your PostgreSQL database host
    • DB_PORT: Your PostgreSQL database port (default is 5432)
    • GDRIVE_FOLDER_ID: Your Google Drive folder ID where the backup will be uploaded
    • GDRIVE_AUTH_KEY: Path to your Google Drive service account credentials JSON file

Usage

  1. Run the Docker container with the environment variables:

    docker run -e DB_NAME=your_db_name \
               -e DB_USER=your_db_user \
               -e DB_PASSWORD=your_db_password \
               -e DB_HOST=your_db_host \
               -e DB_PORT=your_db_port \
               -e GDRIVE_FOLDER_ID=your_gdrive_folder_id \
               -e GDRIVE_AUTH_KEY=/path/to/your/credentials.json \
               appzic/backup-psql-to-gdrive
  2. The backup script will run and upload the PostgreSQL database backup to the specified Google Drive folder.

License

This project is licensed under the MIT License.

About

A Dockerized solution to backup a PostgreSQL database and upload it to Google Drive.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published