This script reads the Postgres password from
/var/run/pgbouncer/secret/password, connects via the local UNIX socket (no
host/port), and creates TABLE_NAME (default my_table).
Quick verification steps:
- Verify table exists (use the same password)
- export PGPASSWORD="qrDy;GnX4QsKQ0UL"
- psql -U postgres -d postgres -c "\dt"
Expected output examples:
- "\dt" should list
public.my_tableif created.
Troubleshooting:
- Ensure the
psqlclient is installed and available in PATH before running the script. - Ensure the password file exists and contains the correct password.
- If using a different DB name or table name, set
PG_DBandTABLE_NAMEenv vars before running:- PG_DB=mydb TABLE_NAME=events ./git-sync-pgbouncer.sh