Last active
July 24, 2023 11:53
-
-
Save lightrush/c08b5e7749ba9ca20c3c8bdc5a66acef to your computer and use it in GitHub Desktop.
Revisions
-
lightrush revised this gist
Nov 4, 2017 . 3 changed files with 19 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,9 +6,11 @@ Fill in the blanks in `plex-docker-run.sh`, `plex-docker.service`, optionally `m ``` sudo [Path to]/plex-docker-run.sh sudo cp [Path to]/plex-docker.service /etc/systemd/system/ sudo cp [Path to]/network-internet.service /etc/systemd/system/ # Optionally # sudo cp [Path to]/mount-remote-volume.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable network-internet.service sudo systemctl enable plex-docker.service # Optionally # sudo systemctl enable mount-remote-volume.service This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # This Systemd unit waits indefinitely for internet connection ## It's useful for starting other services after internet connection is established. ## Internet connection being established means being able to reach 8.8.8.8 and ## being able to resolve google.com using 8.8.8.8 as DNS. [Unit] Description=Wait for internet connection After=network-online.target [Service] Type=oneshot ExecStart=/bin/bash -c 'while ! nslookup google.com 8.8.8.8 &> /dev/null ; do echo No internet connection. Waiting... ; sleep 10 ; done' RemainAfterExit=yes TimeoutSec=infinity [Install] WantedBy=multi-user.target This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ [Unit] Description=Plex Requires=docker.service After=network-internet.service docker.service # Put any local media locations below. If you put remote media volumes that may fail to mount before this service # starts, those will become a failed dependency for the service and Plex won't start. Therefore remote # media volumes are better mounted with oneshot services like mount-remote-volume.service provided in this gist. @@ -10,9 +10,6 @@ After=network-online.target docker.service [Service] Restart=always ExecStart=/usr/bin/docker start -a plex ExecStop=/usr/bin/docker stop -t 2 plex -
lightrush revised this gist
Nov 4, 2017 . 3 changed files with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,14 @@ ## Docker run script and Systemd unit files for setting up Plex using the official image by Plex Inc Fill in the blanks in `plex-docker-run.sh`, `plex-docker.service`, optionally `mount-remote-volume.service` and save them. Then: ``` sudo [Path to]/plex-docker-run.sh sudo cp [Path to]/plex-docker.service /etc/systemd/system/ # Optionally # sudo cp [Path to]/mount-remote-volume.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable plex-docker.service # Optionally # sudo systemctl enable mount-remote-volume.service ``` File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ Requires=docker.service After=network-online.target docker.service # Put any local media locations below. If you put remote media volumes that may fail to mount before this service # starts, those will become a failed dependency for the service and Plex won't start. Therefore remote # media volumes are better mounted with oneshot services like mount-remote-volume.service provided in this gist. # If you use one or more mount-remote-volume.service units, you should add them to the After directive above. # RequiresMountsFor=[Path to your media on host machine e.g. /media/somedisk/music] [Path to your media on host machine e.g. /media/someotherdisk/music] [Service] -
lightrush renamed this gist
Nov 4, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # This Systemd unit waits indefinitely for a remote volume to mount ## It's useful for mounting remote volumes and starting other services after mounting succeeds [Unit] Description=Mount remote volume After=network-online.target [Service] -
lightrush revised this gist
Nov 4, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ Requires=docker.service After=network-online.target docker.service # Put any local media locations below. If you put remote media volumes that may fail to mount before this service # starts, those will become a failed dependency for the service and Plex won't start. Therefore remote # media volumes are better mounted with oneshot services like mount-volume-wait.service provided below. # If you use one or more mount-volume-wait.service units, you should add them to the After directive above. # RequiresMountsFor=[Path to your media on host machine e.g. /media/somedisk/music] [Path to your media on host machine e.g. /media/someotherdisk/music] [Service] -
lightrush revised this gist
Nov 4, 2017 . 3 changed files with 13 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,15 @@ # Setup Plex with Docker ## Docker run script and Systemd unit files for setting up Plex using the official image by Plex Inc Fill in the blanks in `plex-docker-run.sh`, `plex-docker.service`, optionally `mount-volume-wait.service` and save them. Then: ``` sudo [Path to]/plex-docker-run.sh sudo cp [Path to]/plex-docker.service /etc/systemd/system/ # Optionally # sudo cp [Path to]/mount-volume-wait.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable plex-docker.service # Optionally # sudo systemctl enable mount-volume-wait.service ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ # This Systemd unit waits indefinitely for a volume to mount ## It's useful for mounting remote volumes and starting other services after mounting succeeds [Unit] Description=Mount remote media volume After=network-online.target [Service] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,10 @@ Description=Plex Requires=docker.service After=network-online.target docker.service # Put any local media locations below. If you put remote media volumes that may fail to mount before this service # starts, those will become a failed dependency for the service and Plex won't start. Therefore remote # media volumes are better mounted with oneshot services like `mount-volume-wait.service` provided below. # If you use one or more `mount-volume-wait.service` units, you should add them to the `After` directive above. # RequiresMountsFor=[Path to your media on host machine e.g. /media/somedisk/music] [Path to your media on host machine e.g. /media/someotherdisk/music] [Service] -
lightrush revised this gist
Nov 4, 2017 . 2 changed files with 18 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,11 @@ Description=Plex Requires=docker.service After=network-online.target docker.service # Put any local media locations below. If you put remote media volumes that fail to mount on boot # this will become a failed dependency for the service and Plex won't start. Therefore remote # media volumes are better mounted with oneshot services like remote-media-volume-0.service. # If you use such services, you probably want to add them to the After directive above. # RequiresMountsFor=[Path to your media on host machine e.g. /media/somedisk/music] [Path to your media on host machine e.g. /media/someotherdisk/music] [Service] Restart=always This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ # This Systemd unit waits indefinitely for a remote media volume to mount [Unit] Description=Remote media volume 0 After=network-online.target [Service] Type=oneshot ExecStart=/bin/bash -c 'while ! [Your mount command here. E.g. mount -t cifs //someserver/someshare /media/someshare] &> /dev/null ; do echo Cannot mount share. Retrying... ; sleep 10 ; done' RemainAfterExit=yes TimeoutSec=infinity [Install] WantedBy=multi-user.target -
lightrush revised this gist
Nov 4, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Setup Plex with Docker ## Docker run script and Systemd unit file for setting up Plex using the official image by Plex Inc Fill in the blanks in `plex-docker-run.sh`, `plex-docker.service` and save them. Then: ``` -
lightrush revised this gist
Nov 4, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ # Setup Plex with Docker ## Docker run script and Systemd unit file for setting up Plex using the official Docker image by Plex Inc Fill in the blanks in `plex-docker-run.sh`, `plex-docker.service` and save them. Then: ``` sudo [Path to]/plex-docker-run.sh sudo cp [Path to]/plex-docker.service /etc/systemd/system/ -
lightrush revised this gist
Nov 4, 2017 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ Fill in the blanks in plex-docker-run.sh and save it. Then: ``` sudo [Path to]/plex-docker-run.sh sudo cp [Path to]/plex-docker.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable plex-docker.service ``` -
lightrush revised this gist
Nov 4, 2017 . 2 changed files with 13 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,10 +5,16 @@ docker run \ --name plex \ --net=host \ -e TZ="US/Eastern" \ `# Go to https://www.plex.tv/claim/ and copy a token from there.` \ `# Do this last since you have 4 minutes to use each token and container creation can take time.` \ -e PLEX_CLAIM="[Plex claim token]" \ -e PLEX_GID="[The GID that can access your media]" \ -e PLEX_UID="[The UID that can access your media]" \ -v "[Path to your Plex database on host machine. This is specified so that your Plex database survives container recreation. E.g. /opt/plex/config]:/config" \ `# Make sure the locations below are mounted before the container starts. Putting them in /etc/fstab works well.` \ `# There's a mount dependency in the Systemd unit file where you should probably add them.` \ `# Repeat for all the media locations you have.` \ -v "[Path to your media on host machine. E.g. /media/somedisk/music]:[Path to your media in container. E.g. /media/somedisk/music]" \ `# This is the image used for your container.` \ `# If you don't have plexpass, you should change the image tag from ":plexpass" to ":latest".` \ plexinc/pms-docker:plexpass This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,12 @@ Description=Plex Requires=docker.service After=network-online.target docker.service # Put any media locations below. # RequiresMountsFor=[path to your media on host machine e.g. /media/somedisk/music] [path to your media on host machine e.g. /media/someotherdisk/music] [Service] Restart=always # Ensure plex.tv is resolvable when the server starts so that remote registration succeeds. ExecStartPre=/bin/bash -c 'while ! nslookup plex.tv 8.8.8.8 &> /dev/null ; do echo Cannot resolve plex.tv. Waiting... ; done' TimeoutSec=infinity ExecStart=/usr/bin/docker start -a plex -
lightrush created this gist
Nov 3, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ # Setup Plex with Docker ## This gist sets up Plex Media Server using the official Docker image by Plex Fill in the blanks in plex-docker-run.sh and save it. Then: ``` sudo [path to]/plex-docker-run.sh sudo cp [path to]/plex-docker.service /etc/systemd/system/ sudo systemctl enable plex-docker.service ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/bin/bash docker run \ -d \ --name plex \ --net=host \ -e TZ="US/Eastern" \ -e PLEX_CLAIM="[Go to https://www.plex.tv/claim/ and copy the token here. Do this last since you have 4 minutes to use each token.]" \ -e PLEX_GID="[The GID that can access your media]" \ -e PLEX_UID="[The UID that can access your media]" \ -v "/home/lightrush/opt/plex/config:/config" \ # Make sure the locations below are mounted before the container starts. Putting them in /etc/fstab works well. Repeat the line for all the media locations you have. -v "[path to your media on host machine e.g. /media/somedisk/music]:[path to your media in container e.g. /media/somedisk/music]" \ plexinc/pms-docker:plexpass This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ [Unit] Description=Plex Requires=docker.service After=network-online.target docker.service [Service] Restart=always ExecStartPre=/bin/bash -c 'while ! nslookup plex.tv 8.8.8.8 &> /dev/null ; do echo Cannot resolve plex.tv. Waiting... ; done' TimeoutSec=infinity ExecStart=/usr/bin/docker start -a plex ExecStop=/usr/bin/docker stop -t 2 plex [Install] WantedBy=multi-user.target