Skip to content

Commit 2b93825

Browse files
committed
Update README
1 parent 2c44f06 commit 2b93825

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

README.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
# Introduction
2+
23
This project provides Docker images to periodically back up a PostgreSQL database to AWS S3, and to restore from the backup as needed.
34

45
# Usage
6+
57
## Backup
8+
69
```yaml
710
services:
811
postgres:
9-
image: postgres:16
12+
image: postgres:17-alpine
1013
environment:
1114
POSTGRES_USER: user
1215
POSTGRES_PASSWORD: password
1316

1417
backup:
15-
image: eeshugerman/postgres-backup-s3:16
18+
image: ghcr.io/solectrus/postgres-s3-backup:17
1619
environment:
17-
SCHEDULE: '@weekly' # optional
18-
BACKUP_KEEP_DAYS: 7 # optional
19-
PASSPHRASE: passphrase # optional
20+
SCHEDULE: '@weekly' # optional
21+
BACKUP_KEEP_DAYS: 7 # optional
22+
PASSPHRASE: passphrase # optional
2023
S3_REGION: region
2124
S3_ACCESS_KEY_ID: key
2225
S3_SECRET_ACCESS_KEY: secret
@@ -28,18 +31,20 @@ services:
2831
POSTGRES_PASSWORD: password
2932
```
3033
31-
- Images are tagged by the major PostgreSQL version supported: `12`, `13`, `14`, `15` or `16`.
34+
- Images are tagged by the major PostgreSQL version supported: `13`, `14`, `15`, `16` or `17`.
3235
- The `SCHEDULE` variable determines backup frequency. See go-cron schedules documentation [here](http://godoc.org/github.com/robfig/cron#hdr-Predefined_schedules). Omit to run the backup immediately and then exit.
3336
- If `PASSPHRASE` is provided, the backup will be encrypted using GPG.
3437
- Run `docker exec <container name> sh backup.sh` to trigger a backup ad-hoc.
3538
- If `BACKUP_KEEP_DAYS` is set, backups older than this many days will be deleted from S3.
3639
- Set `S3_ENDPOINT` if you're using a non-AWS S3-compatible storage provider.
3740

3841
## Restore
42+
3943
> [!CAUTION]
4044
> DATA LOSS! All database objects will be dropped and re-created.
4145

4246
### ... from latest backup
47+
4348
```sh
4449
docker exec <container name> sh restore.sh
4550
```
@@ -48,40 +53,31 @@ docker exec <container name> sh restore.sh
4853
> If your bucket has more than a 1000 files, the latest may not be restored -- only one S3 `ls` command is used
4954

5055
### ... from specific backup
56+
5157
```sh
5258
docker exec <container name> sh restore.sh <timestamp>
5359
```
5460

5561
# Development
62+
5663
## Build the image locally
64+
5765
`POSTGRES_VERSION` determines Postgres version.
66+
5867
```sh
5968
DOCKER_BUILDKIT=1 docker build --build-arg POSTGRES_VERSION=17 .
6069
```
70+
6171
## Run a simple test environment with Docker Compose
72+
6273
```sh
6374
cp template.env .env
6475
# fill out your secrets/params in .env
6576
docker compose up -d
6677
```
6778

6879
# Acknowledgements
69-
This project is a fork and re-structuring of @schickling's [postgres-backup-s3](https://github.com/schickling/dockerfiles/tree/master/postgres-backup-s3) and [postgres-restore-s3](https://github.com/schickling/dockerfiles/tree/master/postgres-restore-s3).
70-
71-
## Fork goals
72-
These changes would have been difficult or impossible merge into @schickling's repo or similarly-structured forks.
73-
- dedicated repository
74-
- automated builds
75-
- support multiple PostgreSQL versions
76-
- backup and restore with one image
77-
78-
## Other changes and features
79-
- some environment variables renamed or removed
80-
- uses `pg_dump`'s `custom` format (see [docs](https://www.postgresql.org/docs/10/app-pgdump.html))
81-
- drop and re-create all database objects on restore
82-
- backup blobs and all schemas by default
83-
- no Python 2 dependencies
84-
- filter backups on S3 by database name
85-
- support encrypted (password-protected) backups
86-
- support for restoring from a specific backup by timestamp
87-
- support for auto-removal of old backups
80+
81+
This project is a fork of @eeshugerman's [postgres-backup-s3](https://github.com/eeshugerman/postgres-backup-s3) repository. Since the original project is no longer maintained, I decided to fork it and merge an important pull request ([#61](https://github.com/eeshugerman/postgres-backup-s3/pull/61)) to add support for PostgreSQL 17.
82+
83+
The original repository itself is a fork and restructuring of @schickling's [postgres-backup-s3](https://github.com/schickling/dockerfiles/tree/master/postgres-backup-s3) and [postgres-restore-s3](https://github.com/schickling/dockerfiles/tree/master/postgres-restore-s3).

0 commit comments

Comments
 (0)