Skip to content

Commit

Permalink
Tidy up and push 11.7-4.tsdb_gis
Browse files Browse the repository at this point in the history
  • Loading branch information
ccakes committed Apr 15, 2020
1 parent 1f2c4fa commit 10f389a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 43 deletions.
18 changes: 4 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN \
# && strip /usr/lib/postgresql/${PG_MAJOR}/lib/timescaledb-tsl-${TIMESCALEDB_VERSION}.so

############################
# Final image with Patroni
# Add PostGIS and Patroni
############################
FROM postgres:11.7

Expand Down Expand Up @@ -87,24 +87,14 @@ RUN set -x \
# Cleanup
&& rm -rf /var/lib/apt/lists/* \
\
# Specify UID/GID
# && usermod -u 70 postgres \
# && groupmod -g 70 postgres \
# Add postgres to root group so it can read a private key for TLS
# See https://github.com/hashicorp/nomad/issues/5020
&& gpasswd -a postgres root
# && chown --recursive 70:70 /var/run/postgresql \
# && chown --recursive 70:70 /var/lib/postgresql

RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./files/000_shared_libs.sh /docker-entrypoint-initdb.d/000_shared_libs.sh
COPY ./files/001_initdb_postgis.sh /docker-entrypoint-initdb.d/001_initdb_postgis.sh
COPY ./files/002_install_timescaledb.sh /docker-entrypoint-initdb.d/002_install_timescaledb.sh
COPY ./files/003_timescaledb_tune.sh /docker-entrypoint-initdb.d/003_timescaledb_tune.sh
COPY ./files/002_timescaledb_tune.sh /docker-entrypoint-initdb.d/003_timescaledb_tune.sh

COPY ./files/update-postgis.sh /usr/local/bin
COPY ./files/docker-initdb.sh /usr/local/bin

EXPOSE 8008
EXPOSE 5432

USER postgres
CMD ["patroni", "/secrets/patroni.yml"]
2 changes: 2 additions & 0 deletions files/000_shared_libs.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
echo "timezone = 'UTC'" >> $PGDATA/postgresql.conf

echo "shared_preload_libraries = 'pg_stat_statements, timescaledb'" >> $PGDATA/postgresql.conf

echo "pg_stat_statements.max = 10000" >> $PGDATA/postgresql.conf
Expand Down
4 changes: 2 additions & 2 deletions files/001_initdb_postgis.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ set -e
export PGUSER="$POSTGRES_USER"

# Create the 'template_postgis' template db
"${psql[@]}" <<- 'EOSQL'
psql <<- 'EOSQL'
CREATE DATABASE template_postgis;
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';
EOSQL

# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
psql --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
Expand Down
27 changes: 0 additions & 27 deletions files/002_install_timescaledb.sh

This file was deleted.

File renamed without changes.
Empty file modified files/docker-initdb.sh
100644 → 100755
Empty file.
Empty file modified files/update-postgis.sh
100644 → 100755
Empty file.

0 comments on commit 10f389a

Please sign in to comment.