77e30685bb
- 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.
143 lines
3.7 KiB
Markdown
143 lines
3.7 KiB
Markdown
# Quick Reference - Publishing Multi-Instance Jellyfin
|
|
|
|
## One-Command Publishing
|
|
|
|
```powershell
|
|
# Windows self-contained (recommended)
|
|
dotnet publish -p:PublishProfile=MultiInstance-Win-x64
|
|
|
|
# Linux self-contained
|
|
dotnet publish -p:PublishProfile=MultiInstance-Linux-x64
|
|
|
|
# Framework-dependent (smaller, requires .NET 11 runtime)
|
|
dotnet publish -p:PublishProfile=MultiInstance-FrameworkDependent
|
|
```
|
|
|
|
## Automated Deployment
|
|
|
|
```powershell
|
|
# Publish and deploy in one step
|
|
.\PublishAndDeploy.ps1
|
|
|
|
# Options
|
|
.\PublishAndDeploy.ps1 -Profile MultiInstance-Linux-x64 -SkipDeploy
|
|
.\PublishAndDeploy.ps1 -CreatePackage -PackageOutput "C:\Releases"
|
|
.\PublishAndDeploy.ps1 -DeployPath "D:\Jellyfin" -Verbose
|
|
```
|
|
|
|
## Output Locations
|
|
|
|
```
|
|
Profile: MultiInstance-Win-x64
|
|
Output: lib\Release\net11.0\win-x64\publish\
|
|
|
|
Profile: MultiInstance-Linux-x64
|
|
Output: lib\Release\net11.0\linux-x64\publish\
|
|
|
|
Profile: MultiInstance-FrameworkDependent
|
|
Output: lib\Release\net11.0\win-x64\publish\
|
|
```
|
|
|
|
## Essential Files in Package
|
|
|
|
```
|
|
jellyfin.exe # Main application
|
|
Npgsql.dll # PostgreSQL driver
|
|
sql\add_multi_instance_support.sql # Multi-instance setup script
|
|
startup.json # Configuration file
|
|
startup.json.windows # Windows template
|
|
startup.json.linux # Linux template
|
|
```
|
|
|
|
## First-Time Deployment Checklist
|
|
|
|
- [ ] 1. Publish application using a profile
|
|
- [ ] 2. Copy to target server
|
|
- [ ] 3. Create `config/database.xml` with PostgreSQL connection
|
|
- [ ] 4. Run `sql/add_multi_instance_support.sql` on database
|
|
- [ ] 5. Start Jellyfin
|
|
|
|
## Database Configuration Template
|
|
|
|
```xml
|
|
<!-- config/database.xml -->
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<DatabaseConfigurationOptions>
|
|
<DatabaseType>Jellyfin-PostgreSQL</DatabaseType>
|
|
<CustomProviderOptions>
|
|
<ConnectionString>Host=YOUR_SERVER;Port=5432;Database=jellyfin;Username=jellyfin;Password=YOUR_PASSWORD</ConnectionString>
|
|
</CustomProviderOptions>
|
|
</DatabaseConfigurationOptions>
|
|
```
|
|
|
|
## Multi-Instance Setup SQL
|
|
|
|
```powershell
|
|
# Run once per database (not per instance!)
|
|
psql -h YOUR_SERVER -U jellyfin -d jellyfin -f sql\add_multi_instance_support.sql
|
|
```
|
|
|
|
## Verify Deployment
|
|
|
|
```powershell
|
|
# Check critical files
|
|
Test-Path "C:\Jellyfin\jellyfin.exe"
|
|
Test-Path "C:\Jellyfin\sql\add_multi_instance_support.sql"
|
|
Test-Path "C:\Jellyfin\config\database.xml"
|
|
|
|
# Test PostgreSQL connection
|
|
Test-NetConnection -ComputerName YOUR_SERVER -Port 5432
|
|
```
|
|
|
|
## Start Application
|
|
|
|
```powershell
|
|
# Windows
|
|
cd C:\Jellyfin
|
|
.\jellyfin.exe
|
|
|
|
# Linux
|
|
cd /opt/jellyfin
|
|
./jellyfin
|
|
|
|
# Custom port
|
|
.\jellyfin.exe --port 8097
|
|
```
|
|
|
|
## Verify Multi-Instance Setup
|
|
|
|
```sql
|
|
-- Check registered instances
|
|
SELECT instance_id, host_name, is_active FROM library.instances;
|
|
|
|
-- Check primary instance
|
|
SELECT library.get_primary_instance();
|
|
|
|
-- Check heartbeats
|
|
SELECT instance_id, last_heartbeat FROM library.instances WHERE is_active = true;
|
|
```
|
|
|
|
## Common Issues
|
|
|
|
| Issue | Solution |
|
|
|-------|----------|
|
|
| "Failed to connect to 127.0.0.1:5432" | Create `config/database.xml` with correct connection |
|
|
| SQL script not found | Verify `sql/add_multi_instance_support.sql` exists in publish output |
|
|
| Port already in use | Use `--port 8097` to specify different port |
|
|
| .NET runtime not found (Framework-Dependent) | Install .NET 11 runtime on target server |
|
|
|
|
## Package Sizes
|
|
|
|
- **Self-Contained**: ~210 MB (includes .NET runtime)
|
|
- **Framework-Dependent**: ~100 MB (requires .NET 11 runtime)
|
|
|
|
## Documentation
|
|
|
|
- 📘 `docs/PUBLISHING_PROFILES_GUIDE.md` - Complete guide
|
|
- 📘 `docs/PUBLISH_PROFILES_SETUP_COMPLETE.md` - Setup summary
|
|
- 📘 `docs/MULTI_INSTANCE_COMPLETE.md` - Multi-instance overview
|
|
|
|
---
|
|
|
|
**Quick Help**: For detailed instructions, see `docs/PUBLISHING_PROFILES_GUIDE.md`
|