Gitea install with postgres - dial tcp 127.0.0.1:5432: connect: connection refused

Hi,

I have been trying to install gitea on my RPi 2. Since there is no official docker image for arm7 or arm6, I went for the Postgresql + Install as a package instructions from the doc, on the same machine. I also followed these instructions when the doc was unclear.
I’m not sure why snap was recommended instead of apt-get to install gitea, but I followed the docs and installed it with snap.

Here is my /etc/postgresql/13/main/pg_hba.conf file:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# gitea config
local   giteadb         gitea                                   scram-sha-256
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            scram-sha-256
# IPv6 local connections:
host    all             all             ::1/128                 md5

I am able to start the gitea.service and access the landing page on http://my_adress:3000, however I get the following error when trying to install the app:
(in English: "Database parameters are invalid: dial tcp 127.0.0.1:5432: connect: connection refused)

I don’t understand this error, since I am able to connect to the database with either
psql -d giteadb -U gitea
or
psql "postgres://gitea@localhost/giteadb"
and entering the password.

Any ideas ?

PS: Another issue that may or may not be relevant, is that when I start gitea.service and I look in the logs, it does not actually start correctly and I get this error repeatedly:

Jan 07 16:54:12 alexpi systemd[1]: Started Gitea (Git with a cup of tea).
Jan 07 16:54:13 alexpi gitea[22124]: cmd_run.go:1002: WARNING: cannot create user datadata directory: cannot create "/home/git/snap/gitea/5785": mkdir /home/git/snap: permission denied
G: cgroup v2 is not fully supported yet, proceeding with partial confinement
Jan 07 16:54:13 alexpi gitea[22124]: WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
Jan 07 16:54:13 alexpi gitea[22124]: cannot create user data directory: /home/git/snap>
Jan 07 16:54:13 alexpi systemd[1]: gitea.service: Main process exited, code=exited, status=1/FAILURE
Jan 07 16:54:13 alexpi systemd[1]: gitea.service: Failed with result 'exit-code'.
1 Like

For the record, I was able to install gitea without Postgres