Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to postgres DB listening on localhost. #3378

Open
barkyq opened this issue May 21, 2024 · 0 comments
Open

Cannot connect to postgres DB listening on localhost. #3378

barkyq opened this issue May 21, 2024 · 0 comments

Comments

@barkyq
Copy link

barkyq commented May 21, 2024

Background information

  • Dendrite version or git SHA: 0.13.7+46902e5
  • SQLite3 or Postgres?: Postgres
  • Running in Docker?: no
  • go version: go version go1.22.2 linux/amd64
  • Client used (if applicable): N/A

Description

  • What is the problem: cannot connect to DB when postgres is listening on 127.0.0.1
  • Who is affected: cannot start server
  • How is this bug manifesting: cannot start server
  • When did this first appear: after updating

Steps to reproduce

Default Postgres set-up listening on 127.0.0.1

in dendrite.yaml have the line

postgresql://dendrite:PASSWORD@127.0.0.1:5432/dendrite?sslmode=disable

and when I start the server with:

./bin/dendrite -config dendrite.yaml -http-bind-address 127.0.0.1:8008

it fails with the error:

PANI[2024-05-21T14:13:42.984256370Z] failed to connect to room server db           error="sqlutil.Open: failed to find maximum conections: pq: no pg_hba.conf entry for host \"X.X.X.X\", user \"dendrite\", database \"dendrite\", SSL off"

where X.X.X.X is the public IP of my server (not 127.0.0.1).

I was able to fix by manually editing postgres conf files. This was not necessary before.

sudo nano /etc/postgresql/13/main/postgresql.conf

change `listen_addresses = 'localhost'` to `listen_addresses = '*'`

sudo nano /etc/postgresql/13/main/pg_hba.conf

add line `host  all  all 0.0.0.0/0 md5`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant