Skip to content

Commit

Permalink
(maint) Make Docker Postgres configurable
Browse files Browse the repository at this point in the history
 - Prior to this commit, the wait script would wait on the host named
   'postgres' with a fixed port of '5432', which is quite inflexible.

   In testing the Pupperware stack, it's necessary to change the host
   to `postgres.local` to align with other hosts.

   This will allow that configuration change to be made more easily
   at runtime
  • Loading branch information
Iristyle committed May 2, 2019
1 parent fe9104f commit b1ee76e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 9 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ The following environment variables are supported:

Set to 'false' to skip acquiring SSL certificates from a Puppet Server. Defaults to 'true'.

- `PUPPETDB_POSTGRES_HOSTNAME`

The DNS name of the Postgres host to use when performing initial health checks and when connecting to the database. Defaults to 'postgres'.

- `PUPPETDB_POSTGRES_PORT`

The port of the Postgres host to use when performing initial health checks and when connecting to the database. Defaults to '5432'.

- `PUPPETDB_DATABASE_CONNECTION`

The value for the 'subname' field in puppetdb/conf.d/database.conf. Defaults to '//postgres:5432/puppetdb'.
The value for the 'subname' field in puppetdb/conf.d/database.conf. Defaults to '//$PUPPETDB_POSTGRES_HOSTNAME:$PUPPETDB_POSTGRES_PORT/puppetdb', which is '//postgres:5432/puppetdb' by default

- `PUPPETDB_USER`

Expand Down
4 changes: 3 additions & 1 deletion docker/puppetdb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ ENV PUPPERWARE_ANALYTICS_STREAM="$pupperware_analytics_stream"
ENV PUPPERWARE_ANALYTICS_ENABLED=false

ENV PUPPETDB_VERSION="$version"
ENV PUPPETDB_DATABASE_CONNECTION="//postgres:5432/puppetdb"
ENV PUPPETDB_POSTGRES_HOSTNAME="postgres"
ENV PUPPETDB_POSTGRES_PORT="5432"
ENV PUPPETDB_DATABASE_CONNECTION="//${PUPPETDB_POSTGRES_HOSTNAME}:${PUPPETDB_POSTGRES_PORT}/puppetdb"
ENV PUPPETDB_USER=puppetdb
ENV PUPPETDB_PASSWORD=puppetdb
ENV PUPPETDB_NODE_TTL=7d
Expand Down
2 changes: 1 addition & 1 deletion docker/puppetdb/docker-entrypoint.d/20-wait-for-hosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PUPPETSERVER_HOSTNAME="${PUPPETSERVER_HOSTNAME:-puppet}"
CONSUL_HOSTNAME="${CONSUL_HOSTNAME:-consul}"
CONSUL_PORT="${CONSUL_PORT:-8500}"

wait_for_host_port "postgres" "5432" $PUPPETDB_WAITFORPOSTGRES_SECONDS
wait_for_host_port "${PUPPETDB_POSTGRES_HOSTNAME:-postgres}" "${PUPPETDB_POSTGRES_PORT:-5432}" $PUPPETDB_WAITFORPOSTGRES_SECONDS

if [ "$USE_PUPPETSERVER" = true ]; then
wait_for_host $PUPPETSERVER_HOSTNAME
Expand Down

0 comments on commit b1ee76e

Please sign in to comment.