8000 fix: pgbouncer config persistence after reboot (#684) · openmodels-base/postgres@62a07e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62a07e6

Browse files
authored
fix: pgbouncer config persistence after reboot (supabase#684)
1 parent 422a00b commit 62a07e6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docker/all-in-one/init/configure-pgbouncer.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,27 @@ if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
1717
/opt/supabase-admin-api optimize pgbouncer --destination-config-file-path /etc/pgbouncer-custom/generated-optimizations.ini
1818

1919
# Preserve pgbouncer configs across restarts
20+
PGBOUNCER_DIR="${DATA_VOLUME_MOUNTPOINT}/etc/pgbouncer"
2021
PGBOUNCER_CUSTOM_DIR="${DATA_VOLUME_MOUNTPOINT}/etc/pgbouncer-custom"
2122

23+
mkdir -p "${PGBOUNCER_DIR}"
2224
mkdir -p "${PGBOUNCER_CUSTOM_DIR}"
2325

2426
if [ ! -f "${CONFIGURED_FLAG_PATH}" ]; then
2527
echo "Copying existing custom pgbouncer config from /etc/pgbouncer-custom to ${PGBOUNCER_CUSTOM_DIR}"
2628
cp -R "/etc/pgbouncer-custom/." "${PGBOUNCER_CUSTOM_DIR}/"
29+
cp -R "/etc/pgbouncer/." "${PGBOUNCER_DIR}/"
2730
fi
2831

2932
rm -rf "/etc/pgbouncer-custom"
3033
ln -s "${PGBOUNCER_CUSTOM_DIR}" "/etc/pgbouncer-custom"
3134
chown -R pgbouncer:pgbouncer "/etc/pgbouncer-custom"
3235
chown -R pgbouncer:pgbouncer "${PGBOUNCER_CUSTOM_DIR}"
3336
chmod -R g+rx "${PGBOUNCER_CUSTOM_DIR}"
37+
38+
rm -rf "/etc/pgbouncer"
39+
ln -s "${PGBOUNCER_DIR}" "/etc/pgbouncer"
40+
chown -R pgbouncer:pgbouncer "/etc/pgbouncer"
41+
chown -R pgbouncer:pgbouncer "${PGBOUNCER_DIR}"
42+
chmod -R g+rx "${PGBOUNCER_DIR}"
3443
fi

0 commit comments

Comments
 (0)
0