Skip to content

Commit

Permalink
K8SPG-375: Add script to relocate extensions (#860)
Browse files Browse the repository at this point in the history
Co-authored-by: Viacheslav Sarzhan <[email protected]>
  • Loading branch information
egegunes and hors authored Nov 9, 2023
1 parent f363823 commit f95a544
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions postgresql-containers/bin/relocate-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

PG_EXTENSIONS_DIR=/usr/pgsql-${PG_VERSION}/share/extension
PG_LIB_DIR=/usr/pgsql-${PG_VERSION}/lib

PGDATA_EXTENSIONS_DIR=/pgdata/extension/${PG_VERSION}/usr/pgsql-${PG_VERSION}/share/extension
PGDATA_LIB_DIR=/pgdata/extension/${PG_VERSION}/usr/pgsql-${PG_VERSION}/lib

mkdir -p ${PGDATA_EXTENSIONS_DIR}
mkdir -p ${PGDATA_LIB_DIR}

cp -r ${PG_EXTENSIONS_DIR}/* ${PGDATA_EXTENSIONS_DIR}/
cp -r ${PG_LIB_DIR}/* ${PGDATA_LIB_DIR}/
4 changes: 3 additions & 1 deletion postgresql-containers/build/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ ENV PATH="${PGROOT}/bin:${PATH}"
RUN set -ex; \
mkdir -p /opt/crunchy/bin /opt/crunchy/conf /pgdata /pgwal /pgconf /backrestrepo /tablespaces; \
chown -R postgres:postgres /opt/crunchy /var/lib/pgsql \
/pgdata /pgwal /pgconf /backrestrepo /tablespaces; \
/pgdata /pgwal /pgconf /backrestrepo /tablespaces /usr/pgsql-${PG_MAJOR//.}; \
chmod -R g=u /opt/crunchy /var/lib/pgsql \
/pgdata /pgwal /pgconf /backrestrepo /tablespaces

Expand All @@ -188,6 +188,8 @@ RUN set -ex; \
/etc/pgbackrest.conf

COPY conf/pgbackrest-repo/pgbackrest.conf /etc/pgbackrest.conf
COPY bin/relocate-extensions.sh /usr/local/bin/relocate-extensions.sh

RUN echo "huge_pages = off" >> ${PGROOT}/share/postgresql.conf.sample

# remove the default spool directory so that pgBackRest does not attempt to look there when
Expand Down

0 comments on commit f95a544

Please sign in to comment.