From 0f990efd8699dd2151d27e1d2ac2f3dd6a59ba20 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Fri, 29 Jul 2022 17:59:21 -0400 Subject: [PATCH] feat: plex setup (#1) --- README.md | 8 +++++++- plex/.gitignore | 4 ++++ plex/README.md | 18 ++++++++++++++++++ plex/docker-compose.yml | 25 +++++++++++++++++++++++++ plex/script/bootstrap | 21 +++++++++++++++++++++ plex/script/start | 3 +++ 6 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 plex/.gitignore create mode 100644 plex/README.md create mode 100644 plex/docker-compose.yml create mode 100644 plex/script/bootstrap create mode 100644 plex/script/start diff --git a/README.md b/README.md index 9fbeed3..016d9ce 100644 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ -# spadinaistan \ No newline at end of file +# spadinaistan + +## Services + +|Service|Description| +|---|---| +|[Plex](./plex)|Plex media server| diff --git a/plex/.gitignore b/plex/.gitignore new file mode 100644 index 0000000..94d36d9 --- /dev/null +++ b/plex/.gitignore @@ -0,0 +1,4 @@ +*.env +media/**/* +transcode/**/* +database/**/* diff --git a/plex/README.md b/plex/README.md new file mode 100644 index 0000000..9d77a92 --- /dev/null +++ b/plex/README.md @@ -0,0 +1,18 @@ +# Plex + +## Setup + +*Requires `docker-compose`* + +Run `. script/bootstrap` to check that `docker-compose` is available and to create the required directory structure. + +Run `. script/start` to start the service. + +### First setup only + +Make sure to create a `plex.env` file containing: + +|Environment variable|Description| +|---|---| +|`ADVERTISE_IP`|Full address and port of the network entry point to advertise for Plex.| +|`PLEX_CLAIM`|Claim ID required to link the server to a Plex account| diff --git a/plex/docker-compose.yml b/plex/docker-compose.yml new file mode 100644 index 0000000..962e973 --- /dev/null +++ b/plex/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.7' +services: + plex: + image: plexinc/pms-docker:1.27.2.5929-a806c5905 + restart: always + container_name: plex-server + hostname: plexserver.spadinaistan.local + ports: + - "32400:32400/tcp" + - "32469:32469/tcp" + - "3005:3005/tcp" + - "8324:8324/tcp" + - "1900:1900/udp" + - "32410:32410/udp" + - "32412:32412/udp" + - "32413:32413/udp" + - "32414:32414/udp" + env_file: + - plex.env + environment: + - TZ=America/Toronto + volumes: + - ./database:/config + - ./transcode:/transcode + - ./media:/data diff --git a/plex/script/bootstrap b/plex/script/bootstrap new file mode 100644 index 0000000..64eaaf3 --- /dev/null +++ b/plex/script/bootstrap @@ -0,0 +1,21 @@ +#!/bin/bash + +# Bootstrap for Plex +# +# Verifies that docker-compose is available and that the required directories +# are present. + +if ! [ -x "$(command -v docker-compose)" ]; then + echo "👎 docker-compose isn't available but is required." + exit 1 +fi + +echo "✅ docker-compose $(docker-compose version --short) found." + +# Required directory structure, these will be mapped to locations in the Plex +# container. + +mkdir ./{media,database,transcode} -vp + +echo "✅ directory structure ready" +echo "✨ Good to go ✨" diff --git a/plex/script/start b/plex/script/start new file mode 100644 index 0000000..1cdf1e3 --- /dev/null +++ b/plex/script/start @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo docker-compose up -d