hcloud-rffmpeg/README.md

48 lines
3.2 KiB
Markdown

# HCLOUD-RFFMPEG
## NOTICE!
**I've rewritten this [script in Go](https://github.com/aleksasiriski/rffmpeg-autoscaler) which is much easier to use and does more things automatically.**
## Kubernetes
Check [this](https://github.com/aleksasiriski/rffmpeg-worker) out!
## Setup
1) Set the required environment variables
2) Share the volume of rffmpeg config directory with Jellyfin
3) Make sure the `cloud-init` string works manually first
4) All of your workers need Jellyfin's `/config/transcodes` and `/config/data/subtitles` directories available and mounted at the same path as the Jellyfin host. Best solution is to use `NFSv4` with `sync` option.
5) Also, I'm assuming you're using Hetzner Storage Box so the defaults will work for you, but if you aren't using a network drive for media you will need to share that directory via NFS as well.
If you need a reference docker compose file use [this one](https://github.com/aleksasiriski/hcloud-rffmpeg/blob/main/docker-compose.example.yml).
## Recommended images
I made and tested these images to use with this script:
* [ghcr.io/aleksasiriski/jellyfin-rffmpeg](https://github.com/aleksasiriski/jellyfin-rffmpeg)
* [ghcr.io/aleksasiriski/rffmpeg-worker](https://github.com/aleksasiriski/rffmpeg-worker)
## Environment variables
| Name | Default value | Description |
| :----------: | :--------------: | :--------------- |
| STATE_DIR | /config | Path to rffmpeg config |
| LOG_FILE | STATE_DIR + /log/hcloud-rffmpeg.log | Path to log file |
| DB_PATH | STATE_DIR + /rffmpeg/rffmpeg.db | Path to SQLite database file used by rffmpeg script |
| SSH_KEY | STATE_DIR + /rffmpeg/.ssh/id_ed25519.pub | Path to rffmpeg public ssh key generated by rffmpeg on jellyfin host |
| JELLYFIN_LAN_ONLY_IP | Must be explicitly set! | The IP address of the jellyfin host / nfs share that workers use to access Jellyfin's transcodes and subtitles directories |
| HCLOUD_API_TOKEN | Must be explicitly set! | Hetzner Cloud API token |
| MEDIA_USERNAME | "" | Username for the media share |
| MEDIA_PASSWORD | "" | Password for the media share |
| SERVER_TYPE | cx21 | The type of server from Hetzner that should be used for workers |
| IMAGE_TYPE | docker-ce | The OS image used on workers, `docker-ce` is Ubuntu with Docker preinstalled |
| SSH_KEY_NAME | root@jellyfin | The name of the ssh key that will be saved on Hetzner and used for connecting to workers |
| NETWORK_NAME | rffmpeg-workers | The name of the network created for local communication between the workers and the Jellyfin host
| FIREWALL_NAME | rffmpeg-workers | The name of the firewall created for workers, recommended to block access to ssh over the internet
| PLACEMENT_GROUP_NAME | rffmpeg-workers | The name of the placement group created to spread the workers over the datacenter |
| LOCATION_NAME | nbg1 | The name of the location in which the workers should be created |
| CLOUD_CONFIG | [string](https://github.com/aleksasiriski/hcloud-rffmpeg/blob/main/hcloud-rffmpeg.py#L49) | The string that setups the workers after creation, the default uses my docker compose and inserts needed env variables |
| JOBS_PER_WORKER | 2 | Number of jobs allowed per worker, the default of 2 tells the script to only create a new worker if there are 2 or more jobs on the previous one. |