Skip to content
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

feat: Add pgrouting and fix pgcron packages #32

Merged
merged 9 commits into from
Oct 19, 2024
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
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM postgres:17-bullseye

ENV POSTGIS_MAJOR 3
ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1
ENV POSTGRES_INITDB_ARGS "--data-checksums"
LABEL maintainer="HIPAA Postgres w/ PostGIS Project" \
org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 17 bullseye" \
org.opencontainers.image.source="https://github.com/netreconlab/hipaa-postgres/"

ENV POSTGIS_MAJOR=3
ENV POSTGIS_VERSION=3.5.0+dfsg-1.pgdg110+1
ENV POSTGRES_INITDB_ARGS="--data-checksums"

RUN apt-get update \
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
Expand All @@ -17,6 +21,7 @@ RUN apt-get update \
postgresql-$PG_MAJOR-set-user \
postgresql-$PG_MAJOR-repack \
postgresql-$PG_MAJOR-cron \
postgresql-$PG_MAJOR-pgrouting \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /docker-entrypoint-initdb.d

Expand All @@ -43,4 +48,4 @@ RUN chmod +x /docker-entrypoint-initdb.d/setup-0-pgaudit.sh \
/usr/local/bin/setup-parse-index.sh

USER postgres
CMD ["postgres", "-c", "shared_preload_libraries=pgaudit"]
CMD ["postgres", "-c", "shared_preload_libraries=pg_stat_statements,pgaudit,pg_cron"]
14 changes: 10 additions & 4 deletions Dockerfile.pgpool
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM postgres:17-bullseye

ENV POSTGIS_MAJOR 3
ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1
ENV POSTGRES_INITDB_ARGS "--data-checksums"
LABEL maintainer="HIPAA Postgres w/ PostGIS Project" \
org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension and PGPool with PostgreSQL 17 bullseye" \
org.opencontainers.image.source="https://github.com/netreconlab/hipaa-postgres/"

ENV POSTGIS_MAJOR=3
ENV POSTGIS_VERSION=3.5.0+dfsg-1.pgdg110+1
ENV POSTGRES_INITDB_ARGS="--data-checksums"

RUN apt-get update \
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
Expand All @@ -20,6 +24,8 @@ RUN apt-get update \
postgresql-$PG_MAJOR-pgaudit \
postgresql-$PG_MAJOR-set-user \
postgresql-$PG_MAJOR-repack \
postgresql-$PG_MAJOR-cron \
postgresql-$PG_MAJOR-pgrouting \
postgresql-$PG_MAJOR-pgpool2\
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /docker-entrypoint-initdb.d
Expand Down Expand Up @@ -47,5 +53,5 @@ RUN chmod +x /docker-entrypoint-initdb.d/setup-0-pgaudit.sh \
/usr/local/bin/setup-parse-index.sh

USER postgres
CMD ["postgres", "-c", "shared_preload_libraries=pgaudit"]
CMD ["postgres", "-c", "shared_preload_libraries=pg_stat_statements,pgaudit,pg_cron"]
EXPOSE 22
2 changes: 1 addition & 1 deletion scripts/setup-0-pgaudit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ EOF

set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
\c template1;
CREATE EXTENSION pgaudit;
ALTER SYSTEM SET pgaudit.log_catalog = off;
ALTER SYSTEM SET pgaudit.log = 'all, -misc';
ALTER SYSTEM SET pgaudit.log_relation = 'on';
ALTER SYSTEM SET pgaudit.log_parameter = 'on';
ALTER SYSTEM SET shared_preload_libraries = 'set-user';
EOSQL

exec "$@"
1 change: 1 addition & 0 deletions scripts/setup-3-pg_repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
\c template1;
CREATE EXTENSION pg_repack;
EOSQL

Expand Down
3 changes: 1 addition & 2 deletions scripts/setup-4-pgstatstatements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ track_io_timing = on # Capture read/write stats
EOF

set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "postgres" <<-EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE EXTENSION pg_stat_statements SCHEMA public;
ALTER SYSTEM SET shared_preload_libraries = 'set-user, pg_stat_statements';
EOSQL

exec "$@"
12 changes: 9 additions & 3 deletions scripts/setup-dbs.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#!/bin/bash

cat >> ${PGDATA}/postgresql.conf <<EOF
cron.database_name = '$POSTGRES_DB'
shared_preload_libraries = 'set-user, pg_stat_statements, pgaudit, pg_cron'
EOF

set -e
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" --dbname "${POSTGRES_DB}" <<-EOSQL
CREATE USER ${PG_PARSE_USER} LOGIN CONNECTION LIMIT 100 ENCRYPTED PASSWORD '${PG_PARSE_PASSWORD}';
CREATE DATABASE ${PG_PARSE_DB} OWNER ${PG_PARSE_USER};
CREATE EXTENSION pg_cron;
\c ${PG_PARSE_DB};
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION pg_repack;
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS pgrouting;
EOSQL

exec "$@"