Update… I have it mostly working now with remote access.
There is still the issue of “tcp://127.0.0.1:32400 failed: Connection refused” if I’m trying to play from the internal web interface of the load balancer (http://10.31.13.10:3001/web/index.html#) and kick off a transcode play.
Local app looks like it’s doing a direct play. I have to try forcing transcode with the local app to see if it causes the error.
External app (testing Plex iOS) is transcoding the video correctly.
I’ll try to go over my settings for others to try.
My internal network only has 1 public IP address for outside.
Physical server that is running Plex Media Server and UnicornLoadBalancer (VM would work too)
Physical server that is running UnicornTranscoder (VM would work too)
Docker running LetsEncryptIt + NGNIX (you could do a server or a VM)
Router is a EdgeRouter Lite
DNS I have control over. I use duckdns.org for keeping my external IP available
Router has port forwarding setup to the NGNIX server.
External Port 80 to Internal Port 80 Ngnix Server (I turn this on and off to renew certificates… otherwise it’s not really needed)
External Port 443 to Internal Port 443 Ngnix Server
DNS:
I created a CNAME loadbalancerhostname that points to myhostname.duckdns.org
I created a CNAME unicorntranscoderhostname that points to myhostname.duckdns.org
I have my own domain. You could maybe create 2 duckdns.org entries that point to the same IP.
EX: loadbalancerhostname.duckdns.org and unicorntranscoderhostname.duckdns.org. and use those instead of the CNAME’s I created.
NGNIX:
I used their plex as a subdomain template. I created 2 conf files one for the LoadBalancer and one for the Transcoder.
LoadBalancer ngnix site conf update the following:
server_name loadbalancerhostname.*; (CNAME you setup)
proxy_pass http://10.31.13.10:3001; (Internal IP Address of the LoadBalancer)
UnicornTranscoder ngnix site conf update the following:
server_name unicorntranscoderhostname.*; (CNAME you setup)
proxy_pass http://10.31.13.11:3002; (Internal IP Address of the UnicornTranscoder)
Plex Media Server is ubuntu server 18.04. Installed ubuntu server updated everything and installed Plex Media Server from apt install plexmediaserver
This installs the public PMS. I have a plex pass and after loading the PMS and logging in via the web interface set it to beta and did a check update. You have to manually download this and install it with dpkg.
You can update Settings -> Network -> Custom server access URLs with https://loadbalancerhostname.domain.com:443
Wait to enable remote access until the LoadBalancer is setup.
Follow the UnicornTranscoder information to load the UnicornFFMPEG and UnicornLoadBalancer.
I used my regular user and created a UnicornTranscoder directory. In there I did the git clones for both the UnicornFFMPEG and UnicornLoadBalancer.
I did the UnicornFFMPEG first and renamed the original files and replaced them with the built UnicornFFMPEG binaries.
Second I did the UnicornLoadBalancer. I backed up /etc/environment to /etc/environment.orig
“sudo vim /etc/environment” add below path:
SERVER_HOST=“10.31.13.10”
SERVER_PORT=“3001”
SERVER_PUBLIC=“https://loadbalancerhostname.domain.com:443/”
PLEX_HOST=“10.31.13.10”
PLEX_PORT=“32400”
PLEX_PATH_USR="/usr/lib/plexmediaserver/"
PLEX_PATH_SESSIONS="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions"
DATABASE_MODE =“sqlite”
DATABASE_SQLITE_PATH ="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
CUSTOM_SCORES_TIMEOUT=“10”
CUSTOM_IMAGE_RESIZER=“false”
CUSTOM_DOWNLOAD_FORWARD=“true”
DEBUG=*
TRANSCODER_DEBUG=true
I changed CUSTOM_DOWNLOAD_FORWARD to true. I do lots of direct playing of files.
I didn’t edit the config.js file in the src directory. I used the environmental variables.
launch LoadBalancer “sudo npm start” (need sudo to get debug info on the screen)
UniconTranscoder server as my regular user I created a UnicornTranscoder directory and in that directory did the git clone.
I modified the following items in the config.js
port: env.int (‘SERVER_PORT’, 3002), (I changed the transcoder to run on port 3002 instead of 3000)
host: env.string(‘SERVER_LISTEN’, ‘10.31.13.11’), (this is the IP Address of the transcode server)
loadbalancer_address: env.string(‘LOADBALANCER_ADDRESS’, ‘https://loadbalancerhostname.domain.com:443’),
instance_address: env.string(‘INSTANCE_ADDRESS’, ‘https://unicorntranscoderhostname.domain.com:443’),
plex_build: env.string(‘PLEX_BUILD’, ‘1.15.6.1079-78232c603’), (build of my beta PMS)
codecs_build: env.string(‘CODECS_BUILD’, ‘392df4f-2233’), (latest codecs on my other PMS server)
eae_version: env.string(‘EAE_VERSION’, ‘eae-69c1de6-34’), (latest eae version on my other PMS server)
debug: env.boolish(‘TRANSCODER_DEBUG’, true),
maxSessions: env.int(‘MAX_SESSIONS’, 16), (my server has 16 threads)
maxDownloads: env.int(‘MAX_DOWNLOADS’, 16), (my server has 16 threads)
maxTranscodes: env.int(‘MAX_TRANSCODE’, 16), (my server has 16 threads)
then ran npm install
then ran npm run install. (this downloads the codecs)
then ran sudo npm start (need sudo to get debug on the screen)
I then setup ufw on the PMS/LB server.
sudo ufw default allow incoming
sudo ufw default allow outgoing
sudo ufw deny 32400/tcp
sudo ufw allow ssh
sudo ufw enable
sudo ufw status verbose
How internal network load a web browser and goto the IP Address of the LoadBalancer
EX: my internal LB is http://10.31.13.10:3001
Plex page should open. Now you should be able to goto settings -> remote access and enable remote access.
Then you need to use a device outside your network and load the external address of the plex server.
EX: https://loadbalancerhostname.domain.com:443
this will make you login to the server externally and usually resolves remote access not working. It’s a bit off compared to the normal port redirections. It will complain about double nat here and there but has been working so far. It will take a good 5-10 minutes to register with plex.tv.
Double test you can login to plex.tv and you should see your server available to select.
I think that is everything. Good luck. When I figure out the local transcoding issue I’ll update.
duhasst