Platform config templates & Postgres migration recovery

- Added Linux/Windows startup config templates and README
- Updated default paths to FHS-compliant locations
- Improved publish profiles for platform targeting
- Enhanced Postgres migration: auto-recover on 42P07 errors
- Added RecordMigrationAsAppliedAsync for manual migration history
- Improved migration logging and error handling
- Added detailed documentation for config and migration fixes
This commit is contained in:
2026-02-26 13:44:03 -05:00
parent 24ae417a39
commit 5bdb7d53c3
11 changed files with 947 additions and 10 deletions
+2
View File
@@ -45,6 +45,8 @@
</ItemGroup>
<ItemGroup>
<Content Remove="Resources\Configuration\startup.default.json" />
<Content Remove="Resources\Configuration\startup.linux.json" />
<Content Remove="Resources\Configuration\startup.windows.json" />
</ItemGroup>
<ItemGroup>
@@ -8,12 +8,12 @@
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>E:\Program Files\Jellyfin-linux</PublishUrl>
<PublishUrl>E:\Program Files\Jellyfin-win</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net11.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ProjectGuid>07e39f42-a2c6-4b32-af8c-725f957a73ff</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
@@ -2,8 +2,8 @@
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<_PublishTargetUrl>E:\Program Files\Jellyfin-linux</_PublishTargetUrl>
<History>True|2026-02-26T14:50:00.8144584Z||;</History>
<_PublishTargetUrl>E:\Program Files\Jellyfin-win</_PublishTargetUrl>
<History>True|2026-02-26T18:27:30.4752489Z||;True|2026-02-26T09:50:00.8144584-05:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
@@ -0,0 +1,133 @@
# Jellyfin Startup Configuration
This directory contains startup configuration templates for Jellyfin Server.
## Configuration Files
- **`startup.default.json`** - Default configuration (Linux paths)
- **`startup.linux.json`** - Linux-specific configuration template
- **`startup.windows.json`** - Windows-specific configuration template
## Usage
### Linux Systems
The default configuration uses Linux paths (`/var/lib/jellyfin`). To customize:
1. Copy `startup.linux.json` to `startup.json` in your Jellyfin installation directory
2. Edit the paths as needed
3. Restart Jellyfin
```bash
cp startup.linux.json /path/to/jellyfin/startup.json
```
### Windows Systems
For Windows, use the Windows-specific configuration:
1. Copy `startup.windows.json` to `startup.json` in your Jellyfin installation directory
2. Edit the paths as needed (default: `C:/ProgramData/jellyfin`)
3. Restart Jellyfin
```powershell
Copy-Item startup.windows.json C:\Path\To\Jellyfin\startup.json
```
## Configuration Priority
Jellyfin resolves paths in this order (highest priority first):
1. **Command-line arguments** (`-d`, `-c`, `-l`, etc.)
2. **Environment variables** (`JELLYFIN_DATA_DIR`, `JELLYFIN_CONFIG_DIR`, etc.)
3. **`startup.json`** file (user's custom configuration)
4. **Built-in defaults** (OS-specific)
## Path Descriptions
| Path | Purpose |
|------|---------|
| `DataDir` | Database files, metadata, and media library information |
| `ConfigDir` | User settings, configuration files, and user-specific data |
| `CacheDir` | Cached images, thumbnails, and temporary processing files |
| `LogDir` | Application log files |
| `TempDir` | Temporary files during transcoding and processing |
| `WebDir` | Web UI assets (jellyfin-web) |
## Platform-Specific Defaults
### Linux (Default)
All paths use `/var/lib/jellyfin` for system-wide installation.
For user-specific installations, consider using:
- Data: `~/.local/share/jellyfin`
- Config: `~/.config/jellyfin`
- Cache: `~/.cache/jellyfin`
### Windows
All paths use `C:/ProgramData/jellyfin` for system-wide installation.
For user-specific installations, paths will default to:
- `%LOCALAPPDATA%\jellyfin`
### macOS
Jellyfin will automatically use appropriate macOS directories:
- Data: `~/Library/Application Support/jellyfin`
- Config: `~/Library/Application Support/jellyfin/config`
- Cache: `~/Library/Caches/jellyfin`
## Example: Custom Configuration
Create `startup.json`:
```json
{
"Paths": {
"DataDir": "/mnt/storage/jellyfin/data",
"ConfigDir": "/etc/jellyfin",
"CacheDir": "/var/cache/jellyfin",
"LogDir": "/var/log/jellyfin",
"TempDir": "/tmp/jellyfin",
"WebDir": "/usr/share/jellyfin/web"
}
}
```
## Environment Variables
You can also set paths via environment variables:
```bash
export JELLYFIN_DATA_DIR=/mnt/storage/jellyfin
export JELLYFIN_CONFIG_DIR=/etc/jellyfin
export JELLYFIN_CACHE_DIR=/var/cache/jellyfin
export JELLYFIN_LOG_DIR=/var/log/jellyfin
export JELLYFIN_TEMP_DIR=/tmp/jellyfin
export JELLYFIN_WEB_DIR=/usr/share/jellyfin/web
```
## Troubleshooting
### Permissions
Ensure the Jellyfin user has read/write permissions to all configured paths:
```bash
# Linux
sudo chown -R jellyfin:jellyfin /var/lib/jellyfin
sudo chmod -R 755 /var/lib/jellyfin
```
```powershell
# Windows - Run as Administrator
icacls "C:\ProgramData\jellyfin" /grant "NETWORK SERVICE:(OI)(CI)F" /T
```
### Verify Current Configuration
Check the Jellyfin logs on startup to see which paths are being used. The first few log entries will show the resolved paths.
## More Information
- [Jellyfin Documentation](https://jellyfin.org/docs/)
- [Installation Guide](https://jellyfin.org/docs/general/installation/)
@@ -1,10 +1,14 @@
{
"$schema": "https://json.schemastore.org/jellyfin-startup",
"// Comment": "Startup configuration defaults for Jellyfin Server",
"// Note": "For Linux: Use /var/lib/jellyfin, For Windows: Use C:/ProgramData/jellyfin",
"// Documentation": "These values are used when no command-line args or environment variables are set",
"Paths": {
"DataDir": null,
"ConfigDir": null,
"CacheDir": null,
"LogDir": null,
"TempDir": null,
"WebDir": null
"DataDir": "/var/lib/jellyfin",
"ConfigDir": "/var/lib/jellyfin",
"CacheDir": "/var/lib/jellyfin",
"LogDir": "/var/lib/jellyfin",
"TempDir": "/var/lib/jellyfin",
"WebDir": "/var/lib/jellyfin"
}
}
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/jellyfin-startup",
"// Comment": "Linux-specific startup configuration for Jellyfin Server",
"// Instructions": "Copy this file to 'startup.json' in the Jellyfin directory",
"// Documentation": "These paths follow Linux FHS (Filesystem Hierarchy Standard)",
"Paths": {
"DataDir": "/var/lib/jellyfin",
"ConfigDir": "/var/lib/jellyfin",
"CacheDir": "/var/lib/jellyfin",
"LogDir": "/var/lib/jellyfin",
"TempDir": "/var/lib/jellyfin",
"WebDir": "/var/lib/jellyfin"
}
}
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/jellyfin-startup",
"// Comment": "Windows-specific startup configuration for Jellyfin Server",
"// Instructions": "Copy this file to 'startup.json' in the Jellyfin directory",
"// Documentation": "These paths are optimized for Windows installations",
"Paths": {
"DataDir": "C:/ProgramData/jellyfin",
"ConfigDir": "C:/ProgramData/jellyfin",
"CacheDir": "C:/ProgramData/jellyfin",
"LogDir": "C:/ProgramData/jellyfin",
"TempDir": "C:/ProgramData/jellyfin",
"WebDir": "C:/ProgramData/jellyfin"
}
}
+40
View File
@@ -0,0 +1,40 @@
{
"_comment": "Jellyfin Startup Configuration - Configure path locations for Jellyfin data, logs, cache, and more.",
"_documentation": "See FILE_BASED_STARTUP_CONFIG.md for complete documentation",
"_priority": "Command-line options \u003E Environment variables \u003E This file \u003E Defaults",
"Paths": {
"DataDir": null,
"ConfigDir": null,
"CacheDir": null,
"LogDir": null,
"TempDir": null,
"WebDir": null
},
"Examples": {
"_comment": "Example configurations below - remove this Examples section when customizing",
"Linux": {
"DataDir": "/var/lib/jellyfin",
"ConfigDir": "/etc/jellyfin",
"CacheDir": "/var/cache/jellyfin",
"LogDir": "/var/log/jellyfin",
"TempDir": "/var/tmp/jellyfin",
"WebDir": "/usr/share/jellyfin/web"
},
"Windows": {
"DataDir": "C:\\ProgramData\\Jellyfin\\data",
"ConfigDir": "C:\\ProgramData\\Jellyfin\\config",
"CacheDir": "D:\\Cache\\Jellyfin",
"LogDir": "C:\\ProgramData\\Jellyfin\\logs",
"TempDir": "D:\\Temp\\Jellyfin",
"WebDir": "C:\\Program Files\\Jellyfin\\web"
},
"Portable": {
"DataDir": "./data",
"ConfigDir": "./config",
"CacheDir": "./cache",
"LogDir": "./logs",
"TempDir": "./temp",
"WebDir": "./web"
}
}
}