This is my first time ever working with Docker and this size/complexity of bash script, pls be nice and help me learn the correct or more efficient way of doing things.
Uses docker-compose to bring up the following containers to host an orchestrated home media server:
- Plex
- Tautulli
- Ombi
- Sonarr
- Radarr
- Jackett
- Transmission/OpenVPN with a HTTP Proxy
- Reverse Proxy
- Define the path you want to use to store all data in
.env
afterDATAFOLDER
(default is/mnt/hms-docker_data
). - Define if you're using a network share or not by setting
USINGNETWORKSHARE
totrue
orfalse
. - Define the domain you want to use in the
.env
file underLOCALDOMAIN
(default is.local
). - Input your VPN info under
VPNUSER
andVPNPASS
in the.env
file, as well as theVPNPROVIDER
if your VPN subscription is supported. Check here. - Declare any other VPN environment variables (e.g. If using NordVPN, you can set the Country and Category with
NORDVPN_COUNTRY=US
andNORDVPN_CATEGORY=legacy_p2p
). - Configure any additional Transmission environment variables you may want.
- Define the
NETWORKSHAREDRIVER
, currently only supports CIFS and NFS (ignored ifUSINGNETWORKSHARE=false
). - If using CIFS, define where you want the
CREDENTIALFILE
to go. WARNING: only the user that runs the script will be able to access this file as it is stored in their home dir by default with permissions 0600 - If using NFS, define the
NFSFOLDER
andNFSOPTIONS
(if any). If no options are defined, the/etc/fstab
entry will usedefaults
when mounting on boot.- NFS users will also need to put in any sort of value for
NETWORKSHAREUSER
andNETWORKSHAREPASS
, I don't have handling for blank entries yet for these.
- NFS users will also need to put in any sort of value for
- Visit https://plex.tv/claim to obtain your
PLEX_CLAIM
token and input this in the.env
file. - Change your timezone in the
.env
if you are not in theAmerica/New_York
timezone. - Run
setup.sh
, or justdocker-compose up -d
if you already have a docker environment that you prefer.
If this is a fresh install of Ubuntu 18.04, just run setup.sh
and it'll automatically remove old versions of Docker (if installed), add GPG keys and new Docker repo and install Docker, install docker-compose, mount a network share (CIFS or NFS) on boot by adding to /etc/fstab
, also appends the IP and hostname of containers to /etc/hosts
(if you enter Y when prompted).
- Modify the entries in .env as described above to adapt it to your environment (such as
DATAFOLDER
andLOCALDOMAIN
) - To run in the background as detached after container startup:
$ docker-compose up -d
- To run with container output for a bit of debugging (will kill containers on CTRL+C):
$ docker-compose up
On container boot, the reverse proxy powered by jwilder/nginx-proxy
obtains the IPs and hostnames of all running containers and builds a dynamic reverse proxy config that updates on container start and stop. The default assigned VIRTUAL_HOST
values are <container_name>.${LOCALDOMAIN}
where LOCALDOMAIN
is defined in your .env
file. Default is .local
. (e.g. The sonarr container is sonarr.local
and jackett would be jackett.local
by default).
It is highly recommended that you use a static IP for the docker host machine.
You will need to update your DNS to point all A records for these hostnames towards the docker host IP, the reverse proxy will handle the rest by serving the data on port 80.
If you do not want to update your DNS, you can still access the services by going to <docker host IP>:<port of service>
, or you can create a single "catch all" A record (e.g. hms-docker.local
) pointing towards the docker host IP and then specifying the port afterwards (hms-docker.local:<port>
), the ports for services are listed below:
Service ports:
- Plex: 32400/web
- Tautulli: 8181
- Sonarr: 8989
- Radarr: 7878
- Ombi: 3579
- Jackett: 9117
- Transmission: 9091
Although it is device-specific, you can update your /etc/hosts
file (or C:\Windows\System32\drivers\etc\hosts
on Windows) with the format
...
<docker host IP> <container_name>.${LOCALDOMAIN}
...
This will allow you to access the hostnames of the services by going to http://<container_name>:port
or <container_name>:port/
.
Supported <container_name>
's are:
- plex
- tautulli
- sonarr
- radarr
- ombi
- jackett
- transmission
Or you can create the single "catch all" record in this hosts
file and just specify the port as mentioned above.
You will be given the option to append these to your /etc/hosts
file when running the script (only on Linux). Just enter Y or N when prompted. They will also be printed out so you can copy and paste if needed.
The Transmission container from haugene/docker-transmission-openvpn
also includes an OpenVPN client as well as a HTTP proxy (running on port 8888 of the transmission container) for other containers to route traffic through the VPN. You can find all supported VPN providers and configurations at https://github.com/haugene/docker-transmission-openvpn.
- After port 80 is forwarded, update the DNS with your registrar to add a
ombi.<TLD domain>
that resolves to your IP so you can access ombi from anywhere thanks to the reverse proxy. - Ombi sends any requests to Sonarr and Radarr, which contact Jackett to query a large number of trackers.
- Once a match is found, Sonarr and Radarr will determine if it should download it based on the quality profiles you specify and then send it off to Transmission to download.
- After it's done downloading/seeding, Sonarr or Radarr will link it to the Plex media folder and notify Ombi that it's ready on Plex.
- Tautulli is used for Plex analytics, such as which users have watched the most content, what kind of content, and a bunch of other useful data.
- jwilder/nginx-proxy
- Provides the dynamic reverse proxy
- haugene/docker-transmission-openvpn
- Provides Transmission, OpenVPN client, and the HTTP proxy that routes through the VPN.
- linuxserver/sonarr
- linuxserver/radarr
- linuxserver/jackett
- linuxserver/ombi
- plexinc/pms-docker
- tautulli/tautulli
- Big thanks to jwilder, haugene, and linuxserver for making this project possible through the use of their containers.