Skip to content

Commit

Permalink
chore: fix gpg key fetch for ubuntu 18.04
Browse files Browse the repository at this point in the history
  • Loading branch information
pcnc committed Sep 4, 2023
1 parent c93ab1e commit e4990ce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ cleanup() {
if [ -f "/usr/share/postgresql/${PGVERSION}.bak" ]; then
mv "/usr/share/postgresql/${PGVERSION}.bak" "/usr/share/postgresql/${PGVERSION}"
fi

if [ -d "/usr/share/postgresql/${PGVERSION}.bak" ]; then
mv "/usr/share/postgresql/${PGVERSION}.bak" "/usr/share/postgresql/${PGVERSION}"
fi
fi

if [ -f "/usr/lib/postgresql/lib/aarch64/libpq.so.5.bak" ]; then
Expand Down Expand Up @@ -234,6 +238,11 @@ function initiate_upgrade {

cp --remove-destination "$PGLIBNEW"/*.control "$PGSHARENEW/extension/"
cp --remove-destination "$PGLIBNEW"/*.sql "$PGSHARENEW/extension/"
export LD_LIBRARY_PATH="${PGLIBNEW}"

if [ -f "${PG_UPGRADE_BIN_DIR}/libpq.so.5" ]; then
cp "${PG_UPGRADE_BIN_DIR}/libpq.so.5" "${PGLIBNEW}/libpq.so.5"
fi

echo "8. Creating new data directory, initializing database"
chown -R postgres:postgres "$MOUNT_POINT/"
Expand Down
2 changes: 1 addition & 1 deletion ansible/tasks/internal/collect-pg-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
copy:
remote_src: yes
src: /usr/lib/aarch64-linux-gnu/libpq.so.5
dest: /tmp/pg_binaries/{{ postgresql_major }}/libpq.so.5
dest: /tmp/pg_binaries/{{ postgresql_major }}/lib/libpq.so.5

- name: Collect Postgres binaries - collect shared files
copy:
Expand Down
7 changes: 7 additions & 0 deletions ansible/tasks/setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
apt:
name: postgresql-{{ postgresql_major }}={{ postgresql_release }}-1.pgdg20.04+1
install_recommends: no
when: ansible_distribution_version != "18.04"

- name: Postgres - install server - Ubuntu 18.04
apt:
name: postgresql-{{ postgresql_major }}={{ postgresql_release }}-1.pgdg18.04+1
install_recommends: no
when: ansible_distribution_version == "18.04"

- name: Postgres - remove PPA
apt_repository:
Expand Down
12 changes: 7 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG ubuntu_release=bionic
ARG ubuntu_release=focal
FROM ubuntu:${ubuntu_release} as base

ARG ubuntu_release=bionic
ARG ubuntu_release_no=18.04
ARG ubuntu_release=focal
ARG ubuntu_release_no=20.04
ARG postgresql_major=15
ARG postgresql_release=${postgresql_major}.1

Expand All @@ -17,7 +17,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

# Add Postgres PPA
ARG postgresql_gpg_key=B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "${postgresql_gpg_key}" && \
RUN mkdir -p /root/.gnupg && chmod 700 /root/.gnupg && \
gpg --recv-keys --no-default-keyring --keyring /tmp/pgdg.key --keyserver pgp.mit.edu --recv-keys "${postgresql_gpg_key}" && \
gpg --no-default-keyring --keyring /tmp/pgdg.key --export "${postgresql_gpg_key}" > /etc/apt/trusted.gpg.d/pgdg.gpg && \
echo "deb https://apt-archive.postgresql.org/pub/repos/apt ${ubuntu_release}-pgdg-archive main" > /etc/apt/sources.list.d/pgdg.list && \
echo "deb-src https://apt-archive.postgresql.org/pub/repos/apt ${ubuntu_release}-pgdg-archive main" > /etc/apt/sources.list.d/pgdg.list

Expand All @@ -34,7 +36,7 @@ ENV DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)"
# Configure processor optimised build
ARG CPPFLAGS=""
ENV DEB_CPPFLAGS_APPEND="${CPPFLAGS} -fsigned-char"
ARG DEB_BUILD_PROFILES=""
ARG DEB_BUILD_PROFILES="pkg.postgresql.nozstd"
ENV DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES}"

RUN apt-get build-dep -y postgresql-common pgdg-keyring && \
Expand Down

0 comments on commit e4990ce

Please sign in to comment.