Skip to content

Commit c3f273d

Browse files
committed
chore(postgres): upgrade to pg13
1 parent 47656c0 commit c3f273d

8 files changed

Lines changed: 26 additions & 19 deletions

File tree

Dockerfile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
FROM minio/mc:RELEASE.2019-05-23T01-33-27Z as mc
1+
FROM minio/mc:RELEASE.2020-07-17T02-52-20Z as mc
22

3-
FROM postgres:11-alpine
3+
FROM postgres:13-alpine
44

55
COPY rootfs /
66
COPY --from=mc /usr/bin/mc /bin/mc
77

88
ENV PGDATA $PGDATA/$PG_MAJOR
99
ENV WALG_ENVDIR /etc/wal-g.d/env
10-
ADD https://github.com/wal-g/wal-g/releases/download/v0.2.9/wal-g.linux-amd64.tar.gz /bin
10+
ADD https://github.com/wal-g/wal-g/releases/download/v0.2.16/wal-g.linux-amd64.tar.gz /bin
1111

12-
RUN mkdir -p $WALG_ENVDIR \
12+
RUN sed -i s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g /etc/apk/repositories \
13+
&& mkdir -p $WALG_ENVDIR \
1314
&& tar -xvzf /bin/wal-g.linux-amd64.tar.gz -C /bin && rm /bin/wal-g.linux-amd64.tar.gz \
14-
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk \
15-
&& apk add --allow-untrusted glibc-2.28-r0.apk \
16-
&& rm glibc-2.28-r0.apk \
17-
&& apk add --no-cache jq python3 \
18-
&& pip3 install --upgrade pip setuptools \
19-
&& pip install envdir
15+
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk \
16+
&& apk add --allow-untrusted glibc-2.31-r0.apk \
17+
&& rm glibc-2.31-r0.apk \
18+
&& apk add --no-cache jq python3 curl \
19+
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
20+
&& python3 get-pip.py \
21+
&& rm -rf get-pip.py \
22+
&& pip3 install envdir
2023

2124
CMD ["/docker-entrypoint.sh", "postgres"]
2225
EXPOSE 5432

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SHELL_SCRIPTS = $(wildcard _scripts/*.sh contrib/ci/*.sh rootfs/bin/*)
1212

1313
# The following variables describe the containerized development environment
1414
# and other build options
15-
DEV_ENV_IMAGE := quay.io/drycc/go-dev:v0.22.0
15+
DEV_ENV_IMAGE := drycc/go-dev
1616
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
1717
DEV_ENV_CMD := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR} ${DEV_ENV_IMAGE}
1818
DEV_ENV_CMD_INT := docker run -it --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR} ${DEV_ENV_IMAGE}

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Drycc Postgres
33

44
[![Build Status](https://travis-ci.org/drycc/postgres.svg?branch=master)](https://travis-ci.org/drycc/postgres)
5-
[![Docker Repository on Quay](https://quay.io/repository/drycc/postgres/status "Docker Repository on Quay")](https://quay.io/repository/drycc/postgres)
65

76
Drycc (pronounced DAY-iss) Workflow is an open source Platform as a Service (PaaS) that adds a developer-friendly layer to any [Kubernetes](http://kubernetes.io) cluster, making it easy to deploy and manage applications on your own servers.
87

@@ -47,15 +46,15 @@ This project has a [Makefile](https://github.com/drycc/postgres/blob/master/Make
4746

4847
* `DRYCC_REGISTRY` - A Docker registry that you have push access to and your Kubernetes cluster can pull from
4948
* If this is [Docker Hub](https://hub.docker.com/), leave this variable empty
50-
* Otherwise, ensure it has a trailing `/`. For example, if you're using [Quay.io](https://quay.io), use `quay.io/`
49+
* Otherwise, ensure it has a trailing `/`
5150
* `IMAGE_PREFIX` - The organization in the Docker repository. This defaults to `drycc`, but if you don't have access to that organization, set this to one you have push access to.
5251
* `SHORT_NAME` (optional) - The name of the image. This defaults to `postgres`
5352
* `VERSION` (optional) - The tag of the Docker image. This defaults to the current Git SHA (the output of `git rev-parse --short HEAD`)
5453

55-
Assuming you have these variables set correctly, run `make docker-build` to build the new image, and `make docker-push` to push it. Here is an example command that would push to `quay.io/arschles/postgres:devel`:
54+
Assuming you have these variables set correctly, run `make docker-build` to build the new image, and `make docker-push` to push it. Here is an example command that would push to `example.com/arschles/postgres:devel`:
5655

5756
```console
58-
export DRYCC_REGISTRY=quay.io/
57+
export DRYCC_REGISTRY=example.com/
5958
export IMAGE_PREFIX=arschles
6059
export VERSION=devel
6160
make docker-build docker-push

contrib/ci/test-minio.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ MINIO_JOB=$(docker run -d \
3232
-v "${CURRENT_DIR}"/tmp/aws-user:/var/run/secrets/drycc/objectstore/creds \
3333
drycc/minio:v1.0.1 server /home/minio/)
3434

35+
36+
puts-step "minio starting, wait 30s."
37+
sleep 30
38+
3539
# boot postgres, linking the minio container and setting DRYCC_MINIO_SERVICE_HOST and DRYCC_MINIO_SERVICE_PORT
3640
PG_CMD="docker run -d --link ${MINIO_JOB}:minio -e PGCTLTIMEOUT=1200 \
3741
-e BACKUP_FREQUENCY=1s -e DATABASE_STORAGE=minio \

rootfs/bin/create_bucket

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
# shellcheck disable=SC1091
44
source /bin/normalize_storage
55
has_bucket=$(mc ls minio -json|jq -r '.key'|grep -w "${MINIO_BUCKET}")
6-
if [ ! -n "$has_bucket" ] ;then
6+
if [ -z "$has_bucket" ] ;then
77
mc mb minio/"${MINIO_BUCKET}"
88
fi

rootfs/bin/do_backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
export BACKUPS_TO_RETAIN=${BACKUPS_TO_RETAIN:-5}
44

55
echo "Performing a base backup..."
6-
if [[ -f "$PGDATA/recovery.conf" ]] ; then
6+
if [[ -f "$PGDATA/recovery.signal" ]] ; then
77
echo "Database is currently recovering from a backup. Aborting"
88
sleep 9
99
else

rootfs/bin/is_running

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# fail fast
44
set -e
55

6-
if [[ -f "$PGDATA/recovery.conf" ]]; then
6+
if [[ -f "$PGDATA/recovery.signal" ]]; then
77
# postgres is in recovery mode, so we know it's not ready to accept incoming connections.
88
exit 1
99
fi

rootfs/docker-entrypoint-initdb.d/003_restore_from_backup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ archive_command = 'envdir "${WALG_ENVDIR}" wal-g wal-push %p'
2626
archive_timeout = 60
2727
listen_addresses = '*'
2828
max_connections = 1024
29+
restore_command = 'envdir "${WALG_ENVDIR}" wal-g wal-fetch \"%f\" \"%p\"'
2930
EOF
3031
cat << EOF > "$PGDATA/pg_hba.conf"
3132
# "local" is for Unix domain socket connections only
@@ -38,7 +39,7 @@ host all all ::1/128 trust
3839
host all all 0.0.0.0/0 md5
3940
EOF
4041
touch "$PGDATA/pg_ident.conf"
41-
echo "restore_command = 'envdir "${WALG_ENVDIR}" wal-g wal-fetch \"%f\" \"%p\"'" >> "$PGDATA/recovery.conf"
42+
touch "$PGDATA/recovery.signal"
4243
chown -R postgres:postgres "$PGDATA"
4344
chmod 0700 "$PGDATA"
4445
su-exec postgres pg_ctl -D "$PGDATA" \

0 commit comments

Comments
 (0)