Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxou44 committed Feb 23, 2019
2 parents 8cb83fa + 3a48827 commit 077a373
Show file tree
Hide file tree
Showing 33 changed files with 1,344 additions and 886 deletions.
57 changes: 36 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,52 @@ This software is a part of __UnicornTranscoder__ project, it's the LoadBalancer

* Plex Media Server
* NodeJS
* npm
* RedisCache (Optionnal)
* Postgresql (Optionnal)

## Setup

### 1. Installation

* Clone the repository
* Install with `npm install`
* Edit the configuration

| Variable | Description |
| ----------------- | ------------------------------------------------------------ |
| cluster | Array of UnicornTranscoder Servers in the cluster |
| preprod | If enabled, will filter on IP and send to the configured UnicornTranscoder, it allows to have a UnicornTranscoder server for developement without impacting users on the Plex Media Server |
| plex | Configuration of the Plex Media server |
| >host | Address to join the Plex Media Server |
| >port | Port of the Plex Media server |
| >sessions | Where Plex store sessions (to grab external subtitles) |
| >database | Plex Media Server Database |
| loadBalancer.port | Port UnicornLoadBalancer will listen |
| alerts.discord | Discord Webhook to notify unavailable UnicornTranscoder |

* Configure Plex Media Server access Address
* In Settings -> Server -> Network
* Set `Custom server access URLs` to the address to access the UnicornLoadBalancer
* Setup some environnement variables to configure the *UnicornLoadBlancer*

| Name | Description | Type | Default |
| ----------------- | ------------------------------------------------------------ | ------| ------- |
| **SERVER_HOST** | Host to access to the *UnicornLoadBalancer* | `string` | `127.0.0.1` |
| **SERVER_PORT** | Port used by the *UnicornLoadBalancer* | `int` | `3001` |
| **SERVER_PUBLIC** | Public url where the *UnicornLoadBalancer* can be called, **with** a slash at the end | `string` | `http://127.0.0.1:3001/` |
| **PLEX_HOST** | Host to access to Plex | `string` | `127.0.0.1` |
| **PLEX_PORT** | Port used by Plex | `int` | `32400` |
| **PLEX_PATH_USR** | The Plex's path | `string` | `/usr/lib/plexmediaserver/` |
| **PLEX_PATH_SESSIONS** | The path where Plex store sessions (to grab external subtitles) | `string` | `/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode/Sessions` |
| **DATABASE_MODE** | Kind of database to use with Plex, can be `sqlite` or `postgresql` | `string` | `sqlite` |
| **DATABASE_SQLITE_PATH** | The path of the Plex database | `string` | `/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db` |
| **DATABASE_POSTGRESQL_HOST** | Host of the Postgresql server | `string` | ` ` |
| **DATABASE_POSTGRESQL_DATABASE** | Name of the postgresql database | `string` | ` ` |
| **DATABASE_POSTGRESQL_USER** | User used by the Postgresql database| `string` | ` ` |
| **DATABASE_POSTGRESQL_PASSWORD** | Password used by the Postgresql database | `string` | `sqlite` |
| **DATABASE_POSTGRESQL_PORT** | Port used by the Postgresql database | `int` | `5432` |
| **REDIS_HOST** | The host of the redis database | `string` `undefined` | `undefined` |
| **REDIS_PORT** | Port used by Redis | `int` | `6379` |
| **REDIS_PASSWORD** | The password of the redis database | `string` | ` ` |
| **REDIS_DB** | The index of the redis database | `int` | `0` |
| **CUSTOM_SCORES_TIMEOUT** | Seconds to consider a not-pinged server as unavailable | `int` | `10` |
| **CUSTOM_IMAGE_RESIZER** | Enable or disable the custom (Unicorn) image resizer (most efficient than Plex one) | `bool` | `false` |
| **CUSTOM_IMAGE_PROXY** | Use a proxy to convert images, **with** a slash at the end | `string` | ` ` |
| **CUSTOM_DOWNLOAD_FORWARD** | Enable or disable 302 for download links and direct play, if enabled, transcoders need to have access to media files | `bool` | `false` |
| **CUSTOM_SERVERS_LIST** | Transcoder servers set by default, **with** a slash at the end, separate servers with a **comma** | `string array` | `[]` |

* Configure Plex Media Server access address
* In Settings -> Server -> Network
* Set `Custom server access URLs` to the address to access the UnicornLoadBalancer
* Run with npm start

## 2. Notes
### 2. Notes

All the requests to this Plex Media Server should pass by the UnicornLoadBalancer, if someone reach the server directly without passing through UnicornLoadBalancer he will not be able to start a stream, since FFMPEG binary has been replaced. It is recomended to setup a nginx reverse proxy in front to setup a SSL certificate and to have an iptable to direct access to the users on port 32400.
All requests to the Plex Media Server should pass through the *UnicornLoadBalancer*, if someone reach the server directly he will not be able to start a stream, since FFMPEG binary has been replaced. To solve this problem it is recomended to configure an iptable to drop direct access on port **32400**.
It is also recomended to setup a nginx reverse proxy in front of the *UnicornLoadBalancer* to setup a SSL certificate.

```
#Example iptable
Expand All @@ -50,4 +66,3 @@ iptables -A INPUT -p tcp --dport 32400 -i eth0 -s <transcoderIP> -j ACCEPT
#Deny all other incoming connections
iptables -A INPUT -p tcp --dport 32400 -i eth0 -j DROP
```

26 changes: 0 additions & 26 deletions app.js

This file was deleted.

49 changes: 0 additions & 49 deletions bin/www

This file was deleted.

30 changes: 0 additions & 30 deletions config.js

This file was deleted.

156 changes: 0 additions & 156 deletions core/discord.js

This file was deleted.

20 changes: 0 additions & 20 deletions core/proxy.js

This file was deleted.

Loading

0 comments on commit 077a373

Please sign in to comment.