Skip to content

Refactor listen_addresses to be set in the sample file, and make the sample file easier to overwrite #127

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 2 commits into from
Mar 2, 2016
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
5 changes: 5 additions & 0 deletions 9.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ RUN apt-get update \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*

# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample

RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql

ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
Expand Down
8 changes: 3 additions & 5 deletions 9.1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi

if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
Expand Down Expand Up @@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done

gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down
5 changes: 5 additions & 0 deletions 9.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ RUN apt-get update \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*

# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample

RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql

ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
Expand Down
8 changes: 3 additions & 5 deletions 9.2/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi

if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
Expand Down Expand Up @@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done

gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down
5 changes: 5 additions & 0 deletions 9.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ RUN apt-get update \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*

# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample

RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql

ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
Expand Down
8 changes: 3 additions & 5 deletions 9.3/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi

if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
Expand Down Expand Up @@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done

gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down
5 changes: 5 additions & 0 deletions 9.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ RUN apt-get update \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*

# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample

RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql

ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
Expand Down
8 changes: 3 additions & 5 deletions 9.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi

if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
Expand Down Expand Up @@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done

gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down
5 changes: 5 additions & 0 deletions 9.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ RUN apt-get update \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*

# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample

RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql

ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
Expand Down
8 changes: 3 additions & 5 deletions 9.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi

if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
Expand Down Expand Up @@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done

gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ RUN apt-get update \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*

# make the sample config easier to munge (and "correct by default")
RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample

RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql

ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
Expand Down
8 changes: 3 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash
set -e

set_listen_addresses() {
sedEscapedValue="$(echo "$1" | sed 's/[\/&]/\\&/g')"
sed -ri "s/^#?(listen_addresses\s*=\s*)\S+/\1'$sedEscapedValue'/" "$PGDATA/postgresql.conf"
}
if [ "${1:0:1}" = '-' ]; then
set -- postgres "$@"
fi

if [ "$1" = 'postgres' ]; then
mkdir -p "$PGDATA"
Expand Down Expand Up @@ -88,7 +87,6 @@ if [ "$1" = 'postgres' ]; then
done

gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
set_listen_addresses '*'

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down