You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

  1. # postgres-backup-s3
  2. Backup PostgresSQL to S3 (supports periodic backups)
  3. ## Usage
  4. Docker:
  5. ```sh
  6. $ docker run -e S3_ACCESS_KEY_ID=key -e S3_SECRET_ACCESS_KEY=secret -e S3_BUCKET=my-bucket -e S3_PREFIX=backup -e POSTGRES_DATABASE=dbname -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password -e POSTGRES_HOST=localhost schickling/postgres-backup-s3
  7. ```
  8. Docker Compose:
  9. ```yaml
  10. postgres:
  11. image: postgres
  12. environment:
  13. POSTGRES_USER: user
  14. POSTGRES_PASSWORD: password
  15. pgbackups3:
  16. image: schickling/postgres-backup-s3
  17. links:
  18. - postgres
  19. environment:
  20. SCHEDULE: '@daily'
  21. S3_REGION: region
  22. S3_ACCESS_KEY_ID: key
  23. S3_SECRET_ACCESS_KEY: secret
  24. S3_BUCKET: my-bucket
  25. S3_PREFIX: backup
  26. POSTGRES_DATABASE: dbname
  27. POSTGRES_USER: user
  28. POSTGRES_PASSWORD: password
  29. POSTGRES_EXTRA_OPTS: '--schema=public --blobs'
  30. ```
  31. ### Automatic Periodic Backups
  32. You can additionally set the `SCHEDULE` environment variable like `-e SCHEDULE="@daily"` to run the backup automatically.
  33. More information about the scheduling can be found [here](http://godoc.org/github.com/robfig/cron#hdr-Predefined_schedules).
  34. ### Encryption
  35. You can additionally set the `ENCRYPTION_PASSWORD` environment variable like `-e ENCRYPTION_PASSWORD="superstrongpassword"` to encrypt the backup. It can be decrypted using `openssl aes-256-cbc -d -in backup.sql.gz.enc -out backup.sql.gz`.