Skip to content

Commit

Permalink
RHINENG-10032: install pg_repack and add a migration to create extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Dugowitch committed Sep 6, 2024
1 parent 0bd4be4 commit 5c6b391
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG INSTALL_TOOLS=no
RUN dnf module enable -y postgresql:16 || curl -o /etc/yum.repos.d/postgresql.repo \
https://copr.fedorainfracloud.org/coprs/mmraka/postgresql-16/repo/epel-8/mmraka-postgresql-16-epel-8.repo

RUN dnf install -y go-toolset postgresql diffutils rpm-devel && \
RUN dnf install -y go-toolset postgresql diffutils rpm-devel pg_repack && \
ln -s /usr/libexec/platform-python /usr/bin/python3

ENV GOPATH=/go \
Expand Down Expand Up @@ -53,7 +53,7 @@ RUN go build -v main.go

# libs to be copied into runtime
RUN mkdir -p /go/lib64 && \
ldd /go/src/app/main \
ldd /go/src/app/main /usr/bin/pg_repack \
| awk '/=>/ {print $3}' \
| sort -u \
| while read lib ; do \
Expand All @@ -79,6 +79,7 @@ COPY --from=buildimg /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/
COPY --from=buildimg /etc/crypto-policies/ /etc/crypto-policies/
COPY --from=buildimg /usr/lib64/.lib* /usr/lib64/
COPY --from=buildimg /usr/lib64/libssl* /usr/lib64/
COPY --from=buildimg /usr/bin/pg_repack /usr/bin/

# copy libs needed by main
COPY --from=buildimg /go/lib64/* /lib64/
Expand Down
1 change: 1 addition & 0 deletions database_admin/migrations/129_create_pg_repack.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE EXTENSION IF NOT EXISTS pg_repack;
2 changes: 1 addition & 1 deletion database_admin/schema/create_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations


INSERT INTO schema_migrations
VALUES (128, false);
VALUES (129, false);

-- ---------------------------------------------------------------------------
-- Functions
Expand Down
6 changes: 6 additions & 0 deletions dev/database/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM quay.io/cloudservices/postgresql-rds:16-4649c84

# install pg_repack
USER root
RUN curl -o /etc/yum.repos.d/postgresql.repo \
https://copr.fedorainfracloud.org/coprs/mmraka/postgresql-16/repo/epel-8/mmraka-postgresql-16-epel-8.repo
RUN dnf install -y pg_repack

ADD /dev/database/init.sh /docker-entrypoint-initdb.d/

USER postgres
Expand Down

0 comments on commit 5c6b391

Please sign in to comment.