"502 Bad Gateway" when using Postgres database on external server

Hello. We have galaxy installed following the “Galaxy Installation with Ansible” tutorial (Galaxy Installation with Ansible ). Everything is working fine until we try to change the database_connection string to use our central Postgres server instead of localhost.

When we change this to:
database _connection: “postgresql://galaxy:password@pg1/galaxy”

The page fails to load with a “502 Bad Gateway.” If we revert it to the original, everything works.

We have tested the database_connection string from the command line using “psql -Atx postgresql://galaxy:password@pg1/galaxy”

Any help or suggestions would be greatly appreciated.

Many thanks,
Devin

I finally fixed this by updating pg_hba.conf on the remote server to give the galaxy user access to the postgres database in addition to the galaxy database.

Is it sufficient for galaxy to have read-only access to this database as long as it has full privs over the galaxy database? If not, any details on exactly what it needs to access and do from the postgres database would be greatly appreciated.

Many thanks,
Devin