78c8d4256c
- Moved all documentation to docs/ and updated README with categorized links and new docs/INDEX.md - Added HOW_TO_SWITCH_DATABASE.md and several new analysis/action docs - Introduced db-config.ps1 for centralized DB config; all scripts now use it for easy DB switching - Added db-quick.ps1 for interactive diagnostics and index management - Updated Add-All-Indexes.bat to use db-config.ps1 - Added Fix-ItemValues-Performance.ps1 to create 3 critical indexes on ItemValues, addressing 1.3B row seq scan issue - Updated performance_indexes.sql with new ItemValues indexes and ANALYZE - Updated diagnostics.sql and database_report.txt for improved output and clarity - All scripts and docs now reference the new config and index optimization workflow
317 lines
10 KiB
Markdown
317 lines
10 KiB
Markdown
# 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
|