selfhosted-apps-docker/jellyfin/readme.md

193 lines
4.6 KiB
Markdown
Raw Normal View History

2022-01-06 16:29:46 +00:00
# Jellyfin in docker
2021-12-31 00:35:58 +00:00
###### guide-by-example
2022-01-06 16:29:46 +00:00
![logo](https://i.imgur.com/gSyMEvD.png)
2021-12-31 00:35:58 +00:00
# Purpose & Overview
2022-01-06 23:28:43 +00:00
WORK IN PROGRESS<br>
WORK IN PROGRESS<br>
WORK IN PROGRESS<br>
2021-12-31 00:35:58 +00:00
2022-01-06 23:28:43 +00:00
Stream movies/tv-shows/music to a browser, or a [large selection of devices and services.](https://jellyfin.org/clients/)
2021-12-31 00:35:58 +00:00
2022-01-06 16:29:46 +00:00
* [Official site](https://jellyfin.org/)
* [Github](https://github.com/jellyfin/jellyfin)
* [DockerHub](https://hub.docker.com/r/jellyfin/jellyfin/)
2021-12-31 00:35:58 +00:00
2022-01-06 23:28:43 +00:00
Jellyfin if a free media system, an alternative to proprietary Plex.<br>
2022-01-06 16:29:46 +00:00
The core server side is written in C#, web client in Javascript,
and a number of other clients written in various languages and frameworks.
Starting point for me was [this viggy96 repo](https://github.com/viggy96/container_config)
2021-12-31 00:35:58 +00:00
# Files and directory structure
```
2022-01-06 16:29:46 +00:00
/mnt/
└── bigdisk/
├── tv/
├── movies/
└── music/
2021-12-31 00:35:58 +00:00
/home/
└── ~/
└── docker/
2022-01-06 16:29:46 +00:00
└── jellyfin/
├── jellyfin-cache/
├── jellyfin-config/
├── transcodes/
2021-12-31 00:35:58 +00:00
├── .env
├── docker-compose.yml
2022-01-06 16:29:46 +00:00
└── jellyfin-backup-script.sh
2021-12-31 00:35:58 +00:00
```
2022-01-06 16:29:46 +00:00
* `/mnt/bigdisk/...` - a mounted media storage share
* `jellyfin-cache/` - cache
* `jellyfin-config/` - configuration
* `transcodes/` - transcoded video storage
2021-12-31 00:35:58 +00:00
* `.env` - a file containing environment variables for docker compose
* `docker-compose.yml` - a docker compose file, telling docker how to run the containers
2022-01-06 16:29:46 +00:00
* `jellyfin-backup-script.sh` - a backup script if you want it
2021-12-31 00:35:58 +00:00
You only need to provide the files.</br>
The directories are created by docker compose on the first run.
# docker-compose
2022-01-09 16:06:59 +00:00
The media are mounted in read only mode.
2021-12-31 00:35:58 +00:00
`docker-compose.yml`
```yml
services:
2022-01-06 16:29:46 +00:00
jellyfin:
image: jellyfin/jellyfin:latest
container_name: jellyfin
hostname: jellyfin
2021-12-31 00:35:58 +00:00
restart: unless-stopped
env_file: .env
2022-01-06 16:29:46 +00:00
devices:
- /dev/dri
2021-12-31 00:35:58 +00:00
volumes:
2022-01-06 16:29:46 +00:00
- ./transcodes/:/transcodes
2022-01-09 13:56:51 +00:00
- ./jellyfin-config:/config
- ./jellyfin-cache:/cache
2022-01-06 16:29:46 +00:00
- /mnt/bigdisk/serialy:/media/video:ro
- /mnt/bigdisk/mp3/moje:/media/music:ro
expose:
- 8096
ports:
- 1900:1900/udp
2021-12-31 00:35:58 +00:00
networks:
default:
2022-01-06 16:29:46 +00:00
name: $DOCKER_MY_NETWORK
external: true
2021-12-31 00:35:58 +00:00
```
`.env`
```bash
# GENERAL
MY_DOMAIN=example.com
DOCKER_MY_NETWORK=caddy_net
TZ=Europe/Bratislava
```
**All containers must be on the same network**.</br>
Which is named in the `.env` file.</br>
If one does not exist yet: `docker network create caddy_net`
# Reverse proxy
2022-01-06 23:28:43 +00:00
Caddy is used, details
2021-12-31 00:35:58 +00:00
[here](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/caddy_v2).</br>
`Caddyfile`
```
2022-01-06 16:29:46 +00:00
jellyfin.{$MY_DOMAIN} {
reverse_proxy jellyfin:8096
2021-12-31 00:35:58 +00:00
}
```
# First run
2022-01-09 13:56:51 +00:00
![interface-pic](https://i.imgur.com/pZMi6bb.png)
2021-12-31 00:35:58 +00:00
2022-01-06 16:29:46 +00:00
# Specifics of my setup
* no long term use yet
* no gpu, so no experience with hw transcoding
* media files are stored and shared on trunas scale VM
2022-01-09 13:56:51 +00:00
and mounted directly on the docker host using [systemd mounts](https://forum.manjaro.org/t/root-tip-systemd-mount-unit-samples/1191),
2022-01-06 16:29:46 +00:00
instead of fstab or autofs.
`/etc/systemd/system/mnt-bigdisk.mount`
```ini
[Unit]
Description=12TB truenas mount
[Mount]
What=//10.0.19.19/Dataset-01
Where=/mnt/bigdisk
Type=cifs
Options=ro,username=ja,password=qq,file_mode=0700,dir_mode=0700,uid=1000
DirectoryMode=0700
[Install]
WantedBy=multi-user.target
```
2022-01-09 16:06:59 +00:00
`/etc/systemd/system/mnt-bigdisk.automount`
2022-01-06 16:29:46 +00:00
```ini
[Unit]
2022-01-09 14:00:05 +00:00
Description=12TB truenas mount
2022-01-06 16:29:46 +00:00
[Automount]
Where=/mnt/bigdisk
[Install]
WantedBy=multi-user.target
```
2022-01-09 13:56:51 +00:00
to automount on boot - `sudo systemctl start mnt-bigdisk.automount`
2022-01-06 16:29:46 +00:00
2022-02-21 23:02:30 +00:00
# Troubleshooting
![error-pic](https://i.imgur.com/KQhmZTQ.png)
*We're unable to connect to the selected server right now. Please ensure it is running and try again.*
2022-04-03 08:50:12 +00:00
If you encounter this, try opening the url in browsers private window.<br>
2022-02-21 23:02:30 +00:00
If it works then clear the cookies in your browser.
2022-01-06 16:29:46 +00:00
# Update
2021-12-31 00:35:58 +00:00
Manual image update:
- `docker-compose pull`</br>
- `docker-compose up -d`</br>
- `docker image prune`
# Backup and restore
#### Backup
Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup)
that makes daily snapshot of the entire directory.
#### Restore
* down the bookstack containers `docker-compose down`</br>
* delete the entire bookstack directory</br>
* from the backup copy back the bookstack directory</br>
* start the containers `docker-compose up -d`
# Backup of just user data
2022-01-09 13:56:51 +00:00
dont care