Media Server, Pt 6 - Jellyfin
Probably should have pushed this earlier - Jellyfin is the actual core of the media server part of this. It's the server that users actually connect to in order to watch movies or TV shows; it has some limited capability to serve e-books and music as well, so if people want to use it that way, that's possible.
At this point, the steps to set the container itself up are likely to be well-known. Create the directories for persistent storage of data:
$ mkdir -p /srv/data/docker/jellyfin/{cache,config}
$ sudo chown -Rv 10012:10002 /srv/data/docker
$ sudo chmod g-rwx,o-rwx /srv/data/docker
The snippet to add to your compose file is:
jellyfin:
deploy:
labels:
traefik.enable: "true"
traefik.http.routers.jellyfin-rtr.entrypoints: "websecure"
traefik.http.routers.jellyfin-rtr.rule: "Host(`jellyfin.your.domain`)"
traefik.http.routers.jellyfin-rtr.service: "jellyfin"
traefik.http.services.jellyfin.loadbalancer.server.port: "8096"
replicas: 1
devices:
- "/dev/dri:/dev/dri"
environment:
DOCKER_MODS: "linuxserver/mods:jellyfin-opencl-intel"
PUID: 10012
PGID: 10002
UMASK: 0002
TZ: "Etc/UTC"
JELLYFIN_PublishedServerUrl: "https://jellyfin.your.domain"
hostname: "jellyfin"
image: "linuxserver/jellyfin:latest"
logging:
driver: journald
networks:
- homelab
restart: on-failure
volumes:
- "/srv/data/docker/jellyfin/cache:/cache"
- "/srv/data/docker/jellyfin/config:/config"
- "/srv/data/shared/media:/media"
We're mapping the DRI device into the container for hardware acceleration support. This should work for Intel and AMD GPUs - changes will need to be made to get acceleration on NVidia working. This should be documented in Jellyfin's online documentation. Start the container.
$ docker stack deploy -c <compose file> --prune homelab
Now, visit your new Jellyfin server and set up an admin user. We'll integrate it with Authentik later, when we get around to enabling Authentik to manage its own outpost containers - for now, just use local users. For now, head to the Administration dashboard, select General, and change the cache path to "/cache".
Go to Users, set up whatever users you need, and to Libraries to set up your libraries. If you've been following this blog, you'll have four - books, music, movies and TV, all mounted in /media. For Music, take care to uncheck "Enable LUFS Scan" - while we do want that, we don't want Jellyfin to do it as part of a regular library scan.
On Playback > Transcoding, enable hardware acceleration as appropriate for your hardware. The online documentation linked above should help. On my personal media server, at the time of this writing running Jellyfin 10.9.6, I enable everything except for AV1 encoding. (11th generation Core i5)
Under Networking, if you've followed this guide, configure local addresses to be 10.32.0.0/16, and set the published server URL to "https://jellyfin.your.domain".
Go back to the Dashboard and hit "restart" to make all the changes fully live.
The compose file snippet is, as usual, available on Gitea. There are a few files in the repo I haven't discussed yet - as I alluded to earlier, I decided to run the Jellyfin segment a little early.