Skip to content

Commit 9323c1c

Browse files
committed
Add a troubleshooting page with help on how to work around unix domain socket issues on MacOS
1 parent 9e9360f commit 9323c1c

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ The database schema is highly normalised which helps prevent data inconsistencie
2828
with the use of foreign keys from one table to another). More user friendly database queries can be
2929
implemented using [Postgres Views][PostgresView] to implement joins between tables.
3030

31+
## Troubleshooting
32+
33+
If you have any issues with this project, consult the [troubleshooting][troubleshooting] page for
34+
possible solutions.
35+
3136
## Further Reading
3237

3338
* [BuildingRunning][BuildingRunning]: Building and running the db-sync node.
@@ -42,3 +47,4 @@ implemented using [Postgres Views][PostgresView] to implement joins between tabl
4247
[PostgresView]: https://www.postgresql.org/docs/current/sql-createview.html
4348
[Schema Management]: doc/interesting-queries.md
4449
[Validation]: doc/validation.md
50+
[PostgresView]: doc/troubleshooting.md

doc/troubleshooting.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
# Testing
3+
4+
## Unable to connect to Unix domain socket /var/run/postgresql/.s.PGSQL.5432
5+
6+
When running on MacOS, you get the following error:
7+
8+
```text
9+
Exception: libpq: failed (could not connect to server: No such file or directory
10+
Is the server running locally and accepting
11+
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
12+
)
13+
```
14+
15+
This may indiciate that you do not have `postgres` installed, or that the `postgres`
16+
daemon is not running.
17+
18+
You can install `postgres` using Homebrew using:
19+
20+
```bash
21+
brew install postgres
22+
```
23+
24+
And start the `postgres` daemon using:
25+
26+
```bash
27+
brew services start postgresql
28+
```
29+
30+
And check that it is running using:
31+
32+
```bash
33+
brew services
34+
Name Status User Plist
35+
postgresql started jky /Users/jky/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
36+
```
37+
38+
If the daemon is running and the problem persists, then it could be because `postgres`
39+
is configured to create its unix domain socket on a path different to that expected by
40+
`cardano-db-sync`.
41+
42+
Assuming the daemon is running, the actual path to the unix domain socket can
43+
be discovered by like this:
44+
45+
```bash
46+
$ lsof -p "$(ps -ef | grep postgres | grep '[b]in/postgres' | xargs | cut -d ' ' -f 2)" | grep 5432
47+
postgres 9050 jky 7u unix 0xb7eadc9d471eb839 0t0 /tmp/.s.PGSQL.5432
48+
```
49+
50+
We can work around the problem by sym-linking the expected path to the actual path:
51+
52+
```bash
53+
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
54+
```

0 commit comments

Comments
 (0)