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

K8SPG-375: Install pg_repack and postgis by default #857

Merged
merged 5 commits into from
Nov 8, 2023
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
33 changes: 33 additions & 0 deletions postgresql-containers/bin/postgres-gis/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
SET application_name="container_setup";

create extension postgis;
create extension postgis_topology;
create extension fuzzystrmatch;
create extension postgis_tiger_geocoder;
create extension pg_stat_statements;
create extension pgaudit;

alter user postgres password 'PG_ROOT_PASSWORD';

create user "PG_PRIMARY_USER" with REPLICATION PASSWORD 'PG_PRIMARY_PASSWORD';
create user "PG_USER" with password 'PG_PASSWORD';

create table primarytable (key varchar(20), value varchar(20));
grant all on primarytable to "PG_PRIMARY_USER";

create database "PG_DATABASE";

grant all privileges on database "PG_DATABASE" to "PG_USER";

\c "PG_DATABASE"

create extension postgis;
create extension postgis_topology;
create extension fuzzystrmatch;
create extension postgis_tiger_geocoder;
create extension pg_stat_statements;
create extension pgaudit;

\c "PG_DATABASE" "PG_USER";

create schema "PG_USER";
31 changes: 31 additions & 0 deletions postgresql-containers/build/postgres-postgis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ARG PG_MAJOR=14
ARG PGO_TAG=main
ARG ORG_NAME=perconalab

FROM ${ORG_NAME}/percona-postgresql-operator:${PGO_TAG}-ppg${PG_MAJOR}-postgres

LABEL name="Percona PostgreSQL Distribution" \
vendor="Percona" \
summary="Percona Distribution for PostgreSQL" \
description="Percona Distribution for PostgreSQL is a collection of tools to assist you in managing your PostgreSQL database system" \
maintainer="Percona Development <[email protected]>"

USER 0

COPY build/postgres-postgis/oracle-linux-ol8.repo /etc/yum.repos.d/

RUN set -ex; \
curl -Lf -o /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8; \
microdnf -y install epel-release; \
microdnf -y module disable postgresql; \
microdnf -y --enablerepo="epel" install percona-postgis33 percona-postgis33-client

EXPOSE 5432

COPY bin/postgres-gis /opt/crunchy/bin/postgres

ENTRYPOINT ["/opt/crunchy/bin/uid_postgres.sh"]

USER 26

CMD ["/opt/crunchy/bin/start.sh"]
20 changes: 20 additions & 0 deletions postgresql-containers/build/postgres-postgis/oracle-linux-ol8.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[ol8_baseos_latest]
name=Oracle Linux 8 BaseOS Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol8_appstream]
name=Oracle Linux 8 Application Stream ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/appstream/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol8_codeready_builder]
name=Oracle Linux 8 CodeReady Builder ($basearch) - Unsupported
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/codeready/builder/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
6 changes: 4 additions & 2 deletions postgresql-containers/build/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,19 @@ RUN set -ex; \
percona-postgresql${PG_MAJOR//.}-plpython* \
percona-pg_stat_monitor${PG_MAJOR//.} \
percona-postgresql${PG_MAJOR//.}-llvmjit \
percona-wal2json${PG_MAJOR//.} \
percona-pg_repack${PG_MAJOR//.} \
psmisc \
rsync \
perl \
nss_wrapper \
tar \
bzip2 \
lz4 \
percona-wal2json${PG_MAJOR//.} \
file \
tzdata \
unzip; \
microdnf -y reinstall tzdata; \
microdnf -y reinstall tzdata; \
# patroni block starts
# Provided by Percona
microdnf -y install \
Expand Down