mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 13:14:32 +00:00
- Removed `init_primary_domain.sh` entirely; introduced `init_openbao.sh` with updated logic and streamlined functionality. - Standardized script names to align with the OpenBao-centric workflow. - Updated installer to dynamically fetch Prole database versions and reflect script changes. - Improved TLS generation and k8s manifest handling for CloudNative-PG. - Added new references to OpenBao initialization across scripts and UI components.
89 lines
3.6 KiB
Docker
89 lines
3.6 KiB
Docker
FROM ubuntu:24.04
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive
|
||
ENV LANG=C.UTF-8
|
||
# Official image expects PGDATA default to /var/lib/postgresql/data
|
||
ENV PGDATA=/var/lib/postgresql/data
|
||
|
||
# 1) Base runtime deps to match official behavior (gosu, locales, etc.)
|
||
RUN set -eux; \
|
||
apt-get update; \
|
||
apt-get install -y --no-install-recommends \
|
||
ca-certificates curl wget gnupg2 lsb-release \
|
||
locales tzdata \
|
||
gosu \
|
||
build-essential git \
|
||
; \
|
||
rm -rf /var/lib/apt/lists/*; \
|
||
locale-gen en_US.UTF-8
|
||
|
||
# 2) Add Percona apt repo + install Percona Server for PostgreSQL 17
|
||
# Percona docs: use percona-release + setup ppg-17, and avoid mixing with distro postgresql-17
|
||
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-17; \
|
||
apt-get update; \
|
||
apt-get install -y --no-install-recommends \
|
||
percona-postgresql-17 \
|
||
; \
|
||
rm -rf /var/lib/apt/lists/*
|
||
|
||
# install nfs & iscsi
|
||
# RUN apt-get install -y nfs-common
|
||
# RUN apt-get install -y open-iscsi
|
||
|
||
# Ensure postgres binaries are on PATH (official entrypoint expects `postgres`, `initdb`, `psql` in PATH)
|
||
# Percona’s deb layout is Debian-like; this is the common bindir.
|
||
ENV PATH=/usr/lib/postgresql/17/bin:$PATH
|
||
|
||
# 3) Install dev headers for PGXS builds (name varies; we try a few common patterns)
|
||
RUN set -eux; \
|
||
apt-get update; \
|
||
(apt-get install -y --no-install-recommends percona-postgresql-17-dev || true); \
|
||
(apt-get install -y --no-install-recommends percona-postgresql17-server-dev || true); \
|
||
(apt-get install -y --no-install-recommends percona-postgresql17-dev || true); \
|
||
rm -rf /var/lib/apt/lists/*
|
||
|
||
# 4) Create postgres user + dirs similar to official image expectations
|
||
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; \
|
||
chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql /docker-entrypoint-initdb.d; \
|
||
chmod 3777 /var/run/postgresql
|
||
|
||
# 5) Build/install your extension (pg_prolelog submodule)
|
||
# COPY pg_prolelog /usr/src/pg_prolelog
|
||
# RUN set -eux; \
|
||
# cd /usr/src/pg_prolelog; \
|
||
# PG_CONFIG="$(command -v pg_config)"; \
|
||
# test -n "$PG_CONFIG"; \
|
||
# test -d "$($PG_CONFIG --includedir-server)"; \
|
||
# make PG_CONFIG="$PG_CONFIG"; \
|
||
# make PG_CONFIG="$PG_CONFIG" install; \
|
||
# rm -rf /usr/src/pg_prolelog
|
||
|
||
# Install barman-cloud
|
||
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/*
|
||
|
||
# 6) Add entrypoint scripts (official entrypoint verbatim + our tiny wrapper + OpenBao/pg_tde init hook)
|
||
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
|
||
|
||
# staged copies of the pgdata/*.conf files
|
||
COPY conf/postgresql/*.conf /etc/postgresql/17/main/
|
||
RUN chown postgres:postgres /etc/postgresql/17/main/*.conf
|
||
|
||
RUN set -eux; \
|
||
chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/prole-entrypoint.sh /docker-entrypoint-initdb.d/10_pg_tde_openbao.sh
|
||
|
||
EXPOSE 5432
|
||
CMD ["postgres"] |