53 lines
2.9 KiB
Plaintext
53 lines
2.9 KiB
Plaintext
---
|
|
title: Configuring the Database (Advanced)
|
|
description: Configure the database for Jellyseerr
|
|
sidebar_position: 5
|
|
---
|
|
# Configuring the Database
|
|
|
|
Jellyseerr supports SQLite and PostgreSQL. The database connection can be configured using the following environment variables:
|
|
|
|
#### 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
|
|
```
|
|
|
|
#### 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
|
|
```
|
|
|
|
#### 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
|
|
3. Stop Jellyseerr
|
|
4. Run the following command to export the data from the SQLite database and import it into the PostgreSQL database:
|
|
- Edit the postgres connection string to match your setup
|
|
- WARNING: The most recent release of pgloader has an issue quoting the table columns. Use the version in the docker container to avoid this issue.
|
|
- "I 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.
|
|
```bash
|
|
docker run --rm -v config/db.sqlite3:/db.sqlite3:ro -v pgloader/pgloader.load:/pgloader.load ghcr.io/ralgar/pgloader:pr-1531 pgloader --with "quote identifiers" --with "data only" /db.sqlite3 postgresql://{{DB_USER}}:{{DB_PASS}}@{{DB_HOST}}:{{DB_PORT}}/{{DB_NAME}}
|
|
```
|
|
5. Start Jellyseerr
|