docs: update psql docs

This commit is contained in:
dr-carrot
2024-11-04 22:09:07 -05:00
parent 94efdf7a18
commit 830f431e01
2 changed files with 32 additions and 26 deletions

View File

@@ -1,43 +1,47 @@
---
title: Configuring the Database (Advanced)
description: Configure the database for Jellyseerr
sidebar_position: 5
sidebar_position: 2
---
# Configuring the Database
Jellyseerr supports SQLite and PostgreSQL. The database connection can be configured using the following environment variables:
#### SQLite Options
## SQLite Options
```dotenv
DB_TYPE="sqlite" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite"
CONFIG_DIRECTORY="config" # The path to the config directory where the db file is stored
DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging
DB_TYPE="sqlite" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite".
CONFIG_DIRECTORY="config" # (optional) The path to the config directory where the db file is stored. The default is "config".
DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging. The default is "false".
```
#### PostgreSQL Options
## PostgreSQL Options
```dotenv
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"
DB_HOST="postgres" # The host (url) of the database
DB_PORT="5432" # The port to connect to
DB_USER="jellyseerr" # Username used to connect to the database
DB_PASS="postgres" # Password of the user used to connect to the database
DB_NAME="jellyseerr" # The name of the database to connect to
DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging
DB_USE_SSL="false" # Whether to enable ssl for database connection
# The following options can be used to further configure ssl:
DB_SSL_REJECT_UNAUTHORIZED="true" # Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings
DB_SSL_CA= # The CA certificate to verify the connection, provided as a string
DB_SSL_CA_FILE= # The path to a CA certificate to verify the connection
DB_SSL_KEY= # The private key for the connection in PEM format, provided as a string
DB_SSL_KEY_FILE= # Path to the private key for the connection in PEM format
DB_SSL_CERT= # Certificate chain in pem format for the private key, provided as a string
DB_SSL_CERT_FILE= # Path to certificate chain in pem format for the private key
DB_HOST="localhost" # (optional) The host (url) of the database. The default is "localhost".
DB_PORT="5432" # (optional) The port to connect to. The default is "5432".
DB_USER= # (required) Username used to connect to the database
DB_PASS= # (required) Password of the user used to connect to the database
DB_NAME="jellyseerr" # (optional) The name of the database to connect to. The default is "jellyseerr".
DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging. The default is "false".
```
#### Migrating from SQLite to PostgreSQL
### SSL configuration
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.
```dotenv
DB_USE_SSL="false" # (optional) Whether to enable ssl for database connection. This must be "true" to use the other ssl options. The default is "false".
DB_SSL_REJECT_UNAUTHORIZED="true" # (optional) Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings. The default is "true".
DB_SSL_CA= # (optional) The CA certificate to verify the connection, provided as a string. The default is "".
DB_SSL_CA_FILE= # (optional) The path to a CA certificate to verify the connection. The default is "".
DB_SSL_KEY= # (optional) The private key for the connection in PEM format, provided as a string. The default is "".
DB_SSL_KEY_FILE= # (optinal) Path to the private key for the connection in PEM format. The default is "".
DB_SSL_CERT= # (optional) Certificate chain in pem format for the private key, provided as a string. The default is "".
DB_SSL_CERT_FILE= # (optional) Path to certificate chain in pem format for the private key. The default is "".
```
### Migrating from SQLite to PostgreSQL
1. Set up your PostgreSQL database and configure Jellyseerr to use it
2. Run Jellyseerr to create the tables in the PostgreSQL database

View File

@@ -11,7 +11,7 @@ export class AddBlacklist1730770837441 implements MigrationInterface {
"mediaType" VARCHAR NOT NULL,
"title" VARCHAR,
"tmdbId" INTEGER NOT NULL,
"createdAt" TIMESTAMP NOT NULL DEFAULT NOW(),
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
"userId" INTEGER,
"mediaId" INTEGER,
CONSTRAINT "UQ_6bbafa28411e6046421991ea21c" UNIQUE ("tmdbId", "userId")
@@ -24,7 +24,9 @@ export class AddBlacklist1730770837441 implements MigrationInterface {
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_6bbafa28411e6046421991ea21"`);
await queryRunner.query(`DROP TABLE "blacklist"`);
await queryRunner.query(
`DROP INDEX IF EXISTS "IDX_6bbafa28411e6046421991ea21"`
);
await queryRunner.query(`DROP TABLE IF EXISTS "blacklist"`);
}
}