Skip to content

Commit 5a32332

Browse files
authored
refactor(postgres): add postgres socket (#1248)
* refactor: adds socket_path for unix socket support for postgres * docs: add documentation for unix socket postgres connection
1 parent 99e2e17 commit 5a32332

File tree

6 files changed

+224
-137
lines changed

6 files changed

+224
-137
lines changed

docs/extending-jellyseerr/database-config.mdx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Jellyseerr supports SQLite and PostgreSQL. The database connection can be config
99

1010
## SQLite Options
1111

12+
If you want to use SQLite, you can simply set the `DB_TYPE` environment variable to `sqlite`. This is the default configuration so even if you don't set any other options, SQLite will be used.
13+
1214
```dotenv
1315
DB_TYPE="sqlite" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite".
1416
CONFIG_DIRECTORY="config" # (optional) The path to the config directory where the db file is stored. The default is "config".
@@ -17,17 +19,35 @@ DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging.
1719

1820
## PostgreSQL Options
1921

22+
### TCP Connection
23+
24+
If your PostgreSQL server is configured to accept TCP connections, you can specify the host and port using the `DB_HOST` and `DB_PORT` environment variables. This is useful for remote connections where the server uses a network host and port.
25+
2026
```dotenv
21-
DB_TYPE="postgres" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite". To use postgres, this needs to be set to "postgres"
22-
DB_HOST="localhost" # (optional) The host (url) of the database. The default is "localhost".
27+
DB_TYPE="postgres" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite".
28+
DB_HOST="localhost" # (optional) The host (URL) of the database. The default is "localhost".
2329
DB_PORT="5432" # (optional) The port to connect to. The default is "5432".
24-
DB_USER= # (required) Username used to connect to the database
25-
DB_PASS= # (required) Password of the user used to connect to the database
30+
DB_USER= # (required) Username used to connect to the database.
31+
DB_PASS= # (required) Password of the user used to connect to the database.
32+
DB_NAME="jellyseerr" # (optional) The name of the database to connect to. The default is "jellyseerr".
33+
DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging. The default is "false".
34+
```
35+
36+
### Unix Socket Connection
37+
38+
If your PostgreSQL server is configured to accept Unix socket connections, you can specify the path to the socket directory using the `DB_SOCKET_PATH` environment variable. This is useful for local connections where the server uses a Unix socket.
39+
40+
```dotenv
41+
DB_TYPE="postgres" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite".
42+
DB_SOCKET_PATH="/var/run/postgresql" # (required) The path to the PostgreSQL Unix socket directory.
43+
DB_USER= # (required) Username used to connect to the database.
44+
DB_PASS= # (optional) Password of the user used to connect to the database, depending on the server's authentication configuration.
2645
DB_NAME="jellyseerr" # (optional) The name of the database to connect to. The default is "jellyseerr".
2746
DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging. The default is "false".
2847
```
2948

3049
### SSL configuration
50+
3151
The following options can be used to further configure ssl. Certificates can be provided as a string or a file path, with the string version taking precedence.
3252

3353
```dotenv
@@ -40,6 +60,7 @@ DB_SSL_KEY_FILE= # (optinal) Path to the private key for the connection in PEM f
4060
DB_SSL_CERT= # (optional) Certificate chain in pem format for the private key, provided as a string. The default is "".
4161
DB_SSL_CERT_FILE= # (optional) Path to certificate chain in pem format for the private key. The default is "".
4262
```
63+
---
4364

4465
### Migrating from SQLite to PostgreSQL
4566

@@ -48,7 +69,7 @@ DB_SSL_CERT_FILE= # (optional) Path to certificate chain in pem format for the p
4869
3. Stop Jellyseerr
4970
4. Run the following command to export the data from the SQLite database and import it into the PostgreSQL database:
5071
:::info
51-
Edit the postgres connection string to match your setup
72+
Edit the postgres connection string to match your setup.
5273

5374
If you don't have or don't want to use docker, you can build the working pgloader version [in this PR](https://github.com/dimitri/pgloader/pull/1531) from source and use the same options as below.
5475
:::

docs/getting-started/buildfromsource.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar_position: 2
66
# Build from Source (Advanced)
77
:::warning
88
This method is not recommended for most users. It is intended for advanced users who are familiar with managing their own server infrastructure.
9+
10+
Refer to [Configuring Databases](/extending-jellyseerr/database-config#postgresql-options) for details on how to configure your database.
911
:::
1012

1113
import Tabs from '@theme/Tabs';

docs/getting-started/docker.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar_position: 1
77
:::info
88
This is the recommended method for most users.
99
Details on how to install Docker can be found on the [official Docker website](https://docs.docker.com/get-docker/).
10+
11+
Refer to [Configuring Databases](/extending-jellyseerr/database-config#postgresql-options) for details on how to configure your database.
1012
:::
1113

1214
## Unix (Linux, macOS)

0 commit comments

Comments
 (0)