# Pull Request: PostgreSQL Integration, Windows Installer, and Documentation Overhaul ## ๐ŸŽฏ Overview This PR completes the PostgreSQL integration for Jellyfin with comprehensive Windows installer support, centralized build output, OS-specific configuration, and a complete documentation overhaul. ## ๐Ÿš€ What's New ### 1. **Complete Documentation Overhaul** ๐Ÿ“š - Rewrote **README.md** to highlight PostgreSQL features, Windows installer, and migration guides - Moved all markdown files to `docs/` folder for better organization (30+ files organized) - Created comprehensive documentation index with quick start and detailed guides - Added `README_GENERATION.md` and `DOCUMENTATION_ORGANIZATION.md` for maintenance - Preserved original README as `README.original.md` - Clear platform-specific instructions (Windows/Linux/macOS) ### 2. **Professional Windows Installer** ๐Ÿ’ฟ - **Inno Setup script** (`jellyfin-setup.iss`) with full wizard support - **PowerShell build automation** (`build-installer.ps1`) for easy installer creation - **Features:** - Windows Service installation - Firewall rules configuration - PostgreSQL connection wizard - .NET runtime verification - Clean uninstaller - **Comprehensive documentation:** - `INSTALLER_QUICK_START.md` - 5-minute guide - `INSTALLER_GUIDE.md` - Complete reference with WiX, MSIX options - `BUILD_INSTALLER_FIXED.md` - Build script usage ### 3. **Centralized Build Output** ๐Ÿ”จ - All DLLs now output to `lib\[Configuration]\[TargetFramework]\` at repository root - Configured via `Directory.Build.props` - **Benefits:** - Single location for all build artifacts - Easier deployment and packaging - No duplicate dependencies - Faster builds - Documentation: `CENTRALIZED_LIB_FOLDER.md` ### 4. **OS-Specific Startup Configuration** โš™๏ธ - Auto-generates `startup.json` with OS-appropriate defaults on first run - **Platform defaults:** - **Windows:** `C:/ProgramData/jellyfin` - **Linux:** `/var/lib/jellyfin`, `/etc/jellyfin` - **macOS:** `~/Library/Application Support/jellyfin` - Removes null/example config - immediately usable - Configuration priority: CLI args โ†’ Environment vars โ†’ startup.json โ†’ Built-in defaults - **Documentation:** - `OS_SPECIFIC_STARTUP_CONFIG.md` - `STARTUP_JSON_VERIFICATION.md` - `STARTUP_JSON_FIX.md` ### 5. **PostgreSQL Migration Improvements** ๐Ÿ—„๏ธ - Assign all tables to correct PostgreSQL schemas in EF Core migrations - Fix identifier quoting (SQL Server brackets โ†’ PostgreSQL double quotes) - Use InsertData for placeholder BaseItems row (no raw SQL) - **Auto-recovery:** Handles 42P07 errors (table exists) - Added `RecordMigrationAsAppliedAsync` for manual migration history - Improved migration logging and error handling - **Documentation:** - `POSTGRESQL_MIGRATION_COMPLETE.md` - `MIGRATION_RECOVERY_FIX.md` - `SQLITE_MIGRATION_FILTERING_FIX.md` - Idempotent, production-ready SQL migration scripts - PowerShell script for automated migration verification ### 6. **Platform Configuration Templates** ๐Ÿ“‹ - Added Linux/Windows startup config templates in `Resources/Configuration/` - FHS-compliant default paths - Platform-specific README with usage instructions - Improved portability and cross-platform consistency ### 7. **Build and Deployment Improvements** ๐Ÿšข - Enhanced publish profiles with platform targeting - Clean deploy: deletes existing files before publish - Updated `.gitignore`: - Excludes `lib/` (build output) - Excludes `installer-output/` - Excludes all `PublishProfiles/` folders (machine-specific) - Cleaned up tracked publish profile XMLs - Switched to relative paths for improved portability --- ## ๐Ÿ“Š Changes Summary ### Files Added/Created - `build-installer.ps1` - PowerShell installer build script - `jellyfin-setup.iss` - Inno Setup installer script - `jellyfin.ico` - Application icon - `docs/INSTALLER_QUICK_START.md` - 5-minute installer guide - `docs/INSTALLER_GUIDE.md` - Complete installer documentation - `docs/BUILD_INSTALLER_FIXED.md` - Build script usage - `docs/CENTRALIZED_LIB_FOLDER.md` - Build output documentation - `docs/OS_SPECIFIC_STARTUP_CONFIG.md` - OS configuration guide - `docs/STARTUP_JSON_VERIFICATION.md` - Configuration loading details - `docs/STARTUP_JSON_FIX.md` - Fixing null value issues - `docs/GITIGNORE_PUBLISHPROFILES.md` - GitIgnore documentation - `docs/DOCUMENTATION_ORGANIZATION.md` - Doc organization summary - `docs/README_GENERATION.md` - README generation process - `Jellyfin.Server/Resources/Configuration/startup.*.json` - Platform templates ### Files Modified - `README.md` - Complete rewrite with PostgreSQL focus - `Directory.Build.props` - Centralized build output configuration - `.gitignore` - Updated exclusions for lib, installer-output, PublishProfiles - `Jellyfin.Server/Helpers/StartupHelpers.cs` - OS-specific config generation - EF Core migrations - PostgreSQL schema and quoting fixes - Publish profiles - Platform targeting and clean deploy ### Files Moved - 30+ documentation files โ†’ `docs/` folder - All README links updated to point to `docs/` ### Files Removed - Old `Jellyfin.Server/startup.json` (now generated at runtime) - Obsolete Windows publish profiles - Tracked PublishProfiles XML files --- ## ๐ŸŽฏ Migration Guide ### From SQLite to PostgreSQL ```bash # 1. Backup SQLite database cp jellyfin.db jellyfin-backup.db # 2. Install PostgreSQL 12+ winget install PostgreSQL.PostgreSQL # 3. Create database psql -U postgres CREATE USER jellyfin WITH PASSWORD 'your_password'; CREATE DATABASE jellyfin OWNER jellyfin; \q # 4. Update startup.json { "DatabaseProvider": "Postgres", "ConnectionStrings": { "DefaultConnection": "Host=localhost;Database=jellyfin;Username=jellyfin;Password=your_password" } } # 5. Run migration dotnet run --project Jellyfin.Server -- --migrate-database ``` See `docs/POSTGRESQL_MIGRATION_COMPLETE.md` for details. --- ## ๐Ÿ”จ Building and Installation ### Quick Build ```bash 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 ``` ### Create Windows Installer ```powershell # Install Inno Setup winget install JRSoftware.InnoSetup # Build installer .\build-installer.ps1 # Result: installer-output\JellyfinSetup-PostgreSQL-11.0.0.exe ``` --- ## ๐Ÿงช Testing ### Tested Scenarios - โœ… Fresh install on Windows - โœ… Migration from SQLite to PostgreSQL - โœ… OS-specific configuration generation - โœ… Windows Service installation - โœ… Firewall rules creation - โœ… Build output to lib folder - โœ… Documentation links and navigation ### Tested Platforms - โœ… Windows 10/11 - โœ… Linux (Ubuntu 22.04) - โœ… PostgreSQL 12, 14, 15, 16, 17, 18 --- ## ๐Ÿ“ Documentation All documentation is now in the `docs/` folder with a complete index in README.md: ### Configuration - OS_SPECIFIC_STARTUP_CONFIG.md - STARTUP_JSON_VERIFICATION.md - STARTUP_JSON_FIX.md ### PostgreSQL - QUICKSTART_POSTGRESQL.md - POSTGRESQL_MIGRATION_COMPLETE.md - POSTGRESQL_TROUBLESHOOTING.md ### Installation - INSTALLER_QUICK_START.md - INSTALLER_GUIDE.md - CENTRALIZED_LIB_FOLDER.md - BUILD_INSTALLER_FIXED.md ### Backup & Recovery - POSTGRES_BACKUP_IMPLEMENTATION.md - POSTGRESQL_BACKUP_ANALYSIS.md ### Project Status - PROJECT_COMPLETION.md - POC_SUMMARY_REPORT.md [View All Documentation โ†’](./docs/) --- ## โš ๏ธ Breaking Changes **None!** All changes are backward compatible: - Existing `startup.json` files are preserved - SQLite users can continue using SQLite - Migration to PostgreSQL is optional - Default behavior unchanged for existing installations --- ## ๐ŸŽ‰ Benefits ### For Users - โœ… Professional Windows installer with wizard - โœ… Automatic OS-specific configuration - โœ… Better performance with large media libraries - โœ… Enterprise-grade database backend - โœ… Easy migration from SQLite ### For Developers - โœ… Centralized build output (lib folder) - โœ… Comprehensive documentation - โœ… Easy installer creation (5 minutes) - โœ… Clean repository structure - โœ… Better cross-platform support ### For System Admins - โœ… FHS-compliant paths on Linux - โœ… Windows Service support - โœ… Professional backup solutions - โœ… Database replication and clustering support --- ## ๐Ÿ”„ Commits Included 1. **Docs: overhaul README, centralize docs, update .gitignore** - Documentation reorganization 2. **Add Windows installer scripts, docs, and startup.json fixes** - Installer infrastructure 3. **Centralize build output and generate OS-specific startup.json** - Build improvements 4. **Platform config templates & Postgres migration recovery** - Configuration and migration 5. **PostgreSQL migration: schema fixes, docs, and tooling** - Database migrations 6. **Update publish profiles and .gitignore for Windows build** - Build configuration 7. **Update publish profile and web dir config for portability** - Path improvements --- ## ๐Ÿ“ž Support - ๐Ÿ“š [Documentation](./docs/) - ๐Ÿ› [Report Bug](https://gitea.wpjones.com/wjones/pgsql-jellyfin/issues) - ๐Ÿ’ก [Request Feature](https://gitea.wpjones.com/wjones/pgsql-jellyfin/issues) --- ## โœ… Checklist - [x] Code compiles without errors - [x] All tests pass - [x] Documentation updated and comprehensive - [x] README.md reflects all changes - [x] .gitignore updated appropriately - [x] Migration scripts tested - [x] Windows installer tested - [x] Cross-platform compatibility verified - [x] No breaking changes introduced --- ## ๐ŸŽฏ Ready to Merge This PR represents a major milestone for the PostgreSQL-enabled Jellyfin fork: - Complete documentation overhaul with 30+ organized files - Professional Windows installer with service support - Centralized build output for easier deployment - OS-specific configuration that "just works" - Robust PostgreSQL migration with auto-recovery - Production-ready, tested, and documented **Recommended for merge into main branch.** --- **Pull Request Type:** Feature + Documentation + Build Improvement **Target Branch:** main **Source Branch:** pgsql_testing_branch **Reviewer:** @maintainers **Priority:** High