Skip to content

Commit

Permalink
Merge pull request #44 from woblerr/add_backrest_2_51
Browse files Browse the repository at this point in the history
  • Loading branch information
woblerr authored Apr 5, 2024
2 parents db52111 + f21d424 commit 8cadebb
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pgbackrest_version: ["2.46", "2.47", "2.48", "2.49", "2.50"]
pgbackrest_version: ["2.47", "2.48", "2.49", "2.50", "2.51"]
env:
latest_version: "2.50"
latest_version: "2.51"
download_url: "https://github.com/pgbackrest/pgbackrest/archive/release"
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pgbackrest_version: ["2.40_arenadata2", "2.45_arenadata3", "2.47_arenadata4", "2.50_arenadata4"]
pgbackrest_version: ["2.45_arenadata3", "2.47_arenadata4", "2.50_arenadata4"]
env:
download_url: "https://github.com/arenadata/pgbackrest/archive"
steps:
Expand Down
97 changes: 97 additions & 0 deletions Dockerfile_meson
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM ubuntu:22.04 AS builder

ARG BACKREST_VERSION
ARG BACKREST_DOWNLOAD_URL="https://github.com/pgbackrest/pgbackrest/archive/release"
ARG BACKREST_COMPLETION_VERSION
ARG BACKREST_COMPLETION_VERSION_URL="https://github.com/woblerr/pgbackrest-bash-completion/archive"

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
meson \
gcc \
libpq-dev \
libssl-dev \
libxml2-dev \
pkg-config \
liblz4-dev \
libzstd-dev \
libbz2-dev \
libz-dev \
libyaml-dev \
libssh2-1-dev \
wget \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN wget ${BACKREST_DOWNLOAD_URL}/${BACKREST_VERSION}.tar.gz -O /tmp/pgbackrest-${BACKREST_VERSION}.tar.gz \
&& mkdir -p /tmp/pgbackrest-release /tmp/pgbackrest-build \
&& tar -xzf /tmp/pgbackrest-${BACKREST_VERSION}.tar.gz --strip-components=1 -C /tmp/pgbackrest-release \
&& meson setup /tmp/pgbackrest-build /tmp/pgbackrest-release \
&& ninja -C /tmp/pgbackrest-build

RUN wget ${BACKREST_COMPLETION_VERSION_URL}/${BACKREST_COMPLETION_VERSION}.tar.gz -O /tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz \
&& tar -xzf /tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz -C /tmp \
&& mv /tmp/pgbackrest-bash-completion-$(echo ${BACKREST_COMPLETION_VERSION} | tr -d v) /tmp/pgbackrest-bash-completion

FROM ubuntu:22.04

ARG REPO_BUILD_TAG

ENV TZ="Etc/UTC" \
BACKREST_USER="pgbackrest" \
BACKREST_UID=2001 \
BACKREST_GROUP="pgbackrest" \
BACKREST_GID=2001 \
BACKREST_HOST_TYPE="ssh" \
BACKREST_TLS_WAIT=15 \
BACKREST_TLS_SERVER="disable"

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
postgresql-client \
ca-certificates \
tzdata \
libxml2 \
libssh2-1 \
gosu \
openssh-client \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd --gid ${BACKREST_GID} ${BACKREST_GROUP} \
&& useradd --shell /bin/bash --uid ${BACKREST_UID} --gid ${BACKREST_GID} -m ${BACKREST_USER} \
&& mkdir -p -m 750 \
/home/${BACKREST_USER}/.bash_completion.d \
/var/log/pgbackrest \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/etc/pgbackrest/conf.d \
/etc/pgbackrest/cert \
/tmp/pgbackrest \
&& touch /etc/pgbackrest/pgbackrest.conf \
&& chmod 640 /etc/pgbackrest/pgbackrest.conf \
&& chown -R ${BACKREST_USER}:${BACKREST_GROUP} \
/home/${BACKREST_USER}/.bash_completion.d \
/var/log/pgbackrest \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/tmp/pgbackrest \
&& unlink /etc/localtime \
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo "${TZ}" > /etc/timezone

COPY --chmod=755 files/entrypoint.sh /entrypoint.sh
COPY --from=builder --chown=${BACKREST_USER}:${BACKREST_GROUP} /tmp/pgbackrest-bash-completion/pgbackrest-completion.sh /home/${BACKREST_USER}/.bash_completion.d/pgbackrest-completion.sh
COPY --from=builder /tmp/pgbackrest-build/src/pgbackrest /usr/bin/pgbackrest

LABEL \
org.opencontainers.image.version="${REPO_BUILD_TAG}" \
org.opencontainers.image.source="https://github.com/woblerr/docker-pgbackrest"

ENTRYPOINT ["/entrypoint.sh"]

CMD ["pgbackrest", "version"]
96 changes: 96 additions & 0 deletions Dockerfile_meson.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FROM alpine:3.19

ARG BACKREST_VERSION
ARG BACKREST_DOWNLOAD_URL="https://github.com/pgbackrest/pgbackrest/archive/release"
ARG BACKREST_COMPLETION_VERSION
ARG BACKREST_COMPLETION_VERSION_URL="https://github.com/woblerr/pgbackrest-bash-completion/archive"
ARG REPO_BUILD_TAG

ENV TZ="Etc/UTC" \
BACKREST_USER="pgbackrest" \
BACKREST_UID=2001 \
BACKREST_GROUP="pgbackrest" \
BACKREST_GID=2001 \
BACKREST_HOST_TYPE="ssh" \
BACKREST_TLS_WAIT=15 \
BACKREST_TLS_SERVER="disable"

RUN apk add --no-cache --update \
bash \
shadow \
postgresql-client \
ca-certificates \
libxml2 \
libssh2 \
su-exec \
procps \
tzdata \
openssh \
libbz2 \
lz4-libs \
zstd-libs \
&& apk --update add --virtual .backrest-build \
build-base \
wget \
meson \
gcc \
libpq-dev \
openssl-dev \
libxml2-dev \
pkgconfig \
lz4-dev \
zstd-dev \
bzip2-dev \
zlib-dev \
yaml-dev \
libssh2-dev \
&& ln -s /sbin/su-exec /usr/local/bin/gosu \
&& wget ${BACKREST_DOWNLOAD_URL}/${BACKREST_VERSION}.tar.gz -O /tmp/pgbackrest-${BACKREST_VERSION}.tar.gz \
&& mkdir -p /tmp/pgbackrest-release /tmp/pgbackrest-build \
&& tar -xzf /tmp/pgbackrest-${BACKREST_VERSION}.tar.gz --strip-components=1 -C /tmp/pgbackrest-release \
&& meson setup /tmp/pgbackrest-build /tmp/pgbackrest-release \
&& ninja -C /tmp/pgbackrest-build \
&& cp /tmp/pgbackrest-build/src/pgbackrest /usr/bin/pgbackrest \
&& groupadd --gid ${BACKREST_GID} ${BACKREST_GROUP} \
&& useradd --shell /bin/bash --uid ${BACKREST_UID} --gid ${BACKREST_GID} -m ${BACKREST_USER} \
&& wget ${BACKREST_COMPLETION_VERSION_URL}/${BACKREST_COMPLETION_VERSION}.tar.gz -O /tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz \
&& tar -xzf /tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz -C /tmp \
&& mv /tmp/pgbackrest-bash-completion-$(echo ${BACKREST_COMPLETION_VERSION} | tr -d v) /tmp/pgbackrest-bash-completion \
&& mkdir -p -m 750 /var/log/pgbackrest \
/home/${BACKREST_USER}/.bash_completion.d \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/etc/pgbackrest/conf.d \
/etc/pgbackrest/cert \
/tmp/pgbackrest \
&& cp /tmp/pgbackrest-bash-completion/pgbackrest-completion.sh /home/${BACKREST_USER}/.bash_completion.d/pgbackrest-completion.sh \
&& touch /etc/pgbackrest/pgbackrest.conf \
&& chmod 640 /etc/pgbackrest/pgbackrest.conf \
&& chown -R ${BACKREST_USER}:${BACKREST_GROUP} \
/home/${BACKREST_USER}/.bash_completion.d \
/var/log/pgbackrest \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/tmp/pgbackrest \
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo "${TZ}" > /etc/timezone \
&& rm -rf \
/tmp/pgbackrest-release \
/tmp/pgbackrest-build \
/tmp/pgbackrest-bash-completion \
/tmp/pgbackrest-${BACKREST_VERSION}.tar.gz \
/tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz \
&& apk del .backrest-build \
&& rm -rf /var/cache/apk/*

COPY --chmod=755 files/entrypoint.sh /entrypoint.sh

LABEL \
org.opencontainers.image.version="${REPO_BUILD_TAG}" \
org.opencontainers.image.source="https://github.com/woblerr/docker-pgbackrest"

ENTRYPOINT ["/entrypoint.sh"]

CMD ["pgbackrest", "version"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BACKREST_VERSIONS = 2.46 2.47 2.48 2.49 2.50
TAG?=2.50
BACKREST_VERSIONS = 2.47 2.48 2.49 2.50 2.51
TAG?=2.51
BACKREST_DOWNLOAD_URL = https://github.com/pgbackrest/pgbackrest/archive/release
BACKREST_GPDB_VERSIONS = 2.40_arenadata2 2.45_arenadata3 2.47_arenadata4 2.50_arenadata4
BACKREST_GPDB_VERSIONS = 2.45_arenadata3 2.47_arenadata4 2.50_arenadata4
TAG_GPDB?=2.50_arenadata4
BACKREST_GPDB_DOWNLOAD_URL = https://github.com/arenadata/pgbackrest/archive
BACKREST_COMP_VERSION?=v0.9
Expand Down
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ The repository contains information for the last 5 releases of pgBackRest. If ne

Supported pgBackRest version tags:

* `2.50`, `latest`
* `2.51`, `latest`
* `2.51-alpine`
* `2.50`,
* `2.50-alpine`
* `2.49`,
* `2.49-alpine`
* `2.48`,
* `2.48-alpine`
* `2.47`
* `2.47-alpine`
* `2.46`
* `2.46-alpine`

The repository also contains information for releases of pgBackRest fork with Greenplum support (see [pgbackrest/pull/1833](https://github.com/pgbackrest/pgbackrest/pull/1833)). Details - [build with Greenplum support](#build-with-greenplum-support).

The repository contains information for the last 3 releases of pgBackRest fork with Greenplum support. If necessary to use an older version - do a [manual build](#build).

Supported pgBackRest version tags with Greenplum support:
* `2.50-gpdb`
* `2.50-gpdb-alpine`
* `2.47-gpdb`
* `2.47-gpdb-alpine`
* `2.45-gpdb`
* `2.45-gpdb-alpine`
* `2.40-gpdb`
* `2.40-gpdb-alpine`

The image is based on the official ubuntu or alpine image. For ubuntu image each version of pgBackRest builds from the source code in a separate `builder` container. For alpine image each version of pgBackRest builds from the source code in container using virtual package `.backrest-build`.

Expand Down Expand Up @@ -77,16 +77,16 @@ You will need to mount the necessary directories or files inside the container (
### Simple

```bash
docker run --rm pgbackrest:2.50 pgbackrest help
docker run --rm pgbackrest:51 pgbackrest help
```

### Injecting inside

```bash
docker run --rm -it pgbackrest:2.50 bash
docker run --rm -it pgbackrest:2.51 bash

pgbackrest@cac1f58b56f2:/$ pgbackrest version
pgBackRest 2.50
pgBackRest 2.51
```

### Example for Dedicated Repository Host
Expand All @@ -102,7 +102,7 @@ docker run --rm \
-v ~/.ssh/id_rsa:/home/pgbackrest/.ssh/id_rsa \
-v /etc/pgbackrest:/etc/pgbackrest \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
pgbackrest:2.50 \
pgbackrest:2.51 \
pgbackrest backup --stanza demo --type full --log-level-console info
```

Expand All @@ -129,7 +129,7 @@ docker run --rm \
-v /etc/pgbackrest:/etc/pgbackrest \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
-v /tmp/pgbackrest:/tmp/pgbackrest \
pgbackrest:2.50 \
pgbackrest:2.51 \
pgbackrest backup --stanza demo --type full --log-level-console info
```

Expand Down Expand Up @@ -165,7 +165,7 @@ docker run -d \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
-p 8432:8432 \
--name backrest_server \
pgbackrest:2.50
pgbackrest:2.51
```

##### Run container with TLS server in background for pgBackRest execution over TLS
Expand All @@ -177,7 +177,7 @@ docker run --rm \
-e BACKREST_HOST_TYPE=tls \
-v /etc/pgbackrest:/etc/pgbackrest \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
pgbackrest:2.50 \
pgbackrest:2.51 \
pgbackrest backup --stanza demo --type full --log-level-console info
```

Expand All @@ -196,7 +196,7 @@ docker run --rm \
-v /var/lib/postgresql/12/main:/var/lib/postgresql/12/main \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
-v /var/run/postgresql/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432 \
pgbackrest:2.50 \
pgbackrest:2.51 \
pgbackrest backup --stanza demo --type full --log-level-console info
```

Expand All @@ -216,7 +216,7 @@ docker run -d \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
-p 8432:8432 \
--name backrest_server \
pgbackrest:2.50
pgbackrest:2.51
```

Performing a backup:
Expand All @@ -229,28 +229,28 @@ docker run --rm \
-v /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \
-v /etc/pgbackrest/cert:/etc/pgbackrest/cert \
-v /var/lib/pgbackrest:/var/lib/pgbackrest \
pgbackrest:2.50 \
pgbackrest:2.51 \
pgbackrest backup --stanza demo --type full --log-level-console info
```

## Build

```bash
make build_version TAG=2.50
make build_version TAG=2.51
```

```bash
make build_version_alpine TAG=2.50
make build_version_alpine TAG=2.51
```

or

```bash
docker build -f Dockerfile --build-arg BACKREST_VERSION=2.50 --build-arg BACKREST_COMPLETION_VERSION=v0.9 -t pgbackrest:2.50 .
docker build -f Dockerfile --build-arg BACKREST_VERSION=2.51 --build-arg BACKREST_COMPLETION_VERSION=v0.9 -t pgbackrest:2.51 .
```

```bash
docker build -f Dockerfile.alpine --build-arg BACKREST_VERSION=2.50 --build-arg BACKREST_COMPLETION_VERSION=v0.9 -t pgbackrest:2.50-alpine .
docker build -f Dockerfile.alpine --build-arg BACKREST_VERSION=2.51 --build-arg BACKREST_COMPLETION_VERSION=v0.9 -t pgbackrest:2.51-alpine .
```

## Build with Greenplum support
Expand Down
4 changes: 2 additions & 2 deletions e2e_tests/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TAG=2.50
PG_VERSION=13
TAG=2.51
PG_VERSION=16
IMAGE_TAG_MINIO=RELEASE.2023-09-07T02-05-02Z
IMAGE_TAG_MINIO_MC=RELEASE.2023-09-07T22-48-55Z
IMAGE_TAG_NGINX=1.19.2-alpine
Expand Down
2 changes: 1 addition & 1 deletion e2e_tests/conf/backup/backup_pgbackrest-ssh.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[demo]
pg1-path=/var/lib/postgresql/13/main
pg1-path=/var/lib/postgresql/16/main
pg1-host=pg-ssh
pg1-user=postgres
pg1-host-port=2222
Expand Down
2 changes: 1 addition & 1 deletion e2e_tests/conf/backup/backup_pgbackrest-tls.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[demo]
pg1-path=/var/lib/postgresql/13/main
pg1-path=/var/lib/postgresql/16/main
pg1-host=pg-tls
pg1-user=postgres
pg1-host-ca-file=/etc/pgbackrest/cert/pgbackrest-selfsigned-ca.crt
Expand Down
Loading

0 comments on commit 8cadebb

Please sign in to comment.