Skip to content

Commit 98f917b

Browse files
authored
v3.0.0 (#94)
**Complete rewrite using [nushell](https://nushell.sh)** ## Major updates and breaking changes * To enter nushell do `docker exec -it container_name nu` and type `bf-postgresql + tab` to see a complete list of functions * All environment variables now begin `BF_PG` ## Minor updates * Updating to PostgreSQL 12.17, 13.13, 14.10 and 15.5 ## Build updates * Updating workflows to latest versions * Using -dev instead of -beta for development builds ## Development updates * Enforcing LF line endings
1 parent 4f8ca12 commit 98f917b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+607
-649
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Always use LF endings.
2+
* text eol=lf

.github/workflows/auto-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
-
1212
name: Checkout Branch ${{ github.ref_name }}
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
-
1515
name: Create Pull Request
1616
uses: bfren/pull-request@v2

.github/workflows/dev.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
-
1414
name: Checkout code
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
build:
1717
strategy:
1818
fail-fast: false
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
-
2424
name: Checkout code
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
-
2727
name: Get repository name
2828
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
@@ -35,20 +35,20 @@ jobs:
3535
id: version
3636
-
3737
name: Set up QEMU
38-
uses: docker/setup-qemu-action@v2
38+
uses: docker/setup-qemu-action@v3
3939
-
4040
name: Set up Docker Buildx
41-
uses: docker/setup-buildx-action@v2
41+
uses: docker/setup-buildx-action@v3
4242
-
4343
name: Login to DockerHub
44-
uses: docker/login-action@v2
44+
uses: docker/login-action@v3
4545
with:
4646
username: ${{ secrets.DOCKERHUB_USERNAME }}
4747
password: ${{ secrets.DOCKERHUB_TOKEN }}
4848
-
4949
name: Build and push
5050
id: docker_build
51-
uses: docker/build-push-action@v4
51+
uses: docker/build-push-action@v5
5252
with:
5353
context: .
5454
file: ./${{ matrix.postgresql }}/Dockerfile
@@ -59,7 +59,7 @@ jobs:
5959
platforms: linux/amd64,linux/arm/v7,linux/arm64
6060
tags: |
6161
bfren/postgresql:postgresql${{ matrix.postgresql }}-dev
62-
bfren/postgresql:postgresql${{ matrix.postgresql }}-${{ steps.version.outputs.contents }}-beta
62+
bfren/postgresql:postgresql${{ matrix.postgresql }}-${{ steps.version.outputs.contents }}-dev
6363
-
6464
name: Image digest
6565
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
-
1717
name: Checkout code
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
-
2020
name: Get repository name
2121
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
@@ -46,20 +46,20 @@ jobs:
4646
id: version
4747
-
4848
name: Set up QEMU
49-
uses: docker/setup-qemu-action@v2
49+
uses: docker/setup-qemu-action@v3
5050
-
5151
name: Set up Docker Buildx
52-
uses: docker/setup-buildx-action@v2
52+
uses: docker/setup-buildx-action@v3
5353
-
5454
name: Login to DockerHub
55-
uses: docker/login-action@v2
55+
uses: docker/login-action@v3
5656
with:
5757
username: ${{ secrets.DOCKERHUB_USERNAME }}
5858
password: ${{ secrets.DOCKERHUB_TOKEN }}
5959
-
6060
name: Build and push
6161
id: docker_build
62-
uses: docker/build-push-action@v4
62+
uses: docker/build-push-action@v5
6363
with:
6464
context: .
6565
file: ./${{ matrix.postgresql }}/Dockerfile

.github/workflows/update-readme.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
shell: bash
1616
-
1717
name: Checkout code
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
-
2020
name: Login to DockerHub
21-
uses: docker/login-action@v2
21+
uses: docker/login-action@v3
2222
with:
2323
username: ${{ secrets.DOCKERHUB_USERNAME }}
2424
password: ${{ secrets.DOCKERHUB_TOKEN }}

12/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM bfren/alpine-s6:alpine3.18-4.5.9
1+
FROM bfren/alpine-s6:alpine3.18-5.0.5
22

33
LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"
44

55
ARG BF_IMAGE
66
ARG BF_VERSION
77

8-
ENV \
9-
# set to "1" to compress backup sql files
10-
POSTGRESQL_BACKUP_COMPRESS_FILES="0" \
11-
# the number of days after which backups will be deleted
12-
POSTGRESQL_BACKUP_KEEP_FOR_DAYS="28"
13-
148
EXPOSE 5432
159

1610
COPY ./overlay /
1711
COPY ./12/overlay /
1812

13+
ENV \
14+
# set to "1" to compress backup sql files
15+
BF_PG_BACKUP_COMPRESS_FILES="0" \
16+
# the duration for which backups will be kept
17+
BF_PG_BACKUP_KEEP_FOR="28day"
18+
1919
RUN bf-install
2020

21-
VOLUME [ "/data", "/backup" ]
21+
VOLUME [ "/backup", "/data" ]

12/overlay/tmp/POSTGRESQL_BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.16-r0
1+
12.17-r0

12/overlay/tmp/POSTGRESQL_MINOR

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.16
1+
12.17

13/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM bfren/alpine-s6:alpine3.18-4.5.9
1+
FROM bfren/alpine-s6:alpine3.18-5.0.5
22

33
LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"
44

55
ARG BF_IMAGE
66
ARG BF_VERSION
77

8-
ENV \
9-
# set to "1" to compress backup sql files
10-
POSTGRESQL_BACKUP_COMPRESS_FILES="0" \
11-
# the number of days after which backups will be deleted
12-
POSTGRESQL_BACKUP_KEEP_FOR_DAYS="28"
13-
148
EXPOSE 5432
159

1610
COPY ./overlay /
1711
COPY ./13/overlay /
1812

13+
ENV \
14+
# set to "1" to compress backup sql files
15+
BF_PG_BACKUP_COMPRESS_FILES="0" \
16+
# the duration for which backups will be kept
17+
BF_PG_BACKUP_KEEP_FOR="28day"
18+
1919
RUN bf-install
2020

21-
VOLUME [ "/data", "/backup" ]
21+
VOLUME [ "/backup", "/data" ]

13/overlay/tmp/POSTGRESQL_BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13.12-r0
1+
13.13-r0

13/overlay/tmp/POSTGRESQL_MINOR

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13.12
1+
13.13

14/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM bfren/alpine-s6:alpine3.18-4.5.9
1+
FROM bfren/alpine-s6:alpine3.18-5.0.5
22

33
LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"
44

55
ARG BF_IMAGE
66
ARG BF_VERSION
77

8-
ENV \
9-
# set to "1" to compress backup sql files
10-
POSTGRESQL_BACKUP_COMPRESS_FILES="0" \
11-
# the number of days after which backups will be deleted
12-
POSTGRESQL_BACKUP_KEEP_FOR_DAYS="28"
13-
148
EXPOSE 5432
159

1610
COPY ./overlay /
1711
COPY ./14/overlay /
1812

13+
ENV \
14+
# set to "1" to compress backup sql files
15+
BF_PG_BACKUP_COMPRESS_FILES="0" \
16+
# the duration for which backups will be kept
17+
BF_PG_BACKUP_KEEP_FOR="28day"
18+
1919
RUN bf-install
2020

21-
VOLUME [ "/data", "/backup" ]
21+
VOLUME [ "/backup", "/data" ]

14/overlay/tmp/POSTGRESQL_BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.9-r0
1+
14.10-r0

14/overlay/tmp/POSTGRESQL_MINOR

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.9
1+
14.10

15/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM bfren/alpine-s6:alpine3.18-4.5.9
1+
FROM bfren/alpine-s6:alpine3.18-5.0.5
22

33
LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"
44

55
ARG BF_IMAGE
66
ARG BF_VERSION
77

8-
ENV \
9-
# set to "1" to compress backup sql files
10-
POSTGRESQL_BACKUP_COMPRESS_FILES="0" \
11-
# the number of days after which backups will be deleted
12-
POSTGRESQL_BACKUP_KEEP_FOR_DAYS="28"
13-
148
EXPOSE 5432
159

1610
COPY ./overlay /
1711
COPY ./15/overlay /
1812

13+
ENV \
14+
# set to "1" to compress backup sql files
15+
BF_PG_BACKUP_COMPRESS_FILES="0" \
16+
# the duration for which backups will be kept
17+
BF_PG_BACKUP_KEEP_FOR="28day"
18+
1919
RUN bf-install
2020

21-
VOLUME [ "/data", "/backup" ]
21+
VOLUME [ "/backup", "/data" ]

15/overlay/tmp/POSTGRESQL_BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
15.4-r0
1+
15.5-r0

15/overlay/tmp/POSTGRESQL_MINOR

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
15.4
1+
15.5

Dockerfile.esh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM bfren/alpine-s6:alpine3.18-<%= ${BASE_REVISION} %>
1+
FROM bfren/alpine-s6:alpine3.18-<%= ${BASE_VERSION} %>
22

33
LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"
44

55
ARG BF_IMAGE
66
ARG BF_VERSION
77

8-
ENV \
9-
# set to "1" to compress backup sql files
10-
POSTGRESQL_BACKUP_COMPRESS_FILES="0" \
11-
# the number of days after which backups will be deleted
12-
POSTGRESQL_BACKUP_KEEP_FOR_DAYS="28"
13-
148
EXPOSE 5432
159

1610
COPY ./overlay /
1711
COPY ./<%= ${POSTGRESQL_MAJOR} %>/overlay /
1812

13+
ENV \
14+
# set to "1" to compress backup sql files
15+
BF_PG_BACKUP_COMPRESS_FILES="0" \
16+
# the duration for which backups will be kept
17+
BF_PG_BACKUP_KEEP_FOR="28day"
18+
1919
RUN bf-install
2020

21-
VOLUME [ "/data", "/backup" ]
21+
VOLUME [ "/backup", "/data" ]

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,28 @@ See [For Backups](#for-backups) for configuration variables.
4040

4141
### For Backups
4242

43-
| Variable | Values | Description | Default |
44-
| ---------------------------------- | ---------------------------- | -------------------------------------------------------- | ------- |
45-
| `POSTGRESQL_BACKUP_COMPRESS_FILES` | 0 or 1 | Whether or not to compress backup files (using gzip). | 0 |
46-
| `POSTGRESQL_BACKUP_KEEP_FOR_DAYS` | 0: keep forever<br>Num: days | How many days to keep backups before auto-deleting them. | 14 |
43+
| Variable | Values | Description | Default |
44+
| ----------------------------- | ------------- | ----------------------------------------------------- | --------- |
45+
| `PG_BACKUP_COMPRESS_FILES` | 0 or 1 | Whether or not to compress backup files (using bzip). | 0 |
46+
| `BF_PG_BACKUP_KEEP_FOR` | Nu duration | The length of time to keep backups. | 28day |
4747

4848
### For Database
4949

50-
| Variable | Values | Description | Default |
51-
| --------------------- | ------ | ----------------------------------------------------------------------------------------- | ----------------- |
52-
| `POSTGRESQL_USERNAME` | string | Application username - will be used as database name if `POSTGRESQL_DATABASE` is not set. | *None* - required |
53-
| `POSTGRESQL_PASSWORD` | string | Application password. | *None* - required |
54-
| `POSTGRESQL_DATABASE` | string | Database name(s) - multiple databases can be separated by a comma. | *None* |
50+
| Variable | Values | Description | Default |
51+
| ----------------- | ------ | -------------------------------------------------------------------------------------------------------- | --------- |
52+
| `PG_APPLICATION` | string | Application name - will be used as `PG_DATABASE`, `PG_PASSWORD` and `PG_USERNAME` if they are not set. | *None* |
53+
| `PG_DATABASE` | string | Database name(s) - multiple databases can be separated by a comma. | *None* |
54+
| `PG_PASSWORD` | string | Application password. | *None* |
55+
| `PG_USERNAME` | string | Application username. | *None* |
5556

5657
## Helper Functions
5758

58-
| Function | Purpose | Usage |
59-
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
60-
| `db-backup` | Run backup manually. | `docker exec <<CONTAINER>> db-backup` |
61-
| `db-exists` | Echoes '0' or '1' depending on whether or not the specified database exists on the server. | `docker exec <<CONTAINER>> db-exists "foo"` |
62-
| `db-export` | Dumps the specified database as a SQL file to the root of the `/backup` volume. | `docker exec <<CONTAINER>> db-export <<DB_NAME>>` |
63-
| `db-import` | Executes all files in the root of the `/backup` volume. | `docker exec <<CONTAINER>> db-import` |
64-
| `db-restore` | Deletes all files in `/data` volume, then shuts container down - on restart, the container will restore from the specified backup. | `docker exec <<CONTAINER>> db-restore 202107180500` |
65-
| `db-stop` | Stops the database server (will automatically terminate the container). | `docker exec <<CONTAINER>> db-stop` |
59+
| Function | Arguments | Purpose | Usage |
60+
| ------------- | ----------------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------- |
61+
| `pg-dump` | *None* | Run backup manually. | `docker exec <<CONTAINER>> pg-dump` |
62+
| `pg-export` | 1: Database name | Dumps the specified database as a SQL file to the root of the `/backup` volume. | `docker exec <<CONTAINER>> pg-export <<DB_NAME>>` |
63+
| `pg-import` | 1: Database name | Executes all files in the root of the `/backup` volume. | `docker exec <<CONTAINER>> pg-import <<DB_NAME>>` |
64+
| `pg-restore` | 1: Backup set | Deletes all files in `/data` volume, then restores from the specified backup dump. | `docker exec <<CONTAINER>> pg-restore 202107180500` |
6665

6766
## Licence
6867

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.29
1+
3.0.0

VERSION_MAJOR

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2
1+
3

VERSION_MINOR

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3
1+
3.0

generate-dockerfiles.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -euo pipefail
44

55
docker pull bfren/alpine
66

7-
BASE_REVISION="4.5.9"
8-
echo "Base: ${BASE_REVISION}"
7+
BASE_VERSION="5.0.5"
8+
echo "Base: ${BASE_VERSION}"
99

1010
POSTGRESQL_VERSIONS="12 13 14 15"
1111
for V in ${POSTGRESQL_VERSIONS} ; do
@@ -17,7 +17,7 @@ for V in ${POSTGRESQL_VERSIONS} ; do
1717
-e BF_DEBUG=0 \
1818
bfren/alpine esh \
1919
"/ws/Dockerfile.esh" \
20-
BASE_REVISION=${BASE_REVISION} \
20+
BASE_VERSION=${BASE_VERSION} \
2121
POSTGRESQL_MAJOR=${V}
2222
)
2323

overlay/etc/bf/ch.d/10-postgresql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/backup postgres:postgres 0770 0750
2-
/data postgres:postgres 0770 0750
3-
/run/postgresql postgres:postgres 0770 0750
4-
/usr/bin/bf/db-exists root:root 0555
1+
/backup postgres:postgres 0600 0700
2+
/data postgres:postgres 0600 0700
3+
/run/postgresql postgres:postgres 0600 0700

0 commit comments

Comments
 (0)