Skip to content

Commit

Permalink
Integrate Traefik (2.0) to our stack
Browse files Browse the repository at this point in the history
I'm sorry, this commit contains a compilation of what I've added to
our Plex & co setup over the last two years, without commiting
anything. So... it actually contains multiple changes :/

I thought these changes would be beneficial to our pet project
Essentially, they are meant to make setup and maintainance easier than
ever before, which I think is essential if we want more people to enjoy
this stuff :D

Here's the list:
- Traefik has been integrated to our stack. It makes the setup easier
  for everyone who just wants a working setup on a fresh new server.
  Using this integrated traefik to route traffic to containers that
  aren't part of this stack is still possible of course.
  As a result, using custom networks is not necessary any more, it
  simplifies our `docker-compose.yaml` file a bit.
- I've updated to Traefik 2, which completely breaks the vast majority
  of its APIs. Docker annotations had to be rewritten.
- I removed the traefik.toml file and entirely moved the configuration
  to CLI flags. Removing this "moving part" that had to be edited and
  could be commited by accident (with our credentials in it...) will
  make "git pulls" much much easier... and therefore encourage
  contributions I hope :)
- The configuration just boils down to env. variables, which the README
  suggests should be put in the user's `.bashrc/.zshrc` (using
  `docker-compose` commands is therefore way simpler, no need to
  constantly use Ctrl-R any more).
- The plex token is no more passed as an env. var. It has to be entered
  on the UI on first setup.
- Only the HTTPs port is exposed, most browsers use https by default when
  typing URLs in the navigation bar. As a result, we now use the
  tlsChallenge (instead of http challenge): it doesn't require the
  server to listen on port 80. Only 443 is used during the ACME
  challenge.
- Some additional folders are mounted onto plex, they are targeted at
  manual uploads from other machines (I used that to RSync music from my
  multiple computers, as well as my Pictures, which I think is a rather
  valuable feature).
  • Loading branch information
elafarge committed Oct 13, 2019
1 parent fe349a4 commit 7ec92ad
Show file tree
Hide file tree
Showing 4 changed files with 312 additions and 134 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,9 @@ Session.vim
# auto-generated tag files
tags

# Media (oooops...)
media/
# Media
media

# Reverse proxy
## Heheheheh
acme/
148 changes: 120 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,142 @@
# Media Server
Dockyard
========

A media server configuration to run Plex, Sonarr, Radarr, and Transmission in Docker and behind Traefik.
TL;DR
-----

Each subdirectory contains a docker-compose setup. Setups can be combined, for
instance, you can spawn Traefik to act as a router to server-compents in other
setups.

## First run
## Requirements

NOTE: All the following should be applied on the machine you want to setup our
Plex stack on.

- install [Docker](https://www.docker.com/)
- install [Docker Compose](https://docs.docker.com/compose/)
- create a [Plex accout](https://www.plex.tv/)
- clone this repository
- clone and setup [the reverse proxy](https://github.com/hkaj/reverse_proxy)
- create a user for your media server, export its `$USER_ID` and `$GROUP_ID`.
- create a folder named `media` in this folder (`dockyard`) owned by $USER_ID:$GROUP_ID from your `media` user.
- get your Plex claim token at https://www.plex.tv/claim/
- create a `web` docker network with `docker network create web`
- run `DOMAIN_NAME="..." PLEX_TOKEN="..." USER_ID="$USER_ID" GROUP_ID="$GROUP_ID" docker-compose up -d`
- profit :)
- clone this repository in a folder of your choice, where you want all your
media to be stored
- a domain (or subdomain) name with A records pointing to your server IP
```
# Replace example.com with your (sub)domain here
example.COM A <YOUR_SERVER_IP>
*.example.com A <YOUR_SERVER_IP>
```

- Export these env vars in your `.bashrc/.zshrc`:
```shell
export TRAEFIK_ADMIN_PORT=8080
# Change example.com with your domain name
export DOMAIN_NAME=fsociety.tel
# Change [email protected] with your domain name
export [email protected]
export USER_ID=${UID}
export GROUP_ID=${GID}
```

- then resource .zshrc/.bashrc, or simply log out of your server and connect again
```
# Bash
source ~/.bashrc
# ZSH
source ~/.zshrc
```

- finally bring up your stack (you can use [ctop](https://ctop.sh) to monitor
your stack)
```shell
# Jump into the repo you just cloned
cd dockyard

# Bring up the stack !
docker-compose up -d
```

## Configuration

## Plex

Plex won't be opened to the web when you start it for the first time. For that
reason, you'll need to create an SSH tunnel to perform the initial configuration

```shell
ssh -L 32400:127.0.0.1:32400 <YOUR_SERVER>
# Don't close the SSH session or your terminal until you finish the setup
```

Then, you can reach `http://127.0.0.1:32400` in your browser and follow the
instructions. You will then be able to access your Plex server on
[https://app.plex.tv](https://app.plex.tv).

TODO: recommend TLS setup on the Plex server itself

## Transmission

TODO: protect via password using Traefik

## Radarr

TODO: protect via password using Traefik

## Sonarr

TODO: protect via password using Traefik

## Ombi

TODO: protect via password using Traefik

## PlexPy

TODO: protect via password using Traefik

## Jackett

TODO: protect via password using Traefik

## Config
## Where to find your media ?

In the `dockyard` (our repo) folder, a `media` subfolder will be created.
This is where all your content will be stored. This is the folder to
backup up and relocate to another server in case you need to migrate your
data from one machine to another.

### Transmission
## Troubleshooting

We use [Transmission](https://transmissionbt.com/) as the downloader.
### Docker-Compose commands

- stop transmission's container
- configure basic auth at `media/transmission/config/settings.json` (you will need to touch `rpc-authentication-required`, `rpc-username` and `rpc-password`)
- start transmission's container
All these commands must be run at the root of the repo you cloned

- getting logs from your container:
```shell
docker-compose logs

### Sonarr
# Only logs for a given set of services
docker-compose logs plex proxy
```

We use [Sonarr](https://sonarr.tv/) to track and manage TV shows.
### Accessing Traefik's user interface

- setup auto-update and authentication
- connect transmission as a downloader
Traefik's user interface is not exposed publicly. To connect to it, you can use
SSH-tunneling on port `8080`:
```shell
ssh -L 8080:127.0.0.1:8080 <YOUR_SERVER>
# don't close the SSH session
```

The interface will be accessible under `http://localhost:8080` on your local
machine.

### Radarr
## Disclaimer

We use [Radarr](https://radarr.video/) (a clone of Sonarr) to track and manage movies.
We can't be held responsible for what you'll do with the setups (don't download
stuff illegally, etc. etc.)

- setup auto-update and authentication
- connect transmission as a downloader
## Maintainers

* [hkaj](/hkaj)
* [elafarge](/elafarge)

### Jackett

We use [Jackett](https://github.com/Jackett/Jackett) as a proxy between private trackers and our other components.
48 changes: 48 additions & 0 deletions README.old.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Media Server

A media server configuration to run Plex, Sonarr, Radarr, and Transmission in Docker and behind Traefik.


## First run

- install [Docker](https://www.docker.com/)
- create a [Plex accout](https://www.plex.tv/)
- clone this repository
- clone and setup [a reverse proxy](../traefik/)
- create a user for your media server, export its `$USER_ID` and `$GROUP_ID`.
- create a media folder in docker-compose's folder with $USER_ID:$GROUP_ID ownership
- get your Plex claim token at https://www.plex.tv/claim/
- run `DOMAIN_NAME="..." PLEX_TOKEN="..." IP_ADDRESS="..." USER_ID="$USER_ID" GROUP_ID="$GROUP_ID" docker-compose up -d`
- profit :)

## Config


### Transmission

We use [Transmission](https://transmissionbt.com/) as the downloader.

- stop transmission's container
- configure basic auth at `media/transmission/config/settings.json` (you will need to touch `rpc-authentication-required`, `rpc-username` and `rpc-password`)
- start transmission's container


### Sonarr

We use [Sonarr](https://sonarr.tv/) to track and manage TV shows.

- setup auto-update and authentication
- connect transmission as a downloader


### Radarr

We use [Radarr](https://radarr.video/) (a clone of Sonarr) to track and manage movies.

- setup auto-update and authentication
- connect transmission as a downloader


### Jackett

We use [Jackett](https://github.com/Jackett/Jackett) as a proxy between private trackers and our other components.
Loading

0 comments on commit 7ec92ad

Please sign in to comment.