feat(servers): use caddy instead of nginx proxy for jellyfin
All checks were successful
Discord / discord commits (push) Successful in 37s

This commit is contained in:
matt1432 2024-05-22 14:30:34 -04:00
parent e502c23c02
commit 5fb5e08ebd
3 changed files with 94 additions and 183 deletions

View file

@ -48,7 +48,18 @@ in {
vault.reverseProxy = "${nosIP}:8781";
hauk.reverseProxy = "${nosIP}:3003";
headscale.reverseProxy = "${clusterIP}:8085";
jelly.reverseProxy = "${nosIP}:8097";
jellyfin = {
subDomainName = "jelly";
reverseProxy = "${nosIP}:8096";
subDirectories = {
jfa-go = {
subDirName = "accounts";
reverseProxy = "${nosIP}:8056";
};
};
};
pcsd = {
extraConfig = ''

View file

@ -27,101 +27,94 @@ in {
++ optionalGroup "render"
++ optionalGroup "video";
services = {
jellyfin = {
enable = true;
services.jellyfin = {
enable = true;
settings = {
system = {
serverName = "Jelly";
quickConnectAvailable = false;
isStartupWizardCompleted = true;
settings = {
system = {
serverName = "Jelly";
quickConnectAvailable = false;
isStartupWizardCompleted = true;
enableGroupingIntoCollections = true;
enableExternalContentInSuggestions = false;
enableGroupingIntoCollections = true;
enableExternalContentInSuggestions = false;
pluginRepositories = [
{
name = "Jellyfin Stable";
url = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json";
}
{
name = "Intro Skipper";
url = "https://raw.githubusercontent.com/jumoog/intro-skipper/master/manifest.json";
}
];
pluginRepositories = [
{
name = "Jellyfin Stable";
url = "https://repo.jellyfin.org/releases/plugin/manifest-stable.json";
}
{
name = "Intro Skipper";
url = "https://raw.githubusercontent.com/jumoog/intro-skipper/master/manifest.json";
}
];
enableSlowResponseWarning = false;
};
branding = let
jellyTheme = pkgs.stdenv.mkDerivation {
name = "Ultrachromic";
src = jellyfin-ultrachromic-src;
postInstall = "cp -ar $src $out";
};
importFile = file: fileContents "${jellyTheme}/${file}";
in {
customCss = ''
/* Base theme */
${importFile "base.css"}
${importFile "accentlist.css"}
${importFile "fixes.css"}
${importFile "type/dark_withaccent.css"}
${importFile "rounding.css"}
${importFile "progress/floating.css"}
${importFile "titlepage/title_banner-logo.css"}
${importFile "header/header_transparent.css"}
${importFile "login/login_frame.css"}
${importFile "fields/fields_border.css"}
${importFile "cornerindicator/indicator_floating.css"}
/* Style backdrop */
.backdropImage {filter: blur(18px) saturate(120%) contrast(120%) brightness(40%);}
/* Custom Settings */
:root {--accent: 145,75,245;}
:root {--rounding: 12px;}
/* https://github.com/CTalvio/Ultrachromic/issues/79 */
.skinHeader {
color: rgba(var(--accent), 0.8);;
}
.countIndicator,
.fullSyncIndicator,
.mediaSourceIndicator,
.playedIndicator {
background-color: rgba(var(--accent), 0.8);
}
'';
};
encoding = {
hardwareAccelerationType = "nvenc";
hardwareDecodingCodecs = [
"h264"
"hevc"
"mpeg2video"
"mpeg4"
"vc1"
"vp8"
"vp9"
"av1"
];
allowHevcEncoding = false;
enableThrottling = false;
enableTonemapping = true;
downMixAudioBoost = 1;
};
enableSlowResponseWarning = false;
};
};
nginx = {
enable = true;
config = fileContents ./nginx.conf;
branding = let
jellyTheme = pkgs.stdenv.mkDerivation {
name = "Ultrachromic";
src = jellyfin-ultrachromic-src;
postInstall = "cp -ar $src $out";
};
importFile = file: fileContents "${jellyTheme}/${file}";
in {
customCss = ''
/* Base theme */
${importFile "base.css"}
${importFile "accentlist.css"}
${importFile "fixes.css"}
${importFile "type/dark_withaccent.css"}
${importFile "rounding.css"}
${importFile "progress/floating.css"}
${importFile "titlepage/title_banner-logo.css"}
${importFile "header/header_transparent.css"}
${importFile "login/login_frame.css"}
${importFile "fields/fields_border.css"}
${importFile "cornerindicator/indicator_floating.css"}
/* Style backdrop */
.backdropImage {filter: blur(18px) saturate(120%) contrast(120%) brightness(40%);}
/* Custom Settings */
:root {--accent: 145,75,245;}
:root {--rounding: 12px;}
/* https://github.com/CTalvio/Ultrachromic/issues/79 */
.skinHeader {
color: rgba(var(--accent), 0.8);;
}
.countIndicator,
.fullSyncIndicator,
.mediaSourceIndicator,
.playedIndicator {
background-color: rgba(var(--accent), 0.8);
}
'';
};
encoding = {
hardwareAccelerationType = "nvenc";
hardwareDecodingCodecs = [
"h264"
"hevc"
"mpeg2video"
"mpeg4"
"vc1"
"vp8"
"vp9"
"av1"
];
allowHevcEncoding = false;
enableThrottling = false;
enableTonemapping = true;
downMixAudioBoost = 1;
};
};
};
}

View file

@ -1,93 +0,0 @@
events {
worker_connections 1024;
}
http {
# Must be in HTTP block
# Set in-memory cache-metadata size in keys_zone, size of video caching and how many days a cached object should persist
proxy_cache_path /var/cache/nginx/jellyfin-videos levels=1:2 keys_zone=jellyfin-videos:100m inactive=90d max_size=35000m;
map $request_uri $h264Level {
~(h264-level=)(.+?)& $2;
}
map $request_uri $h264Profile {
~(h264-profile=)(.+?)& $2;
}
server {
listen 8097;
listen [::]:8097;
server_name jelly.nelim.org;
## The default `client_max_body_size` is 1M, this might not be enough for some posters, etc.
client_max_body_size 20M;
location = / {
return 302 https://$host/web/;
}
location / {
# Proxy main Jellyfin traffic
proxy_pass http://localhost:8096;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
# Disable buffering when the nginx proxy gets very resource heavy upon streaming
proxy_buffering off;
}
# location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/
location = /web/ {
# Proxy main Jellyfin traffic
proxy_pass http://localhost:8096/web/index.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
location /socket {
# Proxy Jellyfin Websockets traffic
proxy_pass http://localhost:8096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
location /accounts {
# No longer necessary on versions after v0.3.0
# rewrite ^/accounts/(.*) /$1 break;
# Remove the CSP header set for Jellyfin
proxy_hide_header Content-Security-Policy;
add_header Content-Security-Policy "";
proxy_pass http://localhost:8056/accounts; # Change as you need
# For versions <= v0.3.0
#proxy_pass http://localhost:8056; # Change as you need
http2_push_preload on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_buffering off;
}
}
}