# 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 1. ✅ `Jellyfin.Server/Properties/PublishProfiles/MultiInstance-Win-x64.pubxml` 2. ✅ `Jellyfin.Server/Properties/PublishProfiles/MultiInstance-Linux-x64.pubxml` 3. ✅ `Jellyfin.Server/Properties/PublishProfiles/MultiInstance-FrameworkDependent.pubxml` ### Automation Scripts 4. ✅ `PublishAndDeploy.ps1` - Automated publish and deployment script ### Documentation 5. ✅ `docs/PUBLISHING_PROFILES_GUIDE.md` - Complete usage guide ### Project Updates 6. ✅ Updated `Jellyfin.Server/Jellyfin.Server.csproj` - Fixed SQL file inclusion ## Quick Start ### Option 1: Command Line (Recommended) ```powershell # 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 1. Right-click `Jellyfin.Server` project 2. Click **Publish** 3. Select **MultiInstance-Win-x64** profile 4. Click **Publish** button ### Option 3: Automated Script ```powershell # 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.json` templates for Windows/Linux - `database.xml` will 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 ```powershell dotnet publish -p:PublishProfile=MultiInstance-Win-x64 ``` ### 2. Copy to Server ```powershell # 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 Jellyfin-PostgreSQL Host=192.168.129.248;Port=5432;Database=jellyfin;Username=jellyfin;Password=YOUR_PASSWORD ``` ### 4. Run Multi-Instance SQL Setup ```powershell # 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 ```powershell 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.pubxml` - `Jellyfin.Server/Properties/PublishProfiles/MultiInstance-Linux-x64.pubxml` - `Jellyfin.Server/Properties/PublishProfiles/MultiInstance-FrameworkDependent.pubxml` - `PublishAndDeploy.ps1` - `docs/PUBLISHING_PROFILES_GUIDE.md` - `docs/PUBLISH_PROFILES_SETUP_COMPLETE.md` (this file) ## Next Steps ### For Testing 1. **Publish the application**: ```powershell dotnet publish -p:PublishProfile=MultiInstance-Win-x64 ``` 2. **Deploy to test server** 3. **Start multiple instances** (different ports): ```powershell # Instance 1 (port 8096) cd C:\Jellyfin-Instance1 .\jellyfin.exe # Instance 2 (port 8097) cd C:\Jellyfin-Instance2 .\jellyfin.exe --port 8097 ``` 4. **Verify multi-instance coordination**: ```sql -- 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 1. **Commit changes to your branch**: ```powershell git add . git commit -m "Add publishing profiles for multi-instance deployment" git push origin multi-instance-testing ``` 2. **Create release tag** (optional): ```powershell git tag -a v1.0-multiinstance -m "Multi-instance PostgreSQL support complete" git push origin v1.0-multiinstance ``` 3. **Deploy to production servers** using the publish profiles ## Troubleshooting ### Publish Fails with Missing Files **Check SQL files exist**: ```powershell Get-ChildItem sql\*.sql ``` **Verify project file paths**: ```powershell Get-Content Jellyfin.Server\Jellyfin.Server.csproj | Select-String "sql" ``` ### Published App Won't Start **Check database configuration**: ```powershell Test-Path "C:\Jellyfin\config\database.xml" Get-Content "C:\Jellyfin\config\database.xml" ``` **Test PostgreSQL connection**: ```powershell 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