I’m trying to set up our Discourse instance to connect to a separate Postgres DB hosted on Azure (set up as described here) via pg_bouncer and I’m having issues.
Our discourse is hosted on a VM in Azure. I have pg_bouncer installed on it and configured, and I am able to verify that I can connect to the hosted DB from the VM via:
psql -h 127.0.0.1 -p 5432 -U [username] -d [database]
In my app.yml, I changed from using the DB hostname to using 127.0.0.1:
DISCOURSE_DB_HOST: [was hostname, tried 127.0.0.1]
When rebuilding the app I get the following error:
I, [2020-09-18T20:48:51.653890 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' rake aborted! PG::ConnectionBad: could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
The only thing that I can think of that’s different between how I’m connecting via psql and the setup of my app.yml is that there’s a password specified in app.yml that isn’t necessary in psql because it’s set up in the pg_bouncer userlist.
Any help would be appreciated.