You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Postgres: verify and document Unix-socket DSN (host=/var/run/postgresql) #944
Ich habe nur einen kurzen Blick drauf geworfen, ist eine Postgresverbindung via Unixsockets möglich (host = /var/run/postgresql)?
The Postgres DSN is passed through unchanged to bun's pgdriver (pgdriver.WithDSN(cfg.DSN) in server/internal/db/postgres/postgres.go), which builds on lib/pq — and lib/pq supports Unix-domain sockets when host is an absolute path. So host=/var/run/postgresql should work, but it is not tested or documented anywhere.
Task: verify with a real Unix-socket Postgres (e.g. a local cluster with the TCP listener off), add a test or a documented example DSN, and mention it in the self-hosting docs. Relevant for single-box installs where Postgres listens only on the socket.
Tried to connect with different ways, mostly copied from other services, which use unix sockets already and Stackoverflow.
Why could this be important to users: It is very easy to mount the socket file in a container and use the host postgres installation for containers too without setting permissions in pg_hba.conf or listening on all ports in postgresql.conf.
Fixed in 2af6edd7 on branch wt/feat/todos-2026-11-18-2: the root cause was that bun's pgdriver dials the host value itself, so host=/var/run/postgresql (the libpq convention, a socket directory) never reached the .s.PGSQL.5432 file inside it. SolidPing now rewrites a socket-directory host to the socket file for pgdriver (and keeps the directory form for the lib/pq LISTEN connection). Supported forms: postgresql://user:pass@/db?host=/var/run/postgresql&sslmode=disable (add &port=5433 for a non-default port), or host=/var/run/postgresql/.s.PGSQL.5432. A percent-encoded host (@%2Fvar%2F...) is rejected by Go's URL parser, so use the host parameter. A test runs Postgres with TCP off and connects through both drivers. Thanks @Morethanevil for the detailed attempts, which pinned it down. Not merged yet: closing because the fix exists, the branch's PR carries it live.
# Sockets
postgres://testuser:testpw@%2Fvar%2Flib%2Fpostgresql/testdb?sslmode=disable
# Host appended at the end should overwrite the previous one (at least this is my experience), but Solidping ignores this and connects to TCP anyway :)
postgres://testuser:testpw@localhost:5432/testdb?sslmode=disable&host=/var/run/postgresql
postgres://testuser:testpw@localhost:5432/testdb?host=/var/run/postgresql&sslmode=disable
Sockets are working now, maybe put an example string into the docs. Thanks!
Activity
Morethanevil commentedon Nov 19, 2026
Tried to connect with different ways, mostly copied from other services, which use unix sockets already and Stackoverflow.
Why could this be important to users: It is very easy to mount the socket file in a container and use the host postgres installation for containers too without setting permissions in pg_hba.conf or listening on all ports in postgresql.conf.
In Docker the users could mount the file with:
USER: testuser
PASSWORD: testpw
DATABASE: testdb
CachyOS LXC, Solidping Binary -> Postgresql on host
Working:
Not working:
I hope, that this helps you a little bit. I am in to do some more testing!
fclairamb commentedon Nov 19, 2026
Fixed in
2af6edd7on branchwt/feat/todos-2026-11-18-2: the root cause was that bun's pgdriver dials thehostvalue itself, sohost=/var/run/postgresql(the libpq convention, a socket directory) never reached the.s.PGSQL.5432file inside it. SolidPing now rewrites a socket-directory host to the socket file for pgdriver (and keeps the directory form for the lib/pq LISTEN connection). Supported forms:postgresql://user:pass@/db?host=/var/run/postgresql&sslmode=disable(add&port=5433for a non-default port), orhost=/var/run/postgresql/.s.PGSQL.5432. A percent-encoded host (@%2Fvar%2F...) is rejected by Go's URL parser, so use thehostparameter. A test runs Postgres with TCP off and connects through both drivers. Thanks @Morethanevil for the detailed attempts, which pinned it down. Not merged yet: closing because the fix exists, the branch's PR carries it live.fix: connect to Postgres over a Unix socket with host=<socket dir> (#944
fclairamb commentedon Nov 19, 2026
autopilot: in #939
feat: status updates in several languages, random first admin passwor…
Morethanevil commentedon Nov 20, 2026
Tried out again with docker and mounted socket file and on bare metal:
Works:
Doesn't work:
Sockets are working now, maybe put an example string into the docs. Thanks!
fclairamb commentedon Nov 20, 2026
Thanks for retesting on both setups, glad the socket forms work.
On the two that don't:
And agreed on the docs: #960 tracks adding the working socket DSN as an example.