Skip to content

Commit d2ccb55

Browse files
committed
Add postgres v17, delete v14
1 parent 412add8 commit d2ccb55

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM alpine:3
1+
FROM alpine:edge
22

33
WORKDIR /root
44

55
RUN apk update && \
6-
apk add bash curl pigz postgresql14-client postgresql15-client postgresql16-client rclone
6+
apk add bash curl pigz postgresql15-client postgresql16-client postgresql17-client rclone
77

88
COPY docker-entrypoint.sh /usr/local/bin/
99
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

README.md

+33-27
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,46 @@
2020
| POSTGRES_PASSWORD || | Postgres server password |
2121
| POSTGRES_PORT | | 5432 | Postgres server port |
2222
| POSTGRES_USER | | postgres | Postgres server user |
23-
| POSTGRES_VERSION | | 16 | Postgres server version (14, 15 or 16) |
23+
| POSTGRES_VERSION | | 17 | Postgres server version (15, 16 or 17) |
2424
| WEBGAZER_HEARTBEAT_URL | | | [WebGazer Heartbeat Monitor](https://www.webgazer.io/services/cron-job-monitoring) URL |
2525

2626
### Running
2727

28-
$ docker run th0th/postgres-s3-backup \
29-
-e AWS_ACCESS_KEY_ID=<aws_access_key_id> \
30-
-e AWS_REGION=<aws_region> \
31-
-e AWS_S3_ENDPOINT=<aws_s3_endpoint> \
32-
-e AWS_S3_STORAGE_CLASS=<aws_s3_storage_class[STANDARD_IA]> \
33-
-e AWS_SECRET_ACCESS_KEY=<aws_secret_access_key> \
34-
-e POSTGRES_DB=<database> \
35-
-e POSTGRES_HOST=<postgres_hostname[postgres]> \
36-
-e POSTGRES_PASSWORD=<postgres_password> \
37-
-e POSTGRES_PORT=<postgres_port[5432]> \
38-
-e POSTGRES_USER=<postgres_user[postgres]> \
39-
-e POSTGRES_VERSION=<postgres_version[15]> \
40-
-e WEBGAZER_HEARTBEAT_URL=<webgazer_heartbeat_url>
28+
```shell
29+
$ docker run \
30+
-e AWS_ACCESS_KEY_ID=<aws_access_key_id> \
31+
-e AWS_REGION=<aws_region> \
32+
-e AWS_S3_ENDPOINT=<aws_s3_endpoint> \
33+
-e AWS_S3_STORAGE_CLASS=<aws_s3_storage_class[STANDARD_IA]> \
34+
-e AWS_SECRET_ACCESS_KEY=<aws_secret_access_key> \
35+
-e POSTGRES_DB=<database> \
36+
-e POSTGRES_HOST=<postgres_hostname[postgres]> \
37+
-e POSTGRES_PASSWORD=<postgres_password> \
38+
-e POSTGRES_PORT=<postgres_port[5432]> \
39+
-e POSTGRES_USER=<postgres_user[postgres]> \
40+
-e POSTGRES_VERSION=<postgres_version[17]> \
41+
-e WEBGAZER_HEARTBEAT_URL=<webgazer_heartbeat_url> \
42+
th0th/postgres-s3-backup
43+
```
4144

4245
### Example
4346

44-
$ docker run th0th/postgres-s3-backup \
45-
-e AWS_ACCESS_KEY_ID=g9XqNnqKmUk6xqwkStkN \
46-
-e AWS_REGION=eu-west-1 \
47-
-e AWS_S3_ENDPOINT=my-bucket/postgres-backup \
48-
-e AWS_S3_STORAGE_CLASS=GLACIER \
49-
-e AWS_SECRET_ACCESS_KEY=GLBZ8mQf27UL57YHbkLhXWtfJWVwtUBbQup6mFzw \
50-
-e POSTGRES_DB=database \
51-
-e POSTGRES_HOST=postgres \
52-
-e POSTGRES_PASSWORD=postgres_password \
53-
-e POSTGRES_PORT=5432 \
54-
-e POSTGRES_USER=postgres_user \
55-
-e POSTGRES_VERSION=15 \
56-
-e WEBGAZER_HEARTBEAT_URL=https://heartbeat.webgazer.io/1-8f713c75d659
47+
```shell
48+
$ docker run \
49+
-e AWS_ACCESS_KEY_ID=g9XqNnqKmUk6xqwkStkN \
50+
-e AWS_REGION=eu-west-1 \
51+
-e AWS_S3_ENDPOINT=my-bucket/postgres-backup \
52+
-e AWS_S3_STORAGE_CLASS=GLACIER \
53+
-e AWS_SECRET_ACCESS_KEY=GLBZ8mQf27UL57YHbkLhXWtfJWVwtUBbQup6mFzw \
54+
-e POSTGRES_DB=database \
55+
-e POSTGRES_HOST=postgres \
56+
-e POSTGRES_PASSWORD=postgres_password \
57+
-e POSTGRES_PORT=5432 \
58+
-e POSTGRES_USER=postgres_user \
59+
-e POSTGRES_VERSION=17 \
60+
-e WEBGAZER_HEARTBEAT_URL=https://heartbeat.webgazer.io/1-8f713c75d659 \
61+
th0th/postgres-s3-backup
62+
```
5763

5864
## Shameless plug
5965

docker-entrypoint.sh

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
32
set -eo pipefail
43

54
SECONDS=0
@@ -17,10 +16,10 @@ AWS_S3_STORAGE_CLASS="${AWS_S3_STORAGE_CLASS:-STANDARD_IA}"
1716
POSTGRES_HOST="${POSTGRES_HOST:-postgres}"
1817
POSTGRES_PORT="${POSTGRES_PORT:-5432}"
1918
POSTGRES_USER="${POSTGRES_USER:-postgres}"
20-
POSTGRES_VERSION="${POSTGRES_VERSION:-16}"
19+
POSTGRES_VERSION="${POSTGRES_VERSION:-17}"
2120

2221
# validate environment variables
23-
POSTGRES_VERSIONS=(14 15 16)
22+
POSTGRES_VERSIONS=(15 16 17)
2423

2524
if [[ ! " ${POSTGRES_VERSIONS[*]} " =~ " ${POSTGRES_VERSION} " ]]; then
2625
echo "error: POSTGRES_VERSION can be one of these: ${POSTGRES_VERSIONS[*]}"
@@ -32,12 +31,12 @@ BACKUP_FILE_NAME=$(date +"${POSTGRES_DB}-%F_%T.gz")
3231

3332
echo "Dumping the database..."
3433
PGPASSWORD="${POSTGRES_PASSWORD}" "/usr/libexec/postgresql${POSTGRES_VERSION}/pg_dump" \
35-
--host="${POSTGRES_HOST}" \
36-
--port="${POSTGRES_PORT}" \
37-
--username="${POSTGRES_USER}" \
38-
--dbname="${POSTGRES_DB}" \
39-
--format=c \
40-
| pigz --fast > "${BACKUP_FILE_NAME}"
34+
--host="${POSTGRES_HOST}" \
35+
--port="${POSTGRES_PORT}" \
36+
--username="${POSTGRES_USER}" \
37+
--dbname="${POSTGRES_DB}" \
38+
--format=c \
39+
| pigz --fast > "${BACKUP_FILE_NAME}"
4140
echo "Dumping the database... Done."
4241

4342
echo "Uploading to S3..."

0 commit comments

Comments
 (0)