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.

43 lines
1.2 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 -e DB_ENV_PREFIX=prod 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. DB_ENV_PREFIX: 'prod'
  22. S3_REGION: region
  23. S3_ACCESS_KEY_ID: key
  24. S3_SECRET_ACCESS_KEY: secret
  25. S3_BUCKET: my-bucket
  26. S3_PREFIX: backup
  27. POSTGRES_DATABASE: dbname
  28. POSTGRES_USER: user
  29. POSTGRES_PASSWORD: password
  30. POSTGRES_EXTRA_OPTS: '--schema=public --blobs'
  31. ```
  32. ### Automatic Periodic Backups
  33. You can additionally set the `SCHEDULE` environment variable like `-e SCHEDULE="@daily"` to run the backup automatically.
  34. More information about the scheduling can be found [here](http://godoc.org/github.com/robfig/cron#hdr-Predefined_schedules).