Multiple Plex Servers (Synology)

Running Multiple Plex Servers on a single Nas

Why bother, I can hear at least a few Ninjas shouting

Well, because I can… And while you can segregate a single server, there can only ever be one admin.
So maybe your kids want their own server, maybe you want to delegate some of the work maintaining libraries, as you can now with UNO pin content from different servers, so you could have Movies in one Plex and TV in another… but anyway I digress.

So how do you do it, well that’s where docker and macvlan’s come into play.

Docker macvlans allow you to create a virtual network interface that you can use for your docker images.

So I have Synology DS1815+ with 4 ethernet ports as a bonded network interface. and my local ip network is 10.0.0.x. My NAS does support Hardware transcoding, so if you have one that does, then sorry I can’t help with how to make this available to the Docker Instances. Sorry.

Points of note you can only create 1 macvlan with the same gateway address, so make sure your your network block has enough ip addresses for your requirements.

You can use an ip calculator for this.

First thing to do is create a macvlan…

ssh to your nas and run something like this and enter your password when requested

sudo docker network create -d macvlan –subnet=10.0.0.0/24 –ip-range=10.0.0.115/29 –gateway=10.0.0.1 -o parent=bond0 macvlan1

This should create a new maclan with a few usable ip addresses, in this case from 10.0.0.113 – 10.0.0.118

Create some directories on your nas somewhere for the Plex Docker Data, I suggest one for each install you want eg:

/volume1/plexDockers/plexDocker1
/volume1/plexDockers/plexDocker2
/volume1/plexDockers/plexDocker3

In each of these directories create a config folder and a transcode folder, as we will map the Docker containers to these folders. You will also need to decide which media folder(s) each Plex will have access to, but will come to that later.

Launch docker and Download the Plex Docker Image, I used the one that Plex themselves provide.

Now go to plex.tv/claim and sign in if need be (use the account you want this server to be associated with), you should then be provided with a claim token, copy this as you will need it.

So back to the shell (ssh)

type: id to get your user and group, something like this xx will be a number

uid=10**xx**(username) gid=100(users)

Then and run a command like this for each Plex server you want, edit as required

sudo docker run \
--name NameThatWillAppearInDockerGUI \
--network=nameofyourmacvlan \
--ip=oneofyourmacvlanipaddresses \
-e TZ="Europe/London" \
-e PLEX_CLAIM="claimtoken" \
-v /volume1/plexDockers/plexDocker1/config/:/config" \
-v /volume1/plexDockers/plexDocker1/transcode/:/transcode \
-v /volume1/mediafolder/:/data \
-e PLEX_UID="10xx" \
-e PLEX_GID="100" \
-h MyDocker1 plexinc/pms-docker

If you then look in your Docker GUI on the NAS you should see this NameThatWillAppearInDockerGUI as a container.

In your browser, go to
http://oneofyourmacvlanipaddresses:32400/web

And with any luck you should get to the Plex setup screen. So set up your server.

(I think the docker run command may still be running in the shell, so in the GUI Turn off your new container and then back on, as you can now use the GUI to start and stop the container.

Rinse and repeat for each Plex server you want to run.

You will probably need to create a task to create the macvlan when you start up your nas, or else your plex servers will not be available after a reboot.

and there you go… multiple plex servers on a single NAS… Enjoy.