Restores postgres database from S3. Cleans database before restore. Uses pg_restore.
1.7K
Restore a SQL backup from S3 to PostgresSQL
This will potentially put your database in a very bad state or complete destroy your data, be very careful.
This is made to restore a backup made from postgres-s3-backup, if you backup came from somewhere else please check your format. Must
have been made using pg_dump --format=custom.
Docker:
$ 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 avencera/postgres-s3-backup
From inside container:
sh restore.sh
If you wish to drop the public schema (drop schema public cascade; create schema public) then set the environment variable DROP_PUBLIC=yes. This is useful for situations where you wish to restore a database which currently has data / schemas in it.
Forked from: https://github.com/schickling/dockerfiles/tree/master/postgres-restore-s3
Content type
Image
Digest
Size
50.4 MB
Last updated
almost 5 years ago
docker pull avencera/postgres-s3-restore