156 lines
6.5 KiB
Plaintext
156 lines
6.5 KiB
Plaintext
https://github.com/plexinc/pms-docker
|
|
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
|
https://docs.docker.com/compose/how-tos/gpu-support/
|
|
|
|
Create user and group
|
|
---------------------
|
|
Credentials -> Local Users -> Add
|
|
Full Name: plex
|
|
Username: plex
|
|
Disable Password: <select>
|
|
Email: stuurmcp@telkomsa.net
|
|
UID: (note)
|
|
Create New Primary Group: <unselect>
|
|
Primary Group: media
|
|
Create Home Directory: <uncheck>
|
|
Samba Authentication: <uncheck>
|
|
Save
|
|
|
|
plex UID: 3015
|
|
media GID: 3017
|
|
|
|
If not done already, add mapping for media on container config
|
|
--------------------------------------------------------------
|
|
In this example: the folder where media is stored is /mnt/stpool1/NData1/Media
|
|
On Truenas shell:
|
|
jlmkr edit docker
|
|
Add the following args to "systemd_nspawn_user_args":
|
|
--bind='/mnt/stpool1/NData1/Media:/mnt/media'
|
|
|
|
If not done already, set ACL permissions for media to be accessible by media group
|
|
----------------------------------------------------------------------------------
|
|
On Truenas shell:
|
|
# read and note acl entries
|
|
getfacl /mnt/stpool1/NData1
|
|
getfacl /mnt/stpool1/NData1/Media
|
|
# set read and execute permissions for media group on parent folder
|
|
setfacl -m g:media:5 /mnt/stpool1/NData1
|
|
# set full permissions for media group on Media folder recursively
|
|
setfacl -R -m g:media:7 /mnt/stpool1/NData1/Media
|
|
# modify defaults recursively
|
|
setfacl -R -d -m g:media:7 /mnt/stpool1/NData1/Media
|
|
# NB! if you want to remove all acl entries from a folder recursively, use setfacl -b -R <foldername>
|
|
|
|
set ACL permissions for custom certificates
|
|
--------------------------------------------
|
|
# On Truenas shell:
|
|
# read and note acl entries
|
|
getfacl /mnt/SSD1/docker/data/traefik/certs
|
|
# change owner and group if not traefik
|
|
chown -R traefik:traefik /mnt/SSD1/docker/data/traefik/certs
|
|
# set access permissions to 750
|
|
chmod -R 750 /mnt/SSD1/docker/data/traefik/certs
|
|
# modify for media group recursively
|
|
setfacl -R -m g:media:4 /mnt/SSD1/docker/data/traefik/certs
|
|
# modify defaults recursively
|
|
setfacl -R -d -m g:media:4 /mnt/SSD1/docker/data/traefik/certs
|
|
|
|
Create datasets
|
|
---------------
|
|
/mnt/SSD1/docker/data/plex
|
|
/mnt/SSD1/docker/data/plex/config
|
|
Set Owner:Group to plex:plex
|
|
|
|
Copy folder to docker stacks
|
|
----------------------------
|
|
In Windows cmd shell in plex folder, enter:
|
|
pscp -P 22 -r stacks/*.* root@192.168.2.2:/mnt/SSD1/docker/stacks/plex/
|
|
This should copy compose.yaml, .env and secrets to /mnt/SSD1/docker/stacks/plex
|
|
|
|
Create data folders
|
|
-------------------
|
|
mkdir /mnt/data/plex/config
|
|
mkdir /mnt/data/plex/transcodes
|
|
cd /mnt/data/plex
|
|
|
|
Create secrets
|
|
--------------
|
|
Visit https://www.plex.tv/claim/ and get your plex claim which will expire in 4 minutes
|
|
cd /opt/stacks/plex/secrets
|
|
echo -n 'claim-b6UNdeGsjjMz4tRADKfB' > plex_claim # this one is expired
|
|
chown 3015:3014 plex_claim
|
|
chmod 400 plex_claim
|
|
Update and start your plex container within the 4 minutes
|
|
|
|
Create plex custom cert
|
|
-----------------------
|
|
openssl pkcs12 -export -out plex_cert.p12 -in plex.pem -inkey plex-key.pem -certfile plex.pem -passout stdin -certpbe AES-256-CBC -keypbe AES-256-CBC -macalg SHA256
|
|
# enter the password directly after executing above
|
|
# if secruity is not an issue, the password can be specified on the command line as follows:
|
|
openssl pkcs12 -export -out plex_cert.p12 -in plex.pem -inkey plex-key.pem -certfile plex.pem -passout pass:'password' -certpbe AES-256-CBC -keypbe AES-256-CBC -macalg SHA256
|
|
|
|
Migrating data from old plex media server (source) to newly installed one (target)
|
|
----------------------------------------------------------------------------------
|
|
# Stop old/source plex media server
|
|
heavyscript app --stop plex
|
|
# Stop new/target plex media server
|
|
# On Dockge, select plex and click stop
|
|
# Copy the source Library to target folder:
|
|
cp -r /mnt/stpool1/apps/plex/Library /mnt/SSD1/docker/data/plex/config/
|
|
# Change ownership of copied folders
|
|
chown -R plex:media /mnt/stpool1/apps/plex/Library /mnt/SSD1/docker/data/plex/config/
|
|
|
|
Managing library files
|
|
----------------------
|
|
Try and keep the mount folders for the media the same as that of the old media server
|
|
However, if you choose to have a different mount:
|
|
For example,
|
|
If the old media server mapped to /Media and the new one now maps to /data, then you will have to modify the media folders in plex settings to reflect the new mount.
|
|
Open plex, click on the spanner/wrench and select Manage->Libraries
|
|
Go through all the libraries items, adding new media folders and removing those that were replaced
|
|
This may take some time (depends on library size)
|
|
|
|
Check and update custom server access URLs in Plex
|
|
--------------------------------------------------
|
|
Open Plex web app using browser on plex server
|
|
Click on wrench/spanner, navigate to your home server name -> Settings -> Network
|
|
Scroll down to Enable Relay checkbox, and uncheck it (you can check it again after getting remote access to work)
|
|
Check entries in Custom server access URLs textbox
|
|
Update the settings to reflect new server ip address and URL; and ensure there is a URL for https://plex.sthome.org:443
|
|
https://plex.sthome.org,http://plex.sthome.org,http://plex.sthome.org:32400
|
|
Click on Save Changes
|
|
Still under Settings, click on Remote Access
|
|
Click on Enable Remote Access
|
|
Put check mark in Manually specify public port and enter 443 (traefik will map this to 32400)
|
|
Click on Retry
|
|
Restart plex container for good measure
|
|
Go previous Settings -> Remote Access screen
|
|
Click on Retry
|
|
The server should briefly be connected
|
|
Open Plex Windows or Android App and check if it works
|
|
|
|
Hardware accelleration (nVidia)
|
|
-------------------------------
|
|
# install nvidia-container-toolkit; in docker shell:
|
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
|
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
|
|
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
|
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
|
apt-get update
|
|
apt-get install -y nvidia-container-toolkit
|
|
nvidia-ctk runtime configure --runtime=docker
|
|
systemctl restart docker
|
|
|
|
Troubleshooting
|
|
---------------
|
|
Android not connecting to server
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Open plex app
|
|
Sign out from your account
|
|
Sign in entering plex account credentials
|
|
See if it works
|
|
|
|
Transcoding: plex client fails with "An unknown error occurred (4294967283)"
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|