Skip to content

Commit 7111ef7

Browse files
committed
Run update.sh
1 parent 486194c commit 7111ef7

7 files changed

+39
-123
lines changed

9.0/docker-entrypoint.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ if [ "$1" = 'postgres' ]; then
4444

4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

47-
set_listen_addresses '' # we're going to start up postgres, but it's not ready for use yet (this is initialization), so don't listen to the outside world yet
48-
49-
gosu postgres "$@" &
50-
pid="$!"
51-
for i in {30..0}; do
52-
if echo 'SELECT 1' | psql --username postgres &> /dev/null; then
53-
break
54-
fi
55-
echo 'PostgreSQL init process in progress...'
56-
sleep 1
57-
done
58-
if [ "$i" = 0 ]; then
59-
echo >&2 'PostgreSQL init process failed'
60-
exit 1
61-
fi
47+
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
49+
gosu postgres pg_ctl -D "$PGDATA" \
50+
-o "-c listen_addresses=''" \
51+
-w start
6252

6353
: ${POSTGRES_USER:=postgres}
6454
: ${POSTGRES_DB:=$POSTGRES_USER}
@@ -91,11 +81,7 @@ if [ "$1" = 'postgres' ]; then
9181
echo
9282
done
9383

94-
if ! kill -s TERM "$pid" || ! wait "$pid"; then
95-
echo >&2 'PostgreSQL init process failed'
96-
exit 1
97-
fi
98-
84+
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
9985
set_listen_addresses '*'
10086

10187
echo

9.1/docker-entrypoint.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ if [ "$1" = 'postgres' ]; then
4444

4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

47-
set_listen_addresses '' # we're going to start up postgres, but it's not ready for use yet (this is initialization), so don't listen to the outside world yet
48-
49-
gosu postgres "$@" &
50-
pid="$!"
51-
for i in {30..0}; do
52-
if echo 'SELECT 1' | psql --username postgres &> /dev/null; then
53-
break
54-
fi
55-
echo 'PostgreSQL init process in progress...'
56-
sleep 1
57-
done
58-
if [ "$i" = 0 ]; then
59-
echo >&2 'PostgreSQL init process failed'
60-
exit 1
61-
fi
47+
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
49+
gosu postgres pg_ctl -D "$PGDATA" \
50+
-o "-c listen_addresses=''" \
51+
-w start
6252

6353
: ${POSTGRES_USER:=postgres}
6454
: ${POSTGRES_DB:=$POSTGRES_USER}
@@ -91,11 +81,7 @@ if [ "$1" = 'postgres' ]; then
9181
echo
9282
done
9383

94-
if ! kill -s TERM "$pid" || ! wait "$pid"; then
95-
echo >&2 'PostgreSQL init process failed'
96-
exit 1
97-
fi
98-
84+
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
9985
set_listen_addresses '*'
10086

10187
echo

9.2/docker-entrypoint.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ if [ "$1" = 'postgres' ]; then
4444

4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

47-
set_listen_addresses '' # we're going to start up postgres, but it's not ready for use yet (this is initialization), so don't listen to the outside world yet
48-
49-
gosu postgres "$@" &
50-
pid="$!"
51-
for i in {30..0}; do
52-
if echo 'SELECT 1' | psql --username postgres &> /dev/null; then
53-
break
54-
fi
55-
echo 'PostgreSQL init process in progress...'
56-
sleep 1
57-
done
58-
if [ "$i" = 0 ]; then
59-
echo >&2 'PostgreSQL init process failed'
60-
exit 1
61-
fi
47+
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
49+
gosu postgres pg_ctl -D "$PGDATA" \
50+
-o "-c listen_addresses=''" \
51+
-w start
6252

6353
: ${POSTGRES_USER:=postgres}
6454
: ${POSTGRES_DB:=$POSTGRES_USER}
@@ -91,11 +81,7 @@ if [ "$1" = 'postgres' ]; then
9181
echo
9282
done
9383

94-
if ! kill -s TERM "$pid" || ! wait "$pid"; then
95-
echo >&2 'PostgreSQL init process failed'
96-
exit 1
97-
fi
98-
84+
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
9985
set_listen_addresses '*'
10086

10187
echo

9.3/docker-entrypoint.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ if [ "$1" = 'postgres' ]; then
4444

4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

47-
set_listen_addresses '' # we're going to start up postgres, but it's not ready for use yet (this is initialization), so don't listen to the outside world yet
48-
49-
gosu postgres "$@" &
50-
pid="$!"
51-
for i in {30..0}; do
52-
if echo 'SELECT 1' | psql --username postgres &> /dev/null; then
53-
break
54-
fi
55-
echo 'PostgreSQL init process in progress...'
56-
sleep 1
57-
done
58-
if [ "$i" = 0 ]; then
59-
echo >&2 'PostgreSQL init process failed'
60-
exit 1
61-
fi
47+
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
49+
gosu postgres pg_ctl -D "$PGDATA" \
50+
-o "-c listen_addresses=''" \
51+
-w start
6252

6353
: ${POSTGRES_USER:=postgres}
6454
: ${POSTGRES_DB:=$POSTGRES_USER}
@@ -91,11 +81,7 @@ if [ "$1" = 'postgres' ]; then
9181
echo
9282
done
9383

94-
if ! kill -s TERM "$pid" || ! wait "$pid"; then
95-
echo >&2 'PostgreSQL init process failed'
96-
exit 1
97-
fi
98-
84+
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
9985
set_listen_addresses '*'
10086

10187
echo

9.4/docker-entrypoint.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ if [ "$1" = 'postgres' ]; then
4444

4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

47-
set_listen_addresses '' # we're going to start up postgres, but it's not ready for use yet (this is initialization), so don't listen to the outside world yet
48-
49-
gosu postgres "$@" &
50-
pid="$!"
51-
for i in {30..0}; do
52-
if echo 'SELECT 1' | psql --username postgres &> /dev/null; then
53-
break
54-
fi
55-
echo 'PostgreSQL init process in progress...'
56-
sleep 1
57-
done
58-
if [ "$i" = 0 ]; then
59-
echo >&2 'PostgreSQL init process failed'
60-
exit 1
61-
fi
47+
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
49+
gosu postgres pg_ctl -D "$PGDATA" \
50+
-o "-c listen_addresses=''" \
51+
-w start
6252

6353
: ${POSTGRES_USER:=postgres}
6454
: ${POSTGRES_DB:=$POSTGRES_USER}
@@ -91,11 +81,7 @@ if [ "$1" = 'postgres' ]; then
9181
echo
9282
done
9383

94-
if ! kill -s TERM "$pid" || ! wait "$pid"; then
95-
echo >&2 'PostgreSQL init process failed'
96-
exit 1
97-
fi
98-
84+
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
9985
set_listen_addresses '*'
10086

10187
echo

9.5/docker-entrypoint.sh

+6-20
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,11 @@ if [ "$1" = 'postgres' ]; then
4444

4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

47-
set_listen_addresses '' # we're going to start up postgres, but it's not ready for use yet (this is initialization), so don't listen to the outside world yet
48-
49-
gosu postgres "$@" &
50-
pid="$!"
51-
for i in {30..0}; do
52-
if echo 'SELECT 1' | psql --username postgres &> /dev/null; then
53-
break
54-
fi
55-
echo 'PostgreSQL init process in progress...'
56-
sleep 1
57-
done
58-
if [ "$i" = 0 ]; then
59-
echo >&2 'PostgreSQL init process failed'
60-
exit 1
61-
fi
47+
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
49+
gosu postgres pg_ctl -D "$PGDATA" \
50+
-o "-c listen_addresses=''" \
51+
-w start
6252

6353
: ${POSTGRES_USER:=postgres}
6454
: ${POSTGRES_DB:=$POSTGRES_USER}
@@ -91,11 +81,7 @@ if [ "$1" = 'postgres' ]; then
9181
echo
9282
done
9383

94-
if ! kill -s TERM "$pid" || ! wait "$pid"; then
95-
echo >&2 'PostgreSQL init process failed'
96-
exit 1
97-
fi
98-
84+
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
9985
set_listen_addresses '*'
10086

10187
echo

docker-entrypoint.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ if [ "$1" = 'postgres' ]; then
4545
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
4646

4747
# internal start of server in order to allow set-up using psql-client
48+
# does not listen on TCP/IP and waits until start finishes
4849
gosu postgres pg_ctl -D "$PGDATA" \
49-
-o "-c listen_addresses=''" \
50-
-w start # does not listen on TCP/IP and waits
51-
# until start finishes
50+
-o "-c listen_addresses=''" \
51+
-w start
5252

5353
: ${POSTGRES_USER:=postgres}
5454
: ${POSTGRES_DB:=$POSTGRES_USER}

0 commit comments

Comments
 (0)