1
0
mirror of https://github.com/docker-library/postgres.git synced 2025-11-17 13:02:40 +03:00

Merge pull request #224 from DanielDent/master

POSTGRES_XLOG_DIR to specify transaction log dir
This commit is contained in:
Tianon Gravi
2017-03-20 10:10:03 -07:00
committed by GitHub
11 changed files with 110 additions and 0 deletions

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec su-exec postgres "$BASH_SOURCE" "$@" exec su-exec postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec gosu postgres "$BASH_SOURCE" "$@" exec gosu postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec su-exec postgres "$BASH_SOURCE" "$@" exec su-exec postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec gosu postgres "$BASH_SOURCE" "$@" exec gosu postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec su-exec postgres "$BASH_SOURCE" "$@" exec su-exec postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec gosu postgres "$BASH_SOURCE" "$@" exec gosu postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec su-exec postgres "$BASH_SOURCE" "$@" exec su-exec postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec gosu postgres "$BASH_SOURCE" "$@" exec gosu postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec su-exec postgres "$BASH_SOURCE" "$@" exec su-exec postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec gosu postgres "$BASH_SOURCE" "$@" exec gosu postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres

View File

@@ -37,6 +37,13 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
chown -R postgres /var/run/postgresql chown -R postgres /var/run/postgresql
chmod g+s /var/run/postgresql chmod g+s /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"
fi
exec gosu postgres "$BASH_SOURCE" "$@" exec gosu postgres "$BASH_SOURCE" "$@"
fi fi
@@ -48,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
# look specifically for PG_VERSION, as it is expected in the DB dir # look specifically for PG_VERSION, as it is expected in the DB dir
if [ ! -s "$PGDATA/PG_VERSION" ]; then if [ ! -s "$PGDATA/PG_VERSION" ]; then
file_env 'POSTGRES_INITDB_ARGS' file_env 'POSTGRES_INITDB_ARGS'
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
fi
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS" eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
# check password first so we can output the warning before postgres # check password first so we can output the warning before postgres