Skip to content

Commit

Permalink
Merge pull request #174 from pabloromeo/experimental
Browse files Browse the repository at this point in the history
Local Relay, config validation, custom image optimization, and new updated documentation
  • Loading branch information
pabloromeo authored Sep 17, 2022
2 parents 2e3778b + bbc9b25 commit fe55a7d
Show file tree
Hide file tree
Showing 32 changed files with 891 additions and 455 deletions.
358 changes: 44 additions & 314 deletions README.md

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Deployment Examples

* [Deploying on Kubernetes](kubernetes/)
* [Deploying on Docker Swarm](docker-swarm/)
* [Grafana Dashboard Example](grafana-dashboard/)


## Configuration Parameters

### Plex (PMS)

The image extends the [LinuxServer Plex](https://hub.docker.com/r/linuxserver/plex/) Image, see [here](https://hub.docker.com/r/linuxserver/plex/) for information on all its parameters.

| Parameter | Function |
| :----: | --- |
| `ORCHESTRATOR_URL` | The url where the orchestrator service can be reached (ex: http://plex-orchestrator:3500) |
| `PMS_SERVICE` or `PMS_IP` | Referencing Plex by Service name is allowed if `LOCAL_RELAY_ENABLED` is `"1"` (which is the default). If you are not using Local Relay then specify `PLEX_IP`, which also requires you to add the workers subnets to `"List of IP addresses and networks that are allowed without auth"` |
| `TRANSCODE_EAE_LOCALLY` | `"true"` or `"false"`. Force media which requires EasyAudioEncoder to transcode locally. Given that EAE is currently supported by the latest versions of ClusterPlex there's usually no reason to enable this. It will most likely be deprecated in the future. Default => `"false"`|
| `TRANSCODE_OPERATING_MODE` | `"local"` => only local transcoding (no workers)<br/>`"remote"` => only remote workers transcoding<br/>`"both"` (default) => Remote first, local if it fails |
| `TRANSCODER_VERBOSE` | `"0"` (default) => info level, `"1"` => debug logging |
| `FORCE_HTTPS` | `"0"` (Default) uses Plex's default http callback, `"1"` forces HTTPS to be used.<br>**IMPORTANT:** Turning this on is only required if you have BOTH disabled Local Relay and have `Secure Connetions` in Plex set to `Required`. |

### Orchestrator

| Parameter | Function |
| :----: | --- |
| `TZ` | Timezone |
| `LISTENING_PORT` | Port where orchestrator should run |
| `WORKER_SELECTION_STRATEGY` | How the worker is chosen when a transcoding job is initiated:<br/> `"LOAD_CPU"` => lowest CPU usage<br/>`"LOAD_TASKS"` => least amount of current tasks<br/>`"RR"` => round-robin<br/>`"LOAD_RANK"` (default) => CPU benchmark * free_cpu |

#### Orchestrator metrics

The Orchestrator exposes usage metrics at */metrics*, in Prometheus format.

Using these metrics you can create Dashboards in something like Grafana, such as:

![grafana-metrics](images/grafana-metrics.png)

Dashboard JSON file:
[grafana-dashboard/grafana-dashboard.json](grafana-dashboard/grafana-dashboard.json)

### Workers

The image extends the [LinuxServer Plex](https://hub.docker.com/r/linuxserver/plex/) Image, see [here](https://hub.docker.com/r/linuxserver/plex/) for information on all its parameters.

| Parameter | Function |
| :----: | --- |
| `FFMPEG_HWACCEL` | Allows a [hwaccel decoder](https://trac.ffmpeg.org/wiki/HWAccelIntro) to be passed to ffmpeg such as `nvdec` or `dvxa2` |
| `EAE_SUPPORT` | `"1"` for ON, `"0"` for OFF, controls usage of EasyAudioEncoder (Default = `"1"`) |
| `LISTENING_PORT` | Port where workers expose the internal healthcheck |
| `STAT_CPU_INTERVAL` | Frequency at which the worker sends stats to the orchestrator (in ms). Default 2000 |
| `ORCHESTRATOR_URL` | The url where the orchestrator service can be reached (ex: http://plex-orchestrator:3500) |
| `TRANSCODER_PATH` | Default = `'/usr/lib/plexmediaserver/'` |
| `TRANSCODER_NAME` | Default = `'Plex Transcoder'` |
8 changes: 8 additions & 0 deletions docs/docker-swarm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
![docker-swarm](../images/docker-swarm-logo-small.png)


## Examples for Docker Swarm

Here you can find examples for deploying using both approaches:
* [Using Dockermods](with-dockermods.yaml)
* [Using ClusterPlex images](with-custom-images.yaml)
90 changes: 90 additions & 0 deletions docs/docker-swarm/with-custom-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
version: '3.8'

services:
plex:
image: ghcr.io/pabloromeo/clusterplex_pms:latest
deploy:
mode: replicated
replicas: 1
environment:
VERSION: docker
PUID: 1000
PGID: 1000
TZ: Europe/London
ORCHESTRATOR_URL: http://plex-orchestrator:3500
PMS_SERVICE: plex # This service. If you disable Local Relay then you must use PMS_IP instead
PMS_PORT: "32400"
TRANSCODE_OPERATING_MODE: both #(local|remote|both)
TRANSCODER_VERBOSE: "1" # 1=verbose, 0=silent
LOCAL_RELAY_ENABLED: "1"
LOCAL_RELAY_PORT: "32499"
healthcheck:
test: curl -fsS http://localhost:32400/identity > /dev/null || exit 1
interval: 15s
timeout: 15s
retries: 5
start_period: 30s
volumes:
- /path/to/config:/config
- /path/to/tv:/data/tv
- /path/to/movies:/data/movies
- /path/to/transcode:/transcode
ports:
- 32499:32499 # LOCAL_RELAY_PORT
- 32400:32400
- 3005:3005
- 8324:8324
- 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp

plex-orchestrator:
image: ghcr.io/pabloromeo/clusterplex_orchestrator:latest
deploy:
mode: replicated
replicas: 1
update_config:
order: start-first
healthcheck:
test: curl -fsS http://localhost:3500/health > /dev/null || exit 1
interval: 15s
timeout: 15s
retries: 5
start_period: 30s
environment:
TZ: Europe/London
LISTENING_PORT: 3500
WORKER_SELECTION_STRATEGY: "LOAD_RANK" # RR | LOAD_CPU | LOAD_TASKS | LOAD_RANK (default)
volumes:
- /etc/localtime:/etc/localtime:ro
ports:
- 3500:3500

plex-worker:
image: ghcr.io/pabloromeo/clusterplex_worker:latest
hostname: "plex-worker-{{.Node.Hostname}}"
deploy:
mode: replicated
replicas: 2
environment:
VERSION: docker
PUID: 1000
PGID: 1000
TZ: Europe/London
LISTENING_PORT: 3501 # used by the healthcheck
STAT_CPU_INTERVAL: 2000 # interval for reporting worker load metrics
ORCHESTRATOR_URL: http://plex-orchestrator:3500
EAE_SUPPORT: "1"
healthcheck:
test: curl -fsS http://localhost:3501/health > /dev/null || exit 1
interval: 15s
timeout: 15s
retries: 5
start_period: 240s
volumes:
- /path/to/codecs:/codecs # (optional)
- /path/to/tv:/data/tv
- /path/to/movies:/data/movies
- /path/to/transcode:/transcode
92 changes: 92 additions & 0 deletions docs/docker-swarm/with-dockermods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
version: '3.8'

services:
plex:
image: ghcr.io/linuxserver/plex:latest
deploy:
mode: replicated
replicas: 1
environment:
DOCKER_MODS: "ghcr.io/pabloromeo/clusterplex_dockermod:latest"
VERSION: docker
PUID: 1000
PGID: 1000
TZ: Europe/London
ORCHESTRATOR_URL: http://plex-orchestrator:3500
PMS_SERVICE: plex # This service. If you disable Local Relay then you must use PMS_IP instead
PMS_PORT: "32400"
TRANSCODE_OPERATING_MODE: both #(local|remote|both)
TRANSCODER_VERBOSE: "1" # 1=verbose, 0=silent
LOCAL_RELAY_ENABLED: "1"
LOCAL_RELAY_PORT: "32499"
healthcheck:
test: curl -fsS http://localhost:32400/identity > /dev/null || exit 1
interval: 15s
timeout: 15s
retries: 5
start_period: 30s
volumes:
- /path/to/config:/config
- /path/to/tv:/data/tv
- /path/to/movies:/data/movies
- /path/to/transcode:/transcode
ports:
- 32499:32499 # LOCAL_RELAY_PORT
- 32400:32400
- 3005:3005
- 8324:8324
- 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp

plex-orchestrator:
image: ghcr.io/pabloromeo/clusterplex_orchestrator:latest
deploy:
mode: replicated
replicas: 1
update_config:
order: start-first
healthcheck:
test: curl -fsS http://localhost:3500/health > /dev/null || exit 1
interval: 15s
timeout: 15s
retries: 5
start_period: 30s
environment:
TZ: Europe/London
LISTENING_PORT: 3500
WORKER_SELECTION_STRATEGY: "LOAD_RANK" # RR | LOAD_CPU | LOAD_TASKS | LOAD_RANK (default)
volumes:
- /etc/localtime:/etc/localtime:ro
ports:
- 3500:3500

plex-worker:
image: ghcr.io/linuxserver/plex:latest
hostname: "plex-worker-{{.Node.Hostname}}"
deploy:
mode: replicated
replicas: 2
environment:
DOCKER_MODS: "ghcr.io/pabloromeo/clusterplex_worker_dockermod:latest"
VERSION: docker
PUID: 1000
PGID: 1000
TZ: Europe/London
LISTENING_PORT: 3501 # used by the healthcheck
STAT_CPU_INTERVAL: 2000 # interval for reporting worker load metrics
ORCHESTRATOR_URL: http://plex-orchestrator:3500
EAE_SUPPORT: "1"
healthcheck:
test: curl -fsS http://localhost:3501/health > /dev/null || exit 1
interval: 15s
timeout: 15s
retries: 5
start_period: 240s
volumes:
- /path/to/codecs:/codecs # (optional)
- /path/to/tv:/data/tv
- /path/to/movies:/data/movies
- /path/to/transcode:/transcode
Loading

0 comments on commit fe55a7d

Please sign in to comment.