- Implements Phases 3–6: session isolation, cache coordination, primary election, and file system monitor coordination for Jellyfin with PostgreSQL. - Adds new database entities (Instance, DistributedLock, FileSystemChange) and EF model configurations. - Includes SQL migration scripts and EF migration for all required tables, columns, and helper functions. - Updates Device entity and JellyfinDbContext for multi-instance tracking. - Integrates new DI services for instance registry, distributed locks, cache coordinator, and primary election. - Adds publishing profiles (Win/Linux/FrameworkDependent) and automation script for deployment. - Extensive documentation for architecture, setup, and publishing. - All changes are backward compatible and build successfully.
7.9 KiB
Publishing Profiles - Setup Complete! ✅
Summary
Successfully created 3 publishing profiles for your multi-instance Jellyfin deployment on the multi-instance-testing branch!
Files Created
Publishing Profiles
- ✅
Jellyfin.Server/Properties/PublishProfiles/MultiInstance-Win-x64.pubxml - ✅
Jellyfin.Server/Properties/PublishProfiles/MultiInstance-Linux-x64.pubxml - ✅
Jellyfin.Server/Properties/PublishProfiles/MultiInstance-FrameworkDependent.pubxml
Automation Scripts
- ✅
PublishAndDeploy.ps1- Automated publish and deployment script
Documentation
- ✅
docs/PUBLISHING_PROFILES_GUIDE.md- Complete usage guide
Project Updates
- ✅ Updated
Jellyfin.Server/Jellyfin.Server.csproj- Fixed SQL file inclusion
Quick Start
Option 1: Command Line (Recommended)
# Publish Windows self-contained
dotnet publish Jellyfin.Server\Jellyfin.Server.csproj `
-p:PublishProfile=MultiInstance-Win-x64 `
--configuration Release
# Output: lib\Release\net11.0\win-x64\publish\
Option 2: Visual Studio
- Right-click
Jellyfin.Serverproject - Click Publish
- Select MultiInstance-Win-x64 profile
- Click Publish button
Option 3: Automated Script
# Publish and deploy in one command
.\PublishAndDeploy.ps1
# Publish Linux (no deploy)
.\PublishAndDeploy.ps1 -Profile MultiInstance-Linux-x64 -SkipDeploy
# Create deployment package
.\PublishAndDeploy.ps1 -CreatePackage
Verification Results
Latest Publish Test (MultiInstance-Win-x64)
╔══════════════════════════════════════════════════════════╗
║ ✓ Multi-Instance Publish - SUCCESSFUL ║
╚══════════════════════════════════════════════════════════╝
Location: D:\Projects\pgsql-jellyfin\lib\Release\net11.0\win-x64\publish
Critical Files:
Application:
✓ jellyfin.exe
PostgreSQL:
✓ Npgsql.dll
✓ Jellyfin.Database.Providers.Postgres.dll
Multi-Instance SQL:
✓ sql\add_multi_instance_support.sql
Config Templates:
✓ startup.json
✓ startup.json.windows
✓ startup.json.linux
Package Summary:
Total Size: 212.41 MB
File Count: 524 files
Profile: MultiInstance-Win-x64
Profile Comparison
| Profile | Size | .NET Runtime | Startup | Best For |
|---|---|---|---|---|
| Win-x64 | ~210 MB | ✅ Included | Fast (R2R) | Windows production servers |
| Linux-x64 | ~210 MB | ✅ Included | Fast (R2R) | Linux production servers |
| Framework-Dependent | ~100 MB | ❌ Required | Normal | Servers with .NET 11 installed |
What's Included
All profiles include:
✅ Multi-Instance Code (All 6 Phases):
- Phase 1: Instance Registration & Heartbeat
- Phase 2: Distributed Locking
- Phase 3: Session Isolation
- Phase 4: Cache Coordination
- Phase 5: Primary Instance Election
- Phase 6: File System Monitor Coordination
✅ Database Scripts:
sql/add_multi_instance_support.sql- Complete setup script- All other SQL utilities and schema scripts
✅ Configuration:
startup.jsontemplates for Windows/Linuxdatabase.xmlwill be created on first run
✅ Dependencies:
- Npgsql (PostgreSQL driver)
- EF Core 11 with PostgreSQL provider
- All clustering and coordination libraries
Deployment Steps
1. Publish the Application
dotnet publish -p:PublishProfile=MultiInstance-Win-x64
2. Copy to Server
# Local deployment
Copy-Item -Path "lib\Release\net11.0\win-x64\publish\*" `
-Destination "C:\Jellyfin" -Recurse -Force
# Or create package
Compress-Archive -Path "lib\Release\net11.0\win-x64\publish\*" `
-DestinationPath "Jellyfin-MultiInstance.zip"
3. Configure Database Connection
Create C:\Jellyfin\config\database.xml (or path from startup.json):
<?xml version="1.0" encoding="utf-8"?>
<DatabaseConfigurationOptions>
<DatabaseType>Jellyfin-PostgreSQL</DatabaseType>
<CustomProviderOptions>
<ConnectionString>Host=192.168.129.248;Port=5432;Database=jellyfin;Username=jellyfin;Password=YOUR_PASSWORD</ConnectionString>
</CustomProviderOptions>
</DatabaseConfigurationOptions>
4. Run Multi-Instance SQL Setup
# One time only - sets up all 6 phases
psql -h 192.168.129.248 -U jellyfin -d jellyfin `
-f "C:\Jellyfin\sql\add_multi_instance_support.sql"
5. Start Jellyfin
cd C:\Jellyfin
.\jellyfin.exe
Git Branch Status
Branch: multi-instance-testing
Remote: https://gitea.wpjones.com/wjones/pgsql-jellyfin
Files Modified:
Jellyfin.Server/Jellyfin.Server.csproj- Fixed SQL file paths
Files Added:
Jellyfin.Server/Properties/PublishProfiles/MultiInstance-Win-x64.pubxmlJellyfin.Server/Properties/PublishProfiles/MultiInstance-Linux-x64.pubxmlJellyfin.Server/Properties/PublishProfiles/MultiInstance-FrameworkDependent.pubxmlPublishAndDeploy.ps1docs/PUBLISHING_PROFILES_GUIDE.mddocs/PUBLISH_PROFILES_SETUP_COMPLETE.md(this file)
Next Steps
For Testing
-
Publish the application:
dotnet publish -p:PublishProfile=MultiInstance-Win-x64 -
Deploy to test server
-
Start multiple instances (different ports):
# Instance 1 (port 8096) cd C:\Jellyfin-Instance1 .\jellyfin.exe # Instance 2 (port 8097) cd C:\Jellyfin-Instance2 .\jellyfin.exe --port 8097 -
Verify multi-instance coordination:
-- Check registered instances SELECT instance_id, host_name, ip_address, last_heartbeat, is_active FROM library.instances; -- Check primary election SELECT library.get_primary_instance();
For Production
-
Commit changes to your branch:
git add . git commit -m "Add publishing profiles for multi-instance deployment" git push origin multi-instance-testing -
Create release tag (optional):
git tag -a v1.0-multiinstance -m "Multi-instance PostgreSQL support complete" git push origin v1.0-multiinstance -
Deploy to production servers using the publish profiles
Troubleshooting
Publish Fails with Missing Files
Check SQL files exist:
Get-ChildItem sql\*.sql
Verify project file paths:
Get-Content Jellyfin.Server\Jellyfin.Server.csproj | Select-String "sql"
Published App Won't Start
Check database configuration:
Test-Path "C:\Jellyfin\config\database.xml"
Get-Content "C:\Jellyfin\config\database.xml"
Test PostgreSQL connection:
Test-NetConnection -ComputerName 192.168.129.248 -Port 5432
SQL Scripts Not Copied
The project file now uses ..\..\sql\ path (relative to project directory).
SQL files should appear in {publish}\sql\*.sql.
Documentation
📖 Complete Guide: docs/PUBLISHING_PROFILES_GUIDE.md
📖 Configuration Fix: docs/CONFIGURATION_LOADING_FIX.md
📖 Multi-Instance Overview: docs/MULTI_INSTANCE_COMPLETE.md
📖 PostgreSQL Troubleshooting: docs/POSTGRESQL_CONNECTION_TROUBLESHOOTING.md
Summary
✅ 3 publishing profiles created for different deployment scenarios
✅ Automation script for one-command publish and deploy
✅ SQL scripts automatically included in publish output
✅ All multi-instance code (Phases 1-6) included
✅ Comprehensive documentation for deployment and usage
✅ Tested successfully - 212 MB package with 524 files
You're ready to publish and deploy your multi-instance Jellyfin! 🎉
Created: After completing publishing profile setup
Branch: multi-instance-testing
Status: ✅ Ready for deployment