hedgedoc / container

HedgeDoc container image resources
https://docs.hedgedoc.org/setup/docker/
195 stars 52 forks source link

Postgres DB connection via unix socket not working #175

Closed thomas-mc-work closed 3 years ago

thomas-mc-work commented 3 years ago

According to this https://github.com/typeorm/typeorm/pull/6042 from your underlying library I was trying to connect to my PostgreSQL DB via a unix socket. Here is an excerpt of my docker-compose.yml:

version: '3'
services:
  app:
    image: quay.io/hedgedoc/hedgedoc:1.7.2
    environment:
      - CMD_DB_URL=postgres://hedgedoc:12345@/run/postgresql/.s.PGSQL.5432?dbname=hedgedoc
    volumes:
      - /run/postgresql/.s.PGSQL.5432:/run/postgresql/.s.PGSQL.5432

But it doesn't work. This is the error message:

…
app_1  | Parsed url postgres://hedgedoc:*****@/run/postgresql/.s.PGSQL.5432?dbname=hedgedoc
app_1  | 
app_1  | ERROR: connect ECONNREFUSED 127.0.0.1:5432
DerMolly commented 3 years ago

TypeORM is the DB Framework for HedgeDoc 2.0, which is not released yet. HedgeDoc 1.0 (which runs in your Docker Container) uses sequelize.

DerMolly commented 3 years ago

If I recall correctly there was a problem with the connecting via Unix socket to the DB. The fix for which will be released with 1.8, am I right @SISheogorath ?

SISheogorath commented 3 years ago

I don't think we should support Unix sockets with this container. It's against container best practices and people who have such a custom use-case can easily extend this image to accommodate for potential shortcomings.

thomas-mc-work commented 3 years ago

Now when I think about it I don't even believe this is a container problem at all. Maybe I should close this here and wait for the next major release. If it doesn't work either then I can create an issue in the main repo.