pabloromeo / clusterplex

ClusterPlex is an extended version of Plex, which supports distributed Workers across a cluster to handle transcoding requests.
MIT License
473 stars 36 forks source link

help configuring server and workers #205

Closed pitzonept closed 1 year ago

pitzonept commented 1 year ago

Hello, I would like to know if with the solution presented here it is possible to create a plex cluster where the main machine will have the plex server and orchestrator and in the workers for transcode use hardware (quick sync or nvidia cards) I have tried several ways and I am not getting it to work properly. And also if the main machine needs to have physical hardware equal to what will be used in the workers.

ex: if I use nvidia in the workers do I have to have an nvidia card in the main one? And for Quick Sync too? I am using ubuntu 20.04 and docker swarm. My comand is : docker stack deploy --compose-file docker-compose.yaml plex But i cant add devices to use hardware.

Thanks

pabloromeo commented 1 year ago

Hi! Yeah, you should be able to use hardware transcoding on workers. I believe many users are currently doing that. Plex does require PlexPass for you to be able to enable hardware transcoding. Workers have a configurable environment variable called FFMPEG_HWACCEL which lets you override what the initial Plex command instructed in regards to ffmpeg arguments (so that the worker can use different acceleration than the main plex server). You can find more info about it here: https://github.com/pabloromeo/clusterplex/tree/master/docs

Now, in order to have access to quicksync or nvidia GPUs, you have to adapt the compose file to include the devices, mounts and whatever is required per your specific hardware. Given that here we are using LinuxServer plex images, you can head to their documentation on how to set it up and configure. The same configuration they show for the main server is what you'd need to apply to the workers: https://github.com/linuxserver/docker-plex#hardware-acceleration

I hope that helps! Let me know how it goes

pitzonept commented 1 year ago

hello. Thanks for the answer, but there is something I am not understanding or interpreting correctly.

i am using PlexPass

tests how I tried:

test1 :

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://192.168.1.10:3500 PMS_SERVICE: 192.168.1.10 # This service. If you disable Local Relay then you must use PMS_IP instead PMS_PORT: "32400" TRANSCODE_OPERATING_MODE: remote #(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:

Running : docker-compose up

Running : docker stack deploy --compose-file docker-compose.yaml plexserver


test2:

i run two docker-compose one on server and other on worker

on Server:

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://192.168.1.10:3500 PMS_SERVICE: 192.168.1.10 # This service. If you disable Local Relay then you must use PMS_IP instead PMS_PORT: "32400" TRANSCODE_OPERATING_MODE: remote #(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:

on Worker:

version: '3.8'

services: plex-worker: image: ghcr.io/linuxserver/plex:latest hostname: "plex-worker-{{.Node.hostname}}" deploy: mode: replicated replicas: 1 environment: DOCKER_MODS: "ghcr.io/pabloromeo/clusterplex_worker_dockermod:latest" FFMPEG_HWACCEL: "vaapi" 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://192.168.1.10: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:

Running : docker-compose up ( in both machines )

pabloromeo commented 1 year ago

/dev/dri should only be needed on your workers, not on the server (when you don't have quicksync on it).

Is that how you solved it?

pabloromeo commented 1 year ago

Also, since you are using swarm you shouldn't need to be running separate compose files. Just use one, but then configure constrains on the service so that it only runs on the node you configure (either by hostname, labels you configure, etc). Meaning, you can label the nodes that support quicksync with your custom label and you'd specify it as a service constraint and workers will only be scheduled on nodes with that label.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.