Skip to content

Postgres 10 renamed xlog to wal #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions 10/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chmod 775 /var/run/postgresql

# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
if [ "$POSTGRES_INITDB_WALDIR" ]; then
mkdir -p "$POSTGRES_INITDB_WALDIR"
chown -R postgres "$POSTGRES_INITDB_WALDIR"
chmod 700 "$POSTGRES_INITDB_WALDIR"
fi

exec su-exec postgres "$BASH_SOURCE" "$@"
Expand All @@ -55,8 +55,8 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
if [ "$POSTGRES_INITDB_WALDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"

Expand Down
12 changes: 6 additions & 6 deletions 10/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chmod 775 /var/run/postgresql

# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
if [ "$POSTGRES_INITDB_WALDIR" ]; then
mkdir -p "$POSTGRES_INITDB_WALDIR"
chown -R postgres "$POSTGRES_INITDB_WALDIR"
chmod 700 "$POSTGRES_INITDB_WALDIR"
fi

exec gosu postgres "$BASH_SOURCE" "$@"
Expand All @@ -55,8 +55,8 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
if [ "$POSTGRES_INITDB_WALDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"

Expand Down
12 changes: 6 additions & 6 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chmod 775 /var/run/postgresql

# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
if [ "$POSTGRES_INITDB_WALDIR" ]; then
mkdir -p "$POSTGRES_INITDB_WALDIR"
chown -R postgres "$POSTGRES_INITDB_WALDIR"
chmod 700 "$POSTGRES_INITDB_WALDIR"
fi

exec gosu postgres "$BASH_SOURCE" "$@"
Expand All @@ -55,8 +55,8 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
if [ "$POSTGRES_INITDB_WALDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"

Expand Down
13 changes: 12 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ for version in "${versions[@]}"; do

versionList="$(echo "${suitePackageList["$suite"]}"; curl -fsSL "${packagesBase}/${suite}-pgdg/${version}/binary-amd64/Packages.bz2" | bunzip2)"
fullVersion="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "postgresql-'"$version"'" { print $2; exit }' || true)"
majorVersion="${version%%.*}"

(
set -x
cp docker-entrypoint.sh "$version/"
Expand All @@ -51,7 +53,11 @@ for version in "${versions[@]}"; do
-e 's/%%DEBIAN_SUITE%%/'"$suite"'/g' \
-e 's/%%ARCH_LIST%%/'"${suiteArches["$suite"]}"'/g' \
Dockerfile-debian.template > "$version/Dockerfile"
if [ "$version" = '10' ]; then
if [ "$majorVersion" = '9' ]; then
sed -i -e 's/WALDIR/XLOGDIR/g' \
-e 's/waldir/xlogdir/g' \
"$version/docker-entrypoint.sh"
else
# postgresql-contrib-10 package does not exist, but is provided by postgresql-10
# Packages.gz:
# Package: postgresql-10
Expand Down Expand Up @@ -84,6 +90,11 @@ for version in "${versions[@]}"; do
# https://pkgs.alpinelinux.org/contents?file=prove&path=&name=&branch=&repo=&arch=x86_64
sed -ri 's/(\s+perl)(\s+)/\1-utils\2/' "$version/$variant/Dockerfile"
fi
if [ "$majorVersion" = '9' ]; then
sed -i -e 's/WALDIR/XLOGDIR/g' \
-e 's/waldir/xlogdir/g' \
"$version/$variant/docker-entrypoint.sh"
fi

# TODO remove all this when 9.3 is EOL (2018-10-01 -- from http://www.postgresql.org/support/versioning/)
case "$version" in
Expand Down