Skip to content

Created a full Wiki for Installing Unicorn #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kennyparsons
Copy link

In this pull request, I created a wiki. Currently, the instruction set for the "UnicornSuite" is dispersed throughout the three repositories. This wiki brings them all under 1 cohesive guide for new/intermediate users. I also covered a few "gotcha" details that are discussed in a few of the closed issues, but not in the readme.

Changes:

Added wiki.md
Edited README.md to link to the wiki
Added an images folder with a screenshot

@Maxou44
Copy link
Member

Maxou44 commented Aug 11, 2020

Can you review it @drouarb ?

Copy link
Member

@drouarb drouarb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Maxou44 double check ?

#### Assumptions
1. You have working linux Plex Server or can set up one quickly with no further instruction. In this guide, we'll be covering PMS deployed in a container.
2. You have a working reverse proxy with SSL. In this guide, we'll be using nginx.
3. All nodes (UnicornTranscoders) have access to the source media files. This can be accomplish several different ways. Most people will use NFS, SMB, iSCSI, or some other network filesystem protocol tool (such as rclone).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not mandatory, you can configure your setup so the UnicornLoadBalancer serves the files to the nodes. with CUSTOM_DOWNLOAD_FORWARD. But beware of bandwidth bottleneck

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drouarb Does that option mean the loadbalencer will serve the raw media files to the node, the node transcodes, and then the node serves the stream?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs:

CUSTOM_DOWNLOAD_FORWARD: Enable or disable 302 for download links and direct play, if enabled, transcoders need to have access to media files. Consider changing to true for your needs.

This implies that this option only deals with downloads and direct play (i.e. a direct play where the unicorn software is not normally used will now use the transcoder node to serve the stream). If that's not correct, the docs could use a refresher.

Copy link
Member

@drouarb drouarb Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my memory is good, this option does that, or maybe there is an other one that does it. @Maxou44 can you confirm ?

Copy link
Member

@Maxou44 Maxou44 Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter changes how transcoders access to the media file (for download, direct play, media optimizer and transcoded streams).

If enabled, transcoders access to files on the same mount point, they will read files from theirs own filesystem. FFmpeg will get a local file path.

If disabled (by default) each media access (transcode, optimization...) will call the load balancer to get the file. FFmpeg will get a HTTP link to stream the file using your load balancer.

We recommend to set it to false if your media files are stored on your load balancer server, if you mounted your media files from another service using FUSE or a dedicated storage server, we recommend to set it to true and mount it on each trasncoders (you will save load balancer bandwidth)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the docs to should be amended with @Maxou44 's comments. That is much clearer that what the docs state.

Required Software:
* NPM/Nodejs
* git
You can run Unicorn with Redis, but for a small plex setup with a handful of user/shared accounts, using the built-in sqlite.db will suffice.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redis is for session storage, by default the UnicornLoadBalancer store the sessions in internal memory but this will clear session store if you restart the app.
SQLite is for accessing Plex database.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification.

10. Disable outside access to the plex port
* All requests to the Plex Media Server should pass through the UnicornLoadBalancer.
* If a user reaches the server directly, the user will not be able to start a stream, since the FFMPEG transcoder built-in to Plex will eventually be replaced by Unicorn's Transcoder.
* To ensure users always hit the loadbalancer, configure IPTables to drop traffic destined to 32400 from outside your plex machine (drop traffic coming in through the physical nic). You'll need to install iptables-persistent, a package that persists ip tables across reboots, and then set your iptables rule. You must specify your interface, or else 32400 will be dropped completely, even for localhost access, and the loadbalancer will not work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be easier with UFW ?

```
where `/usr/lib/plexmediaserver` is the binary location. Most mainstream plex containers use this path, such as the container released by LinuxServier.io.

With that new volume/file mount, restart plex to replace the built-in transcoder with the "fake" transcoder that interprets the transcode arguments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to restart, Plex Transcoder is called when you start a stream, if you replace the file, on next stream it would use UnicornFFMPEG instead of Plex Transcoder

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drouarb We need to restart the container to accept the new volume mount. Otherwise, when plex does call the transcoder, it's still going to have the built in one. Up to this point, the container still has the original. We have not replaced it. So perhaps we can reword this to "restart/run the container with the new volume mount definition"

Copy link
Member

@drouarb drouarb Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, I didn't understood that you were talking about a docker setup

2. `git clone https://github.com/UnicornTranscoder/UnicornTranscoder.git`
3. `cd UnicornTranscoder`
4. `npm install`
5. `npm run install`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is only mandatory as root because npm has a security feature that prevent the install script to run on npm i when run as root.

5. `npm run install`

The transcoder is now ready to run. Just like the loadbalancer, we're going to run this as a service. Be sure to substitute the envrionment variables for your own setup/FQDN:
1. `nano /etc/systemd/system/unicorntranscoder.service`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe names of services should be consistent earlier UnicornLoadBalancer was camelcase

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result of a "Find and Replace" to fix a spelling issue. Easy enough fix

User=root
Group=root

Environment=TRANSCODER_DEBUG=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be enabled by default, it produces a lot of log

If you want to adjust the envrionment variables in `config.js`, make sure you re-run the npm build with `npm install` & `npm run install`. If you opt to override these variables in the service (like we did above), edit the service file. If you edit a service after it has already been loaded, you need to reload the daemon with `systemctl daemon-reload` & `systemctl restart unicorntranscoder.service`. As a rule of thumb, if you use service environment variables, don't edit the config.js variables (or vice versa). Keep all your variable definitions in the same place.

Once the FQDN is up and active with working SSL, point your browser to it. It will look something like this:
![](/images/UnicornTranscoder.png?raw=true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could store the image somewhere else than the code repository ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants