Plex-Meta-Manager/docs/home/guides/docker.md

408 lines
12 KiB
Markdown
Raw Normal View History

2022-03-08 08:06:22 +00:00
# Docker Walkthrough
This article will walk you through getting Plex-Meta-Manager [PMM] set up and running via Docker. It will cover:
1. Installing Docker
2. Retrieving the image
3. Setting up the initial config file
4. Setting up a metadata file and creating a couple sample collections
5. Creating a docker container that will keep running in the background
The specific steps you will be taking:
1. Verify that Docker is installed and install it if not
2. Use `docker` to retrieve the PMM Docker image
3. Create a directory for your config files and learn how to tell Docker to use it
4. Gather two things that the script requires:
2022-10-13 06:40:29 +00:00
1. TMDb API Key
2. Plex URL and Token
5. Then, iteratively:
1. use `docker` to run the image
2. use a text editor to modify a couple of text files until you have a working config file and a single working metadata file.
Note that running a Docker container is inherently a pretty technical process. If you are unable or unwilling to learn the rudiments of using Docker, this may not be the tool for you.
If the idea of editing YAML files by hand is daunting, this may not be the tool for you. All the configuration of PMM is done via YAML text files, so if you are unable or unwilling to learn how those work, you should stop here.
Finally, this walkthrough is intended to give you a basic grounding in how to get the script running. It doesn't cover how to create your own collections, or how to add overlays, or any of the myriad other things PMM is capable of. It provides a simple "Getting Started" guide for those for whom the standard install instructions make no sense; presumably because you've never run a Docker container before.
2022-03-08 08:06:22 +00:00
## Prerequisites.
Anywhere you see
```
something like this
```
Thats a command youre going to type or paste into your terminal (OSX or Linux) or Powershell (Windows).
2022-12-13 21:12:59 +00:00
**IMPORTANT NOTES:**
2022-03-08 08:06:22 +00:00
2022-12-13 21:12:59 +00:00
* This walkthrough is going to be pretty pedantic. Im assuming youre reading it because you have no idea how to get a Docker container going, so Im proceeding from the assumption that you want to be walked through every little detail. Youre going to deliberately cause errors and then fix them as you go through it. This is to help you understand what exactly is going on behind the scenes so that when you see these sorts of problems in the wild you will have some background to understand whats happening. If I only give you the happy path walkthrough, then when you make a typo later on youll have no idea where that typo might be or why its breaking things.
2022-03-08 08:06:22 +00:00
2022-12-13 21:12:59 +00:00
* I am assuming you do not have any of these tools already installed. When writing this up I started with a brand new Windows 10 install.
2022-12-13 21:12:59 +00:00
* I'm also assuming you are doing this on a computer, not through a NAS interface or the like. You can do all this through something like the Synology NAS UI or Portainer or the like, but those aren't documented here. This uses the docker command line because it works the same on all platforms.
2022-12-13 21:12:59 +00:00
* You may want to take an hour to get familiar with Docker fundamentals with the [official tutorial](https://www.docker.com/101-tutorial/).
* DO NOT MAKE ANY CHANGES BELOW if you want this to just work. Don't change the docker image [`linuxserver.io` will not work for this, for example]; don't change the paths, etc.
2022-05-17 12:43:06 +00:00
2022-12-13 15:35:28 +00:00
### Prepare a small test library [optional]
```{include} wt/wt-test-library.md
```
### Starting up your terminal.
Since most of this is typing commands into a terminal, you'll need to have a terminal open.
````{tab} Linux
<br/>
If your Linux system is remote to your computer, connect to it via SSH. That SSH session is the terminal you will be using, so leave it open.
If you are running this on a desktop Linux machine, start up the Terminal application. That window will be the terminal you will type commands into throughout this walkthrough, so leave it open.
<br/>
````
````{tab} OS X:
Open the Terminal app; this window will be the place you type commands throughout this walkthrough, so leave it open. The Terminal app is in Applications -> Utilities.
You can also use iTerm or some other terminal app if you wish. If you don't know what that means, use Terminal.
<br/>
````
````{tab} Windows:
Use the Start menu to open PowerShell. This will be the window into which you type commands throughout this walkthrough, so leave it open.
<br/>
````
2022-03-08 08:06:22 +00:00
### Installing Docker.
To run Docker images, you need to have Docker installed. It is not typically installed on new Mac, Linux, or Windows machines.
2022-03-08 08:06:22 +00:00
The Docker install is discussed here: [Installing Docker](https://docs.docker.com/engine/install/)
Once you have Docker installed, test it at the command line with:
2022-03-08 08:06:22 +00:00
[type this into your terminal]
2022-03-08 08:06:22 +00:00
```
docker run --rm hello-world
```
You should see something that starts with:
```
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
```
If that doesn't work, stop here until you fix that. Diagnoing and repairing Docker install problems is out of the scope of this walkthrough.
2022-03-08 08:06:22 +00:00
---
#### Important note on Docker images
2022-12-10 17:31:13 +00:00
This tutorial uses the official image, and you should, too. Don't change `meisnate12/plex-meta-manager` to the `linuxserver.io` image or any other; other images may have [idiosyncracies](images.md) that will prevent this walkthrough from working. The official image *will* behave exactly as documented below. Others very possibly won't.
2022-03-08 08:06:22 +00:00
The great thing about Docker is that all the setup you'd have to do to run PMM is already done inside the docker image.
2022-03-08 08:06:22 +00:00
That means we can just jump right into running it. At the command prompt, type:
```
docker run --rm meisnate12/plex-meta-manager --run
```
This is going to fail with an error. That's expected.
2022-05-17 12:43:06 +00:00
2022-03-08 08:06:22 +00:00
You should see something like this:
```
Unable to find image 'meisnate12/plex-meta-manager:latest' locally
latest: Pulling from meisnate12/plex-meta-manager
7d63c13d9b9b: Already exists
6ad2a11ca37b: Already exists
8076cdef4689: Pull complete
0ba90f5a7dd0: Pull complete
27c191df269f: Pull complete
c75e4c0924fa: Pull complete
ed6716577767: Pull complete
0547721ab7a3: Pull complete
ea4d35bce959: Pull complete
Digest: sha256:472be179a75259e07e68a3da365851b58c2f98383e02ac815804299da6f99824
Status: Downloaded newer image for meisnate12/plex-meta-manager:latest
Config Error: config not found at //config
```
That error means you dont have a config file, but we know that most everything is in place to run the image.
### Setting up a volume map
PMM, inside that Docker container, can only see other things *inside the container*. We want to add our own files for config and metadata, so we need to set something up that lets PMM see files we create *outside* the container. This is called a "volume map".
Go to your home directory and create a new directory:
[type this into your terminal]
2022-03-08 08:06:22 +00:00
```
cd ~
mkdir plex-meta-manager
```
cd into that directory and create another directory:
2022-03-08 08:06:22 +00:00
[type this into your terminal]
2022-03-08 08:06:22 +00:00
```
cd ~/plex-meta-manager
mkdir config
2022-03-08 08:06:22 +00:00
```
get the full path:
[type this into your terminal]
2022-03-08 08:06:22 +00:00
```
pwd
```
This will display a full path:
````{tab} Linux
```
/home/YOURUSERNAME/plex-meta-manager
```
````
2022-12-13 21:12:59 +00:00
````{tab} OS X
```
/Users/YOURUSERNAME/plex-meta-manager
```
````
2022-12-13 21:12:59 +00:00
````{tab} Windows
```
C:\Users\YOURUSERNAME\plex-meta-manager
```
````
2022-03-08 08:06:22 +00:00
Add "config" onto the end of that to get the host path to your config directory, for example:
````{tab} Linux
```
/home/YOURUSERNAME/plex-meta-manager/config
```
````
2022-12-13 21:12:59 +00:00
````{tab} OS X
```
/Users/YOURUSERNAME/plex-meta-manager/config
```
````
2022-12-13 21:12:59 +00:00
````{tab} Windows
```
C:\Users\YOURUSERNAME\plex-meta-manager\config
```
````
2022-03-08 08:06:22 +00:00
You'll need to add this to the docker command every time you run it, like this:
2022-03-08 08:06:22 +00:00
````{tab} Linux
```
docker run --rm -it -v "/home/YOURUSERNAME/plex-meta-manager/config:/config:rw" meisnate12/plex-meta-manager
```
````
2022-12-13 21:12:59 +00:00
````{tab} OS X
```
docker run --rm -it -v "/Users/YOURUSERNAME/plex-meta-manager/config:/config:rw" meisnate12/plex-meta-manager
```
````
2022-12-13 21:12:59 +00:00
````{tab} Windows
```
docker run --rm -it -v "C:\Users\YOURUSERNAME\plex-meta-manager\config:/config:rw" meisnate12/plex-meta-manager
```
````
2022-03-08 08:06:22 +00:00
If you run that command now it will display a similar error to before, but without all the image loading:
```
$ docker run --rm -it -v "/Users/mroche/plex-meta-manager/config:/config:rw" meisnate12/plex-meta-manager --run
2022-03-08 08:06:22 +00:00
Config Error: config not found at //config
```
Note that I show the example path there.
<details>
<summary>Why did we create that `config' directory?</summary>
2022-03-08 08:06:22 +00:00
2023-04-08 01:47:47 +00:00
This was done so that from here on in the instructions match between this walkthrough and the [Local walkthrough](local).
2022-03-08 08:06:22 +00:00
</details>
### Create a directory to quiet an error later
2022-03-08 08:06:22 +00:00
The default config file contains a reference to a directory that will show an error in the output later. That error can safely be ignored, but it causes some confusion with new users from time to time.
2022-03-08 08:06:22 +00:00
We'll create it here so the error doesn't show up later.
2022-03-08 08:06:22 +00:00
````{tab} Linux
[type this into your terminal]
2022-03-08 08:06:22 +00:00
```
mkdir config/assets
2022-03-08 08:06:22 +00:00
```
````
2022-12-13 21:12:59 +00:00
````{tab} OS X
[type this into your terminal]
2022-03-08 08:06:22 +00:00
```
mkdir config/assets
```
````
2022-12-13 21:12:59 +00:00
````{tab} Windows
[type this into your terminal]
```
mkdir config\assets
```
````
2022-03-08 08:06:22 +00:00
### Setting up the initial config file
2022-03-08 08:06:22 +00:00
2022-12-10 17:31:13 +00:00
```{include} wt/wt-01-basic-config.md
```
2022-03-08 08:06:22 +00:00
#### Editing the config template
2022-03-08 08:06:22 +00:00
First, make a copy of the template:
2022-03-08 08:06:22 +00:00
````{tab} Linux
Get a copy of the template to edit [type this into your terminal]:
2022-03-08 08:06:22 +00:00
```
curl -fLvo config/config.yml https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/config/config.yml.template
2022-03-08 08:06:22 +00:00
```
````
2022-12-13 21:12:59 +00:00
````{tab} OS X
Get a copy of the template to edit [type this into your terminal]:
2022-03-08 08:06:22 +00:00
```
curl -fLvo config/config.yml https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/config/config.yml.template
2022-03-08 08:06:22 +00:00
```
````
2022-12-13 21:12:59 +00:00
````{tab} Windows
Go to [this URL](https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/config/config.yml.template) using a web browser; choose the "Save" command, then save the file at:
2022-03-08 08:06:22 +00:00
```
C:\Users\YOURUSERNAME\plex-meta-manager\config\config.yml
```
````
2022-03-08 08:06:22 +00:00
Now open the copy in an editor:
2022-03-08 08:06:22 +00:00
```{include} wt/wt-editor.md
```
2022-03-08 08:06:22 +00:00
2022-12-10 17:31:13 +00:00
```{include} wt/wt-02-config-bad-library.md
```
2022-03-08 08:06:22 +00:00
#### Testing the config file
2022-03-08 08:06:22 +00:00
Save the file:
2022-03-08 08:06:22 +00:00
```{include} wt/wt-save.md
```
2022-03-08 08:06:22 +00:00
Then run the script again:
```{include} wt/wt-run-docker.md
2022-03-08 08:06:22 +00:00
```
2022-12-10 17:31:13 +00:00
```{include} wt/wt-03-lib-err-and-fix.md
```
### Creating a few sample collections.
```{include} wt/wt-04-default-intro.md
```
So let's run the script and see this happen:
```{include} wt/wt-run-docker.md
```
```{include} wt/wt-04b-default-after.md
```
### Setting up a metadata file and creating a few sample collections.
```{include} wt/wt-05-local-file.md
2022-03-08 08:06:22 +00:00
```
Save the file:
2022-03-08 08:06:22 +00:00
```{include} wt/wt-save.md
2022-03-08 08:06:22 +00:00
```
Then run the script again:
2022-04-06 20:47:42 +00:00
```{include} wt/wt-run-docker.md
```
2022-03-08 08:06:22 +00:00
2022-12-10 17:31:13 +00:00
```{include} wt/wt-06-local-after.md
```
2022-03-08 08:06:22 +00:00
2022-12-10 17:31:13 +00:00
### Adding Overlays to movies.
2022-03-08 08:06:22 +00:00
2022-12-10 17:31:13 +00:00
```{include} wt/wt-07-overlay-add.md
```
2022-03-08 08:06:22 +00:00
Save the file:
```{include} wt/wt-save.md
```
2022-03-08 08:06:22 +00:00
Then run the script again:
```{include} wt/wt-run-docker.md
2022-12-10 17:31:13 +00:00
```
```{include} wt/wt-08-overlay-after.md
2022-03-08 08:06:22 +00:00
```
2022-12-10 17:31:13 +00:00
```{include} wt/wt-09-next-steps.md
2022-03-08 08:06:22 +00:00
```
2022-12-10 20:31:02 +00:00
## Other Topics
2022-12-10 17:31:13 +00:00
2022-12-10 20:31:02 +00:00
### Scheduling
2022-03-08 08:06:22 +00:00
2022-12-10 20:31:02 +00:00
```{include} wt/wt-10-scheduling.md
2022-03-08 08:06:22 +00:00
```
2022-12-10 17:31:13 +00:00
### I want to use the develop branch
Add the `develop` tag to the image name in your run command [or wherever you specify the image in your environment]
```
docker run --rm -it -v "PMM_PATH_GOES_HERE:/config:rw" meisnate12/plex-meta-manager:develop --run
^^^^^^^
```
This may not work if you are not using the official image; for example, it does not work with the lsio image.
### I want to use the nightly branch
Add the `nightly` tag to the image name in your run command [or wherever you specify the image in your environment]
```
docker run --rm -it -v "PMM_PATH_GOES_HERE:/config:rw" meisnate12/plex-meta-manager:nightly --run
^^^^^^^
```
This may not work if you are not using the official image; for example, it does not work with the lsio image.
2022-12-10 20:31:02 +00:00
### I want to ensure I am using the master branch
2022-12-10 17:31:13 +00:00
Add the `latest` tag to the image name in your run command [or wherever you specify the image in your environment]
```
docker run --rm -it -v "PMM_PATH_GOES_HERE:/config:rw" meisnate12/plex-meta-manager:latest --run
^^^^^^
```
This is the only version tag supplied by the lsio image.