FS#67534 - [gitea] failed to connect to postgres

Attached to Project: Community Packages
Opened by vignesh (vignesh) - Sunday, 09 August 2020, 11:34 GMT
Last edited by Bruno Pagani (ArchangeGabriel) - Monday, 10 August 2020, 17:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Maxime Gauduin (Alucryd)
Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
The database settings are invalid: dial unix /tmp/.s.PGSQL.5432: connect: no such file or directory
Actually there is a file named /tmp/.s.PGSQL.5432

ls -al /tmp/.s.PGSQL.5432
srwxrwxrwx 1 postgres postgres 0 Aug 9 16:34 /tmp/.s.PGSQL.5432=

Additional info:
* package version(s) Gitea version 1.12.3

Steps to reproduce:
1) install gitea
2) Edit /etc/gitea/app.ini
Under [database] enter
DB_TYPE = postgres
HOST = /tmp/
NAME = gitea
USER = gitea
3) Configure postgres database
[postgres]$ createuser -P gitea
[postgres]$ createdb -O gitea gitea


4) Start gitea.service
5) Visit http://localhost:3000/install
6) Scroll down to the bottom of the page and click "Install Gitea" button.

What happens:
Page reloads. Near the top of the page, an error message is shown (in red color):
The database settings are invalid: dial unix /tmp/.s.PGSQL.5432: connect: no such file or directory

Note: posgres.service is running and accepting connections at /tmp/.s.PGSQL.5432
This task depends upon

Closed by  Bruno Pagani (ArchangeGabriel)
Monday, 10 August 2020, 17:59 GMT
Reason for closing:  Not a bug
Comment by Bruno Pagani (ArchangeGabriel) - Sunday, 09 August 2020, 17:51 GMT
Why is your postgres socket under `/tmp/` and not `/run/postgresql/`? This is not a supported configuration. `/tmp/` is not accessible to hardened services like gitea, for good reasons.
Comment by vignesh (vignesh) - Monday, 10 August 2020, 17:51 GMT
After changing the socket to /run/postgresql/ the problem was solved.
Comment by vignesh (vignesh) - Monday, 10 August 2020, 17:55 GMT
The error message:
dial unix /tmp/.s.PGSQL.5432: connect: no such file or directory
is not correct. It should be something like:
/tmp/.s.PGSQL.5432 - permission denied
Comment by Bruno Pagani (ArchangeGabriel) - Monday, 10 August 2020, 17:59 GMT
No, it’s correct: the file actually does not exist at all for gitea (bind mount). But the diagnostic is harder.

`/run/postgresql/` is the default Arch configuration, changing it means you know what you’re doing.

Loading...