Good afternoon! Newbie here, I’ve tried to install Lemmy using Ansible (Debian stable) and I ended up having an issue with the Postgresql connectivity (localhost via socket).

The error message I have is:

thread 'main' panicked at 'Error connecting to postgresql:///lemmy?user=lemmy&host=/var/run/postgresql: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory

I have updated my /etc/postgresql/15/main/pg_hba.conf from peer to trust to md5 with no success (rebooting Postresql each time).

My config.hjson is:

database: {
 uri: "postgresql:///lemmy?user=lemmy&host=/var/run/postgresql"
 password: "{{ postgres\_password }}"
}

Any idea / suggestion? Thanks!

PS: cross-posted on the Matrix.org install support chat

1 point
*

Considering you are getting No such file or directory error then

  1. Is the path correct?
  2. Can lemmy access the file? For example if lemmy is running in docker the path/socket does not exist in the container unless specifically instructed…
  3. Does lemmy process have the required permissions to actually read/access the file?
permalink
report
reply
1 point

The path is correct, my investigations directed me towards a docker access issue as suggested by your #2. Looking into it now, thanks!

permalink
report
parent
reply
1 point
*

If lemmy is actually running in docker then you should rather use network instead of socket file - while it should work I would be afraid of docker shenanigans when it comes to mounting a socket file as volume into the container (it should work, but …).

You should be able to access postgres over network on the host thru extra_hosts settings:

extra_hosts:
    - "host.docker.internal:host-gateway"

https://stackoverflow.com/a/43541732

postgres://host.docker.internal:5432

permalink
report
parent
reply
1 point

My investigations so far have led me to the conclusion that the Ansible install creates multiple docker containers, including one for Lemmy and one for Postgresql. I need now to figure out how inter-container communications work but the host itself is not used.

permalink
report
parent
reply

Lemmy Administration

!lemmy_admin@lemmy.ml

Create post

Anything about running your own Lemmy instance. Including how to install it, maintain and customise it.

Be sure to check out the docs: https://join-lemmy.org/docs/en/administration/administration.html

If you have any problems, describe them here and we will try to help you fixing them.

Community stats

  • 1

    Monthly active users

  • 67

    Posts

  • 258

    Comments

Community moderators