Skip to content

Commit

Permalink
SQL-161 add unix socket support (#239)
Browse files Browse the repository at this point in the history
* try adding unix socket support

* SQL-161 latest junixsocket

* SQL-161 document pg unix socket support
  • Loading branch information
milt committed Dec 21, 2022
1 parent d174a4d commit 72198c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@
:extra-deps {org.xerial/sqlite-jdbc {:mvn/version "3.36.0"}}}
:db-postgres
{:extra-paths ["src/db/postgres"]
:extra-deps {org.postgresql/postgresql {:mvn/version "42.5.1"}}}
:extra-deps {org.postgresql/postgresql {:mvn/version "42.5.1"}
com.kohlschutter.junixsocket/junixsocket-common
{:mvn/version "2.6.1"}
com.kohlschutter.junixsocket/junixsocket-native-common
{:mvn/version "2.6.1"}}}
:bench
{:extra-paths ["src/bench" "dev-resources"]
:extra-deps {org.clojure/tools.cli {:mvn/version "1.0.194"}
Expand All @@ -95,6 +99,10 @@
org.xerial/sqlite-jdbc {:mvn/version "3.36.0"}
org.postgresql/postgresql {:mvn/version "42.5.1"}
org.testcontainers/postgresql {:mvn/version "1.17.3"}
com.kohlschutter.junixsocket/junixsocket-common
{:mvn/version "2.6.1"}
com.kohlschutter.junixsocket/junixsocket-native-common
{:mvn/version "2.6.1"}
;; Other test deps
org.clojure/test.check {:mvn/version "1.0.0"}
babashka/babashka.curl {:mvn/version "0.0.3"}
Expand Down
6 changes: 6 additions & 0 deletions doc/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,10 @@ Here is an example database config map in `config/lrsql.json`. The user is `lrsq

The `connection`, `lrs`, and `webserver` sections of the config can then be set with whatever properties you see fit, like the example on the [Getting Started](startup.md) page.

### Unix Socket Support

SQL LRS includes [junixsocket](https://github.com/kohlschutter/junixsocket) which allows unix socket connections to Postgres.

To connect via a unix socket use a JDBC URL like `jdbc:postgresql://localhost/test-postgres-db?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory%24FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432&user=test-postgres-user` where `socketFactoryArg` is the path to your Postgres socket file and `user` is your DB user. See the entry for `LRSQL_DB_JDBC_URL` [here](env_vars.md) for information on setting the JDBC URL.

[<- Back to Index](index.md)

0 comments on commit 72198c1

Please sign in to comment.