mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
Summary: Removed the prole-db-manager microservice and simplified deployment to use prole-authority as the internal management and authorization point. Fixed two blocking bugs that prevented silent install from completing on knoe-dev-cluster. Removed: prole-db-manager - Deleted db-manager-deployment.yaml and db-manager-service.yaml from opentofu manifests - Deleted src/db-manager/ (Dockerfile, server.js, package.json, tests) - Removed prole-db-manager port-forward mapping from installer/core/env.py - Removed init_db_manager.sh from Initialization Scripts (milestones.py, actions.py) - Removed init_certmgr.sh and init_db_manager.sh tabs from services screen (services.py) - Removed live k8s Deployment/Service from knoe-dev-cluster Fixed: PostgreSQL version downgrade error (pg17 -> pg18) - Created conf/postgresql/.version with value 18 - Updated k8s/prole/prole-db.yaml and prole-db-recovery.yaml.tpl imageName to prole-db:18-089 - Fixed _init_database_options_state() to restore saved version_type from prole.cfg so db_version_type defaults to v18 (pg18) instead of silently reverting to pg17 - Added database_options.* keys to _collect_input_snapshot() in cfg.py so distribution, version_type, and all extension toggles persist to prole.cfg Fixed: Cluster name inconsistency - Removed stale prole-dev-cluster references; all scripts now use knoe-dev-cluster - Added knoe-dev-cluster to mode-detection case in etc/prole_cfg.sh Config: conf/prole.cfg - Set kerberos_config.enabled = False, KERBEROS_AUTO_ENABLED = False - Added database_options.distribution = percona, version_type = v18 - Added all 13 extension flags set to True (postgis, pgvector, pgcrypto, pgaudit, pg_repack, pg_stat_statements, pg_buffercache, pg_freespacemap, pgrowlocks, postgres_fdw, dblink, pg_stat_monitor, pgbadger) Verification: ./install.py -s -l -v -c conf/prole.cfg completed successfully. CNPG deployed prole-db:18-089 to knoe-dev-cluster; all milestones passed. Co-authored-by: Junie <junie@jetbrains.com>
149 lines
6.4 KiB
Docker
149 lines
6.4 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM ubuntu:24.04
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV LANG=C.UTF-8
|
|
ENV PGDATA=/var/lib/postgresql/data
|
|
ENV TZ=Etc/GMT-0
|
|
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends \
|
|
ca-certificates curl wget gnupg2 lsb-release \
|
|
locales \
|
|
gosu \
|
|
build-essential git openssh-client \
|
|
; \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
locale-gen en_US.UTF-8
|
|
|
|
# Configure non-interactive timezone to avoid tzdata prompts
|
|
RUN set -eux; \
|
|
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections; \
|
|
echo "tzdata tzdata/Zones/Etc select GMT-0" | debconf-set-selections; \
|
|
apt-get update; \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata; \
|
|
rm -rf /var/lib/apt/lists/*; \
|
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \
|
|
echo $TZ > /etc/timezone; \
|
|
dpkg-reconfigure -f noninteractive tzdata
|
|
|
|
RUN set -eux; \
|
|
mkdir -p /root/.ssh; \
|
|
ssh-keyscan github.com >> /root/.ssh/known_hosts
|
|
|
|
# Percona installation
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
wget -q "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"; \
|
|
dpkg -i "percona-release_latest.$(lsb_release -sc)_all.deb"; \
|
|
rm -f "percona-release_latest.$(lsb_release -sc)_all.deb"; \
|
|
apt-get update; \
|
|
percona-release setup ppg-18; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends \
|
|
percona-postgresql-18 \
|
|
percona-postgresql-server-dev-18 \
|
|
; \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PATH=/usr/lib/postgresql/18/bin:$PATH
|
|
|
|
RUN set -eux; \
|
|
groupadd -r postgres --gid=999 || true; \
|
|
useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres || true; \
|
|
mkdir -p /var/lib/postgresql /var/run/postgresql "$PGDATA" /docker-entrypoint-initdb.d /etc/prole; \
|
|
chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql /docker-entrypoint-initdb.d; \
|
|
chmod 3777 /var/run/postgresql
|
|
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
cmake \
|
|
libssl-dev \
|
|
libgdal-dev \
|
|
libproj-dev \
|
|
libgeos-dev \
|
|
libxml2-dev \
|
|
libjson-c-dev \
|
|
libprotobuf-c-dev \
|
|
protobuf-c-compiler \
|
|
; \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Extension installation
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends percona-postgresql-18-postgis-3; \
|
|
apt-get install -y --no-install-recommends percona-postgresql-18-pgvector; \
|
|
apt-get install -y --no-install-recommends percona-postgresql-18-pgaudit; \
|
|
apt-get install -y --no-install-recommends percona-postgresql-18-repack; \
|
|
apt-get install -y --no-install-recommends percona-pg-stat-monitor18; \
|
|
apt-get install -y --no-install-recommends percona-pgbadger; \
|
|
apt-get install -y --no-install-recommends percona-pg-tde18; \
|
|
apt-get install -y --no-install-recommends \
|
|
percona-postgresql-contrib \
|
|
freetds-dev \
|
|
; \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Build and install tds_fdw
|
|
RUN --mount=type=ssh set -eux; \
|
|
cd /tmp; \
|
|
git clone https://github.com/tds-fdw/tds_fdw.git; \
|
|
cd tds_fdw; \
|
|
make USE_PGXS=1; \
|
|
make USE_PGXS=1 install; \
|
|
cd /; \
|
|
rm -rf /tmp/tds_fdw
|
|
|
|
# Create extension registration script
|
|
RUN set -eux; \
|
|
echo "#!/bin/bash" > /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo "set -e" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo 'psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL' >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS postgis;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS postgis_topology;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS vector;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pgcrypto;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pgaudit;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pg_repack;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pg_stat_statements;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pg_buffercache;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pg_freespacemap;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pgrowlocks;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS postgres_fdw;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS dblink;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS pg_stat_monitor;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo " CREATE EXTENSION IF NOT EXISTS tds_fdw;" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
echo "EOSQL" >> /docker-entrypoint-initdb.d/20_create_extensions.sh; \
|
|
chmod +x /docker-entrypoint-initdb.d/20_create_extensions.sh
|
|
|
|
# Barman
|
|
COPY requirements.txt /
|
|
RUN set -xe; apt-get update; apt-get install -y --no-install-recommends build-essential python3-dev python3-pip python3-psycopg2 python3-setuptools
|
|
RUN pip3 install --break-system-packages -r /requirements.txt
|
|
RUN apt-get remove -y --purge --autoremove build-essential python3-dev && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
COPY prole-db-entrypoint.sh /usr/local/bin/prole-entrypoint.sh
|
|
COPY 10_pg_tde_openbao.sh /docker-entrypoint-initdb.d/10_pg_tde_openbao.sh
|
|
COPY prole-db-ssh-openbao.sh /usr/local/bin/prole-db-ssh-openbao.sh
|
|
|
|
COPY postgresql/*.conf /etc/postgresql/18/main/
|
|
RUN chown postgres:postgres /etc/postgresql/18/main/*.conf
|
|
|
|
ARG PROLE_USER=prole
|
|
RUN set -eux; \
|
|
if [ -n "$PROLE_USER" ] && [ "$PROLE_USER" != "root" ] && [ "$PROLE_USER" != "postgres" ]; then \
|
|
if ! id -u "$PROLE_USER" >/dev/null 2>&1; then \
|
|
useradd -m -s /bin/bash "$PROLE_USER"; \
|
|
fi; \
|
|
fi
|
|
|
|
RUN set -eux; \
|
|
chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/prole-entrypoint.sh /usr/local/bin/prole-db-ssh-openbao.sh /docker-entrypoint-initdb.d/10_pg_tde_openbao.sh
|
|
|
|
EXPOSE 5432
|
|
CMD ["postgres"]
|