File tree 8 files changed +239
-15
lines changed
8 files changed +239
-15
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ RUN mkdir /docker-entrypoint-initdb.d
24
24
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
25
25
26
26
ENV PG_MAJOR 9.4
27
- ENV PG_VERSION 9.4~beta3 -1.pgdg70+1
27
+ ENV PG_VERSION 9.4~rc1 -1.pgdg70+1
28
28
29
29
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
30
30
Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
Original file line number Diff line number Diff line change @@ -9,8 +9,40 @@ if [ "$1" = 'postgres' ]; then
9
9
10
10
sed -ri " s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" " $PGDATA " /postgresql.conf
11
11
12
- { echo ; echo ' host all all 0.0.0.0/0 trust' ; } >> " $PGDATA " /pg_hba.conf
13
-
12
+ # check password first so we can ouptut the warning before postgres
13
+ # messes it up
14
+ if [ " $POSTGRES_PASSWORD " ]; then
15
+ pass=" PASSWORD '$POSTGRES_PASSWORD '"
16
+ authMethod=md5
17
+ else
18
+ # The - option suppresses leading tabs but *not* spaces. :)
19
+ cat >&2 << -'EOWARN '
20
+ ****************************************************
21
+ WARNING: No password has been set for the database.
22
+ Use "-e POSTGRES_PASSWORD=password" to set
23
+ it in "docker run".
24
+ ****************************************************
25
+ EOWARN
26
+
27
+ pass=
28
+ authMethod=trust
29
+ fi
30
+
31
+ : ${POSTGRES_USER:= postgres}
32
+ if [ " $POSTGRES_USER " = ' postgres' ]; then
33
+ op=' ALTER'
34
+ else
35
+ op=' CREATE'
36
+ gosu postgres postgres --single -E << -EOSQL
37
+ CREATE DATABASE "$POSTGRES_USER "
38
+ EOSQL
39
+ fi
40
+
41
+ gosu postgres postgres --single << -EOSQL
42
+ $op USER "$POSTGRES_USER " WITH SUPERUSER $pass
43
+ EOSQL
44
+ { echo ; echo " host all \" $POSTGRES_USER \" 0.0.0.0/0 $authMethod " ; } >> " $PGDATA " /pg_hba.conf
45
+
14
46
if [ -d /docker-entrypoint-initdb.d ]; then
15
47
for f in /docker-entrypoint-initdb.d/* .sh; do
16
48
[ -f " $f " ] && . " $f "
You can’t perform that action at this time.
0 commit comments