wjones c76853a442 PostgreSQL: Production fixes—UPSERT, remote backup, auth logs
- Fix: Atomic UPSERT for BaseItemProviders (resolves duplicate key errors during concurrent metadata refresh; clears navigation property to prevent EF Core tracking conflicts)
- Add: Remote PostgreSQL backup support (removes localhost-only restriction; works with pg_dump/pg_restore for both local and remote DBs)
- Add: Configurable backup disable option (`disable-backups`)
- Fix: Query timeout and performance (documented `command-timeout` config, added performance index scripts)
- Fix: Authentication errors now log as warnings with clear messages (ExceptionMiddleware), reducing log noise
- Fix: SyncPlay authorization handler validates user before lookup, logs warnings for unauthenticated/unknown users (returns 403/404)
- Fix: Database deadlock detection logs warnings and allows EF Core auto-retry
- Add: Configurable LibraryMonitorDelay (min 30s, default 60s)
- Fix: SQLite migration filtering—skip SQLite-only migrations on PostgreSQL
- Chore: Suppress StyleCop warnings (SA1137, etc.) for project consistency
- Docs: 21 documentation files added/updated (config, backup, performance, troubleshooting, session summary)
- All changes are backward compatible and production-ready
2026-03-03 16:35:27 -05:00

Jellyfin with PostgreSQL Support

The Free Software Media System - Now with Enterprise Database Backend


🚀 What's New in This Fork?

This is a PostgreSQL-enabled fork of Jellyfin that replaces SQLite with PostgreSQL for improved performance, scalability, and reliability.

Key Features

  • PostgreSQL Database Backend - Full migration from SQLite
  • Improved Performance - Better handling of large libraries
  • Enterprise Scalability - Replication and clustering support
  • Professional Backups - pgBackRest integration
  • OS-Specific Configuration - Auto-configuration for Windows/Linux/macOS
  • Windows Installer - Professional installer with PostgreSQL wizard
  • Centralized Build - All DLLs in lib folder

📚 Quick Navigation


🎯 Quick Start

Windows Installer

# Run JellyfinSetup-PostgreSQL-11.0.0.exe
# Follow wizard for PostgreSQL setup

From Source

git clone https://gitea.wpjones.com/wjones/pgsql-jellyfin.git
cd pgsql-jellyfin
dotnet build --configuration Release
cd lib/Release/net11.0
dotnet jellyfin.dll

📖 See INSTALLER_QUICK_START.md or QUICKSTART_POSTGRESQL.md


📦 Installation

Prerequisites

Install from Installer (Windows)

  1. Download JellyfinSetup-PostgreSQL-11.0.0.exe
  2. Run installer, select options
  3. Configure PostgreSQL (or skip for later)
  4. Open http://localhost:8096

📖 Full guide: INSTALLER_GUIDE.md

Install from Source

Windows:

dotnet build Jellyfin.Server --configuration Release
cd lib\Release\net11.0
jellyfin.exe

Linux:

dotnet build Jellyfin.Server --configuration Release
cd lib/Release/net11.0
./jellyfin

🗄️ PostgreSQL Setup

Quick Install

Windows:

winget install PostgreSQL.PostgreSQL

Linux:

sudo apt install postgresql postgresql-contrib

Create Database

psql -U postgres
CREATE USER jellyfin WITH PASSWORD 'your_password';
CREATE DATABASE jellyfin OWNER jellyfin;
GRANT ALL PRIVILEGES ON DATABASE jellyfin TO jellyfin;
\q

Configure Connection

Edit startup.json:

{
  "DatabaseProvider": "Postgres",
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Database=jellyfin;Username=jellyfin;Password=your_password"
  }
}

📖 Full guide: QUICKSTART_POSTGRESQL.md


⚙️ Configuration

OS-Specific Defaults

startup.json is auto-configured per platform:

  • Windows: C:/ProgramData/jellyfin
  • Linux: /var/lib/jellyfin, /etc/jellyfin
  • macOS: ~/Library/Application Support/jellyfin

Priority Order

  1. Command-line arguments
  2. Environment variables
  3. startup.json
  4. Built-in defaults

📖 Docs: OS_SPECIFIC_STARTUP_CONFIG.md, STARTUP_JSON_VERIFICATION.md


🔨 Building from Source

git clone https://gitea.wpjones.com/wjones/pgsql-jellyfin.git
cd pgsql-jellyfin
dotnet restore
dotnet build --configuration Release
# Output: lib/Release/net11.0/

📖 See CENTRALIZED_LIB_FOLDER.md


📦 Creating an Installer

# 1. Install Inno Setup
winget install JRSoftware.InnoSetup

# 2. Build
.\build-installer.ps1

# 3. Result
# installer-output\JellyfinSetup-PostgreSQL-11.0.0.exe

Features:

  • Windows Service installation
  • Firewall rules
  • PostgreSQL wizard
  • .NET runtime check

📖 Guides: INSTALLER_QUICK_START.md, INSTALLER_GUIDE.md


🔄 Migration Guide

SQLite to PostgreSQL

# 1. Backup
cp jellyfin.db jellyfin-backup.db

# 2. Set up PostgreSQL
# 3. Update startup.json
# 4. Run migration
dotnet run --project Jellyfin.Server -- --migrate-database

📖 See POSTGRESQL_MIGRATION_COMPLETE.md


🔧 Troubleshooting

PostgreSQL Connection

# Check status
sudo systemctl status postgresql

# Test connection
psql -U jellyfin -d jellyfin

Service Issues

# Check logs
tail -f /var/log/jellyfin/log_*.txt

📖 Full guides: POSTGRESQL_TROUBLESHOOTING.md, TROUBLESHOOTING_EF_PENDING_CHANGES.md


📖 Documentation

🚀 Getting Started

⚙️ Configuration & Setup

🗄️ PostgreSQL Setup & Migration

💾 Backup & Restore

Performance & Optimization

🔍 Database Diagnostics & Analysis

🔧 Error Fixes & Troubleshooting

📦 Installation & Publishing

📜 Project Information & Planning

🛠️ Developer Resources

📂 Additional Documentation

📁 View All Documentation →


📝 License

GNU General Public License v2.0

Fork of Jellyfin


📞 Support


Quick Reference

# Build
dotnet build --configuration Release

# Run
cd lib/Release/net11.0 && dotnet jellyfin.dll

# Create installer
.\build-installer.ps1

# Test
dotnet test

Essential Paths:

  • Windows: C:\ProgramData\jellyfin
  • Linux: /var/lib/jellyfin
  • macOS: ~/Library/Application Support/jellyfin

Built with ❤️ for the Jellyfin community

JellyfinPostgreSQL.NET

S
Description
No description provided
Readme GPL-2.0 410 MiB
Languages
JavaScript 64.1%
C# 33.3%
PowerShell 1.8%
Shell 0.3%
HTML 0.3%