Skip to content

Simple Docker image to backup a Postgres db, to a GCS bucket

Notifications You must be signed in to change notification settings

marlowl/postgres-gcs-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to use

  1. Unlock script.sh
chmod +x script.sh
  1. Build the Dockerfile
docker build . -t postgres-gcs-backup
  1. Upload the Dockerfile to a registry of your choice

  2. Adjust cronjob.yaml

  ...
  - name: postgres-backup
            image: YOUR_DOCKER_IMAGE #here
            env:
            - name: POSTGRES_USER
              value: your_postgres_user
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: database-postgresql
                  key: postgresql-password
            - name: POSTGRES_DATABASE
              value: your_database
            - name: POSTGRES_HOST
              value: database-postgresql 
            - name: POSTGRES_PORT
              value: "5432"
            - name: BACKUP_GCS_BUCKET
              value: YOUR_GCS_BUCKET #here
            - name: GOOGLE_CLOUD_KEY 
              valueFrom:
                secretKeyRef:
                  name: postgres-sa
                  key: key.json
            resources:
              limits:
                memory: 256M
                cpu: "250m"
              requests:
                memory: 100M
                cpu: "10m"
          restartPolicy: OnFailure
          imagePullSecrets:
            - name: pull-secret
  1. Apply cronjob.yaml to make frequent backups

About

Simple Docker image to backup a Postgres db, to a GCS bucket

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published