9.8 KiB
navigation, title, main
navigation | title | main | ||
---|---|---|---|---|
true | Plex |
|
:ellipsis{left=0px width=40rem top=10rem blur=140px}
Plex
::alert{type="info"} 🎯 Objectives:
- Install Plex
- Install Tautulli
- Access media from outside your network ::
Plex is a self-hosted video streaming platform for managing your movie or TV show library and playing them locally or remotely. Plex has apps for TV, Android, iOS, Windows, and macOS, allowing you to stream your library just like Netflix.
With Plex Pass, you can also organize and play your music content similar to Spotify, the difference being that it’s your content, hosted and streamed from your server.
We'll also install Tautulli, a tool that provides detailed stats about Plex. As always, we'll use linuxserver.io images where possible.
::alert{type="info"} :::list{type="info"}
- You’ll need to create a Plex.tv account. You don’t need to expose your Plex service; it will be accessible through the platform. Your Plex server will be manageable directly from your account. ::: ::
Install Plex
Folder structure:
root
├── docker
│ ├── plex
│ │ ├── compose.yml
│ │ ├── .env
│ │ ├── config
│ │ └── transcode
│ └── tautulli
│ └── config
└── media
├── tvseries
├── movies
└── library
Create the movies
, tvseries
, and library
folders in /media
:
mkdir -p /media/movies /media/library /media/tvseries
Open Dockge in your browser and click compose
.
Name the stack plex
and add the following config:
---
services:
linuxserver_plex:
image: ghcr.io/linuxserver/plex:amd64-latest
container_name: plex
network_mode: host
environment:
- PUID=${PUID}
- PGID=${GUID}
- TZ=Europe/Paris
- VERSION=docker
volumes:
- /docker/plex/config:/config
- /docker/plex/transcode:/transcode
- /media:/media
restart: unless-stopped
mem_limit: 4096m
mem_reservation: 2048m
devices:
- /dev/dri:/dev/dri
tautulli:
image: lscr.io/linuxserver/tautulli:latest
container_name: tautulli
environment:
- PUID=${PUID}
- PGID=${GUID}
- TZ=Europe/Paris
volumes:
- /docker/tautulli/config:/config
ports:
- 8181:8181
restart: unless-stopped
::alert{type="success"} ✨ Add the Watchtower label to each container to automate updates:
services:
plex:
#...
labels:
- com.centurylinklabs.watchtower.enable=true
tautulli:
#...
labels:
- com.centurylinklabs.watchtower.enable=true
::
Find your PUID and GUID by running:
id username
Fill in your .env
file with the retrieved values, for example:
PUID=1000
GUID=1000
Deploy the stack.
The local interface is available at http://yourserverip:32400/web/index.html
.
Tautulli is accessible at http://yourserverip:8181
.
::alert{type="warning"} :::list{type="warning"}
- You must be on your local network during Plex's initial setup. Otherwise, the URL will redirect to your Plex account without detecting your server. A VPN won't help. If you have no choice, you can handle the setup remotely via SSH tunnel. ::: ::
Configure Plex
Plex offers a range of free movies/shows. After creating your account, I recommend disabling everything in the Online Services section to keep your library clean.
Then go to the Remote Access section and manually select a port (we’ll use 1234
). It's best not to use the default port.
- On your router, forward TCP port
1234
to port32400
for your server’s IP using NAT rules. - Once done, return to Plex to verify that remote access is functional.
::alert{type="danger"} :::list{type="danger"}
-
If it fails: check your firewall rules and allow port
32400
on your server. ::: :: -
If you have PlexPass and a GPU or iGPU, enable hardware acceleration in the Transcoder section.
-
In Settings > Library, enable Update my library automatically.
-
In Manage > Library, add or edit libraries and point to
/media/movies
for movies and/media/tvseries
for series.
And that’s it! You now have a working Plex server!
Simply add your media to /media/movies
and /media/tvseries
on your server. You can then install the Plex app on your devices and watch your favorite content locally or remotely.
::alert{type="info"} :::list{type="info"}
- If your media is stored on a network disk (e.g. NAS or external hard drive over the network), refer to the Samba mount guide so Plex can access it. ::: ::
Expose Tautulli with Swag
You don’t need to expose Plex, as it's accessible via your Plex account on plex.tv.
However, you may want to expose Tautulli so you can view stats from a simple URL when you're not home.
::alert{type="info"} :::list{type="info"}
- We assume you have the subdomain
tautulli.mydomain.com
with aCNAME
pointing tomydomain.com
in your DNS zone. And of course, unless you use Cloudflare Zero Trust, your box's port443
must be forwarded to your server's port443
in NAT rules. ::: ::
Go to Dockge and edit SWAG’s compose file by adding Tautulli’s network:
services:
swag:
container_name: # ...
# ...
networks: # Attach container to custom network
# ...
- tautulli # Name of the declared network
networks: # Define the custom network
# ...
tautulli: # Declared network name
name: tautulli_default # Actual external network name
external: true # Marks it as externally defined
Redeploy the stack and wait for SWAG to be fully operational.
::alert{type="info"} :::list{type="info"}
- Here we assume the Tautulli network name is
tautulli_default
. You can check the connection by visiting SWAG’s dashboard athttp://yourserverip:81
. ::: ::
Copy and rename the file tautulli.subdomain.conf.sample
to tautulli.subdomain.conf
, then edit it:
::alert{type="success"} ✨ Tip: Use File Browser to navigate and edit files instead of using terminal commands. ::
sudo cp /docker/swag/config/nginx/proxy-confs/tautulli.subdomain.conf.sample /docker/swag/config/nginx/proxy-confs/tautulli.subdomain.conf
sudo vi /docker/swag/config/nginx/proxy-confs/tautulli.subdomain.conf
Ensure the configuration matches the following. If needed, press i
to edit:
## Version 2023/05/31
# make sure that your tautulli container is named tautulli
# make sure that your dns has a cname set for tautulli
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name tautulli.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth (requires ldap-location.conf in the location block)
#include /config/nginx/ldap-server.conf;
# enable for Authelia (requires authelia-location.conf in the location block)
#include /config/nginx/authelia-server.conf;
# enable for Authentik (requires authentik-location.conf in the location block)
#include /config/nginx/authentik-server.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable for ldap auth (requires ldap-server.conf in the server block)
#include /config/nginx/ldap-location.conf;
# enable for Authelia (requires authelia-server.conf in the server block)
#include /config/nginx/authelia-location.conf;
# enable for Authentik (requires authentik-server.conf in the server block)
#include /config/nginx/authentik-location.conf;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app tautulli;
set $upstream_port 8181;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
location ~ (/tautulli)?/api {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app tautulli;
set $upstream_port 8181;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
location ~ (/tautulli)?/newsletter {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app tautulli;
set $upstream_port 8181;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
location ~ (/tautulli)?/image {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app tautulli;
set $upstream_port 8181;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}
::alert{type="success"}
✨ You can protect this app with Authentik by removing the #
before include /config/nginx/authentik-server.conf;
and include /config/nginx/authentik-location.conf;
. Don’t forget to create an application and provider in Authentik.
::
Press Esc
then save and quit by typing :x
Wait a few minutes, then open http://tautulli.mydomain.com
in your browser.
::alert{type="danger"} :::list{type="danger"}
- If it fails: check your firewall rules. ::: ::
And you're done!