From 7a5ee18e2c5497831419c79cac7d0c45391f9343 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 18:09:39 -0500 Subject: [PATCH] docs: update docs to add psql set up info --- README.md | 173 ----------------------- docs/README.md | 1 + docs/getting-started/database-config.mdx | 51 ++++++- 3 files changed, 50 insertions(+), 175 deletions(-) diff --git a/README.md b/README.md index 472ff12e..fb6c8790 100644 --- a/README.md +++ b/README.md @@ -38,179 +38,6 @@ With more features on the way! Check out our [issue tracker](https://github.com/ Check out our documentation for instructions on how to install and run Jellyseerr: -[//]: # 'TODO: move this to the docs' - -### Launching Jellyseerr using Docker (Recommended) - -Check out our docker hub for instructions on how to install and run Jellyseerr: -https://hub.docker.com/r/fallenbagel/jellyseerr - -### Database configuration - -Jellyseerr supports sqlite and postgres. The database connection can be configured using the following options: - -#### SQLite Options - -```dotenv -DB_TYPE="sqlite" # Which DB engine to use. 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. The default is "sqlite". To use postgres, this needs to be set to "postgres" -DB_HOST= # The host (url) of the database -DB_PORT="5432" # The port to connect to -DB_USER= # Username used to connect to the database -DB_PASS= # 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 - -### Building latest version from source (ADVANCED): - -#### Windows - -Pre-requisites: - -- Nodejs [v18](https://nodejs.org/download/release/v18.18.2) -- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) -- Download/git clone the source code from the github (Either develop branch or main for stable) - -```cmd -npm i -g win-node-env -set CYPRESS_INSTALL_BINARY=0 -yarn install --frozen-lockfile --network-timeout 1000000 -yarn run build -yarn start -``` - -(You can use task scheduler to run a bat script with `@echo off` and `yarn start` to run jellyseerr in the background) -(You can also use nssm to run jellyseerr as a service, see [nssm](https://nssm.cc/usage) for more information) - -_To set env variables such as `JELLYFIN_TYPE=emby` create a file called `.env` in the root directory of jellyseerr_ - -#### Linux - -**Pre-requisites:** - -- Nodejs [v18](https://nodejs.org/en/download/package-manager) -- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) (on Debian based distros, the package manager provided `yarn` is different and is a package called cmdlet. You can remove that using `apt-remove cmdlet` then install yarn using `npm install -g yarn`) -- Git - -**Steps:** - -1. Assuming you want the root folder for the jellyseerr source code to be cloned to `/opt` - -```bash -cd /opt -``` - -2. Then execute the following commands to clone and checkout to the stable version - -```bash -git clone https://github.com/Fallenbagel/jellyseerr.git && cd jellyseerr -git checkout main -``` - -3. Then install the dependencies and build the dist - -```bash -CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile --network-timeout 1000000 -yarn run build -``` - -4. Now you can start jellyseerr using `yarn start` and opening http://localhost:5055 in your browser. - -5. If you want to run jellyseerr as a _Systemd-service:_ - -- assuming jellyseerr was cloned to `/opt/` -- first create the environment file at `/etc/jellyseerr/jellyseerr.conf` - -Environment file: - -``` -# Jellyseerr's default port is 5055, if you want to use both, change this. -# specify on which port to listen -PORT=5055 - -# specify on which interface to listen, by default jellyseerr listens on all interfaces -#HOST=127.0.0.1 - -# Uncomment if your media server is emby instead of jellyfin. -# JELLYFIN_TYPE=emby -``` - -- Then run the command `which node` to find your node path (assuming it's at `/usr/bin/node`) -- Then create the service file using `sudo systemctl edit jellyseerr.service` or creating and editing a file at `/etc/systemd/system/jellyseerr.service` - -Service file contents: - -``` -[Unit] -Description=Jellyseerr Service -Wants=network-online.target -After=network-online.target - -[Service] -EnvironmentFile=/etc/jellyseerr/jellyseerr.conf -Environment=NODE_ENV=production -Type=exec -Restart=on-failure -WorkingDirectory=/opt/jellyseerr -ExecStart=/usr/bin/node dist/index.js - -[Install] -WantedBy=multi-user.target -``` - -### Building develop branch from source (ADVANCED): - -#### Windows - -Pre-requisites: - -- Nodejs [v20](https://nodejs.org/en/download) -- Pnpm [v9](https://pnpm.io/installation) -- Download/git clone the source code from the github (Either develop branch or main for stable) - -```cmd -npm i -g win-node-env -set CYPRESS_INSTALL_BINARY=0 -pnpm install --frozen-lockfile -pnpm run build -pnpm start -``` - -(You can use task scheduler to run a bat script with `@echo off` and `pnpm start` to run jellyseerr in the background) -(You can also use nssm to run jellyseerr as a service, see [nssm](https://nssm.cc/usage) for more information) - https://docs.jellyseerr.dev/getting-started/ ### Packages: diff --git a/docs/README.md b/docs/README.md index a441434d..0d0129c1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,6 +17,7 @@ Welcome to the Jellyseerr Documentation. - **Mobile-friendly design**, for when you need to approve requests on the go. - Granular permission system. - Localization into other languages. +- Support for PostgreSQL and SQLite databases. - More features to come! ## Motivation diff --git a/docs/getting-started/database-config.mdx b/docs/getting-started/database-config.mdx index 6cb3f9b7..0ad7389c 100644 --- a/docs/getting-started/database-config.mdx +++ b/docs/getting-started/database-config.mdx @@ -1,5 +1,52 @@ --- -title: Using Postgres -description: Use postgres as the database for Jellyseerr instead of SQLite +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