Skip to content

Latest commit

 

History

History
54 lines (48 loc) · 1.34 KB

README.md

File metadata and controls

54 lines (48 loc) · 1.34 KB

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