Skip to content

Commit c72e839

Browse files
committed
chore: more library locations
1 parent d5a78ae commit c72e839

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

ansible/files/admin_api_scripts/pg_upgrade_initiate.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ function initiate_upgrade {
173173
chown -R postgres:postgres "/tmp/pg_upgrade_bin/$PGVERSION"
174174

175175
# Make latest libpq available to pg_upgrade
176-
mkdir -p /usr/lib/postgresql/lib/aarch64
177-
if [ -f "/usr/lib/postgresql/lib/aarch64/libpq.so.5" ]; then
178-
mv /usr/lib/postgresql/lib/aarch64/libpq.so.5 /usr/lib/postgresql/lib/aarch64/libpq.so.5.bak
179-
ln -s "$PG_UPGRADE_BIN_DIR/libpq.so.5" /usr/lib/postgresql/lib/aarch64/libpq.so.5
176+
mkdir -p /usr/lib/aarch64-linux-gnu
177+
if [ -f "/usr/lib/aarch64-linux-gnu/libpq.so.5" ]; then
178+
mv /usr/lib/aarch64-linux-gnu/libpq.so.5 /usr/lib/aarch64-linux-gnu/libpq.so.5.bak
180179
fi
180+
ln -s "$PG_UPGRADE_BIN_DIR/libpq.so.5" /usr/lib/aarch64-linux-gnu/libpq.so.5
181181

182182
# upgrade job outputs a log in the cwd; needs write permissions
183183
mkdir -p /tmp/pg_upgrade/
@@ -226,6 +226,12 @@ function initiate_upgrade {
226226
echo "7. Granting SUPERUSER to postgres user"
227227
run_sql -c "ALTER USER postgres WITH SUPERUSER;"
228228

229+
if [ -d "/usr/share/postgresql/${PGVERSION}" ]; then
230+
mv "/usr/share/postgresql/${PGVERSION}" "/usr/share/postgresql/${PGVERSION}.bak"
231+
fi
232+
ln -s "$PGSHARENEW" "/usr/share/postgresql/${PGVERSION}"
233+
ls -la /usr/share/postgresql/15/extension/
234+
229235
echo "8. Creating new data directory, initializing database"
230236
chown -R postgres:postgres "$MOUNT_POINT/"
231237
rm -rf "${PGDATANEW:?}/"
@@ -248,11 +254,6 @@ EOF
248254
if [ "$IS_DRY_RUN" = true ]; then
249255
UPGRADE_COMMAND="$UPGRADE_COMMAND --check"
250256
else
251-
if [ -d "/usr/share/postgresql/${PGVERSION}" ]; then
252-
mv "/usr/share/postgresql/${PGVERSION}" "/usr/share/postgresql/${PGVERSION}.bak"
253-
fi
254-
ln -s "$PGSHARENEW" "/usr/share/postgresql/${PGVERSION}"
255-
256257
echo "9. Stopping postgres; running pg_upgrade"
257258
systemctl stop postgresql
258259
fi

ansible/tasks/internal/collect-pg-binaries.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@
1212
- bin
1313
- lib
1414

15-
- name: Collect Postgres libraries - collect libraries which are not in /usr/lib/postgresql/lib
15+
- name: Collect Postgres libraries - collect libraries which are in /usr/lib/postgresql/lib/
1616
copy:
1717
remote_src: yes
1818
src: /usr/lib/postgresql/lib/
1919
dest: /tmp/pg_binaries/{{ postgresql_major }}/lib/
2020

21+
- name: Collect Postgres libraries - collect libraries which are in /var/lib/postgresql/extension/
22+
copy:
23+
remote_src: yes
24+
src: /var/lib/postgresql/extension/
25+
dest: /tmp/pg_binaries/{{ postgresql_major }}/lib/
26+
2127
- name: Collect Postgres libraries - collect latest libpq
2228
copy:
2329
remote_src: yes

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.99-rc0"
1+
postgres-version = "15.1.0.99-rc1"

0 commit comments

Comments
 (0)