Skip to content

Setup Guides

I-am-PUID-0 edited this page Feb 23, 2024 · 8 revisions

Complete Beginners Guide

Note: This guide will use Ubuntu, so the commands used may differ if using a different Linux distro.

Install Docker

From Ubuntu, install Docker by pasting the following into the Ubuntu Command Line Interface (CLI); follow the prompts.

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

If you receive the following prompt during the Docker install, then follow the steps here: Windows Setup Guide (Docker/WSL)

WSL DETECTED: We recommend using Docker Desktop for Windows.
Please get Docker Desktop from https://www.docker.com/products/docker-desktop/

With docker now installed, enter the following command:

docker compose version

If the output is similar to the below, then docker and docker compose were successfully installed:

ubuntu@pd_zurg:~$ docker compose version
Docker Compose version v2.24.2

Define the directory structure

Note: If you already have a directory structure you'd like to use, then you can skip this step.

Create a directory for docker in your user directory and change directories to docker.

cd ~ && mkdir docker && cd docker

Create the pd_zurg directories.

mkdir -p pd_zurg/config pd_zurg/log pd_zurg/cache pd_zurg/RD pd_zurg/mnt

Download and edit the docker-compose.yml

Download the latest docker-compose.yml from the GitHub repository with the following:

curl -O https://raw.githubusercontent.com/I-am-PUID-0/pd_zurg/master/docker-compose.yml

Download the docker-compose updater from the GitHub repository with the following:

curl -O https://raw.githubusercontent.com/I-am-PUID-0/pd_zurg/master/update_docker_compose.sh && chmod +x update_docker_compose.sh

Execute the update_docker_compose.sh and follow the prompts:

./update_docker_compose.sh

Start up the docker compose

sudo docker compose up -d
ubuntu@pd_zurg:~/docker$ sudo docker compose up -d
[+] Running 1/2
 ⠋ Network docker_default  Created                                                                                                                                                       1.1s 
 ✔ Container pd_zurg       Started  

Attach to the container

sudo docker attach pd_zurg

Note: Ensure that you press enter/return after attaching to the container to see the plex_debrid menu.

Detach from the running container

Press Ctrl + P followed by Ctrl + Q. This sequence sends a signal to Docker to detach from the container while leaving it running in the background. It's important to use this sequence rather than simply closing the terminal window or using Ctrl + C, as those actions might stop the container.

Remember, Ctrl + P + Ctrl + Q must be pressed in quick succession. You press Ctrl + P first, and while holding Ctrl, press Q. After this, you will be returned to your host terminal, and the container will continue to run in the background.

View docker container logs

To view the container logs, enter the following:

sudo docker container logs pd_zurg

Shutdown docker compose

sudo docker compose down
ubuntu@pd_zurg:~/docker$ sudo docker compose down
[+] Running 2/2
 ✔ Container pd_zurg       Removed                                                                                                                                                      10.4s 
 ✔ Network docker_default  Removed     

More to come!

Windows Setup Guide (Docker/WSL)

Note: Ensure that Docker Desktop is not installed; if so, uninstall and reboot before proceeding.

From the Microsoft store, install Windows Subsystem for Linux (WSL) From the Microsoft store, install Ubuntu 22.04 LTS Follow the setup to create your Ubuntu username and password.

From a Windows command prompt, paste the following:

cd C:\WINDOWS\system32

Then paste:

wsl --setdefault Ubuntu-22.04

From Windows apps, start Ubuntu 22.04 and past the following inside the terminal:

sudo apt update
sudo apt upgrade -y 
sudo mount --make-rshared / 

Note: sudo mount --make-rshared does not persist reboots, so it will need to be run each time WSL2 or Windows is restarted. Alternatively, see the Ubuntu systemd service guide for automatically executing the command on startup for Ubuntu.

Follow the Docker install guide.

Follow the standard docker process for creating the container or follow the Define the directory structure and the remainder of the Complete Beginners Guide

To access the mount on Windows: From the Ubuntu terminal, paste the following, including the punctuation:

explorer.exe .

A new file explorer window will appear; you’re now inside the Ubuntu directory structure

Navigate to the mount location and copy the full path from the explore window

From another file explorer window, click "This PC," then right-click in the space below the listed drives and select add a network location

In the pop-up, click next twice and past the mount location.

Follow the remaining prompted steps

Extra credit: install Portainer.

Deployment Options

pd_zurg allows for the simultaneous or individual deployment of plex_debrid and/or Zurg w/ rclone.

The below are provided as examples of the various deployment options.

Zurg w/ rclone standalone deployment

version: "3.8"

services:
  pd_zurg:
    container_name: pd_zurg
    image: iampuid0/pd_zurg:latest
    ## Optionally, specify a specific version of pd_zurg
    # image: iampuid0/pd_zurg:2.0.0
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    volumes:
      - /pd_zurg/config:/config
      - /pd_zurg/log:/log
      - /pd_zurg/cache:/cache
      - /pd_zurg/RD:/zurg/RD
      - /pd_zurg/AD:/zurg/AD   
      - /pd_zurg/mnt:/data:shared       
    environment:
      - TZ=
      - ZURG_ENABLED=true      
      - RD_API_KEY=
      - RCLONE_MOUNT_NAME=pd_zurg
    devices:
      - /dev/fuse:/dev/fuse:rwm
    cap_add:
      - SYS_ADMIN     
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges

plex_debrid standalone deployment

version: "3.8"

services:
  pd_zurg:
    container_name: pd_zurg
    image: iampuid0/pd_zurg:latest
    ## Optionally, specify a specific version of pd_zurg
    # image: iampuid0/pd_zurg:2.0.0
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    volumes:
      - /pd_zurg/config:/config
      - /pd_zurg/log:/log
    environment:
      - TZ=
      - RD_API_KEY=
      - PD_ENABLED=true
      - PLEX_USER=
      - PLEX_TOKEN=
      - PLEX_ADDRESS=

plex_debrid and Zurg w/ rclone deployment

version: "3.8"

services:
  pd_zurg:
    container_name: pd_zurg
    image: iampuid0/pd_zurg:latest
    ## Optionally, specify a specific version of pd_zurg
    # image: iampuid0/pd_zurg:2.0.0
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    volumes:
      - /pd_zurg/config:/config
      - /pd_zurg/log:/log
      - /pd_zurg/cache:/cache
      - /pd_zurg/RD:/zurg/RD
      - /pd_zurg/AD:/zurg/AD   
      - /pd_zurg/mnt:/data:shared       
    environment:
      - TZ=
      - ZURG_ENABLED=true      
      - RD_API_KEY=
      - RCLONE_MOUNT_NAME=pd_zurg
      - PD_ENABLED=true
      - PLEX_USER=
      - PLEX_TOKEN=
      - PLEX_ADDRESS=
    devices:
      - /dev/fuse:/dev/fuse:rwm
    cap_add:
      - SYS_ADMIN     
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges

Example to access the debrid service rclone mount from Plex

version: "3.8"

services:
  pd_zurg:
    container_name: pd_zurg
    image: iampuid0/pd_zurg:latest
    ## Optionally, specify a specific version of pd_zurg
    # image: iampuid0/pd_zurg:2.0.0
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    volumes:
      ## Location of configuration files. If a Zurg config.yml and/or Zurg app is placed here, it will be used to override the default configuration and/or app used at startup. 
      - /pd_zurg/config:/config
      ## Location for logs
      - /pd_zurg/log:/log
      ## Location for rclone cache if enabled
      - /pd_zurg/cache:/cache
      ## Location for Zurg RealDebrid active configuration
      - /pd_zurg/RD:/zurg/RD
      ## Location for Zurg AllDebrid active configuration -- when supported by Zurg     
      - /pd_zurg/AD:/zurg/AD   
      ## Location for rclone mount to host
      - /pd_zurg/mnt:/data:shared       
    environment:
      - TZ=
      ## Zurg Required Settings
      - ZURG_ENABLED=true      
      - RD_API_KEY=
      ## Rclone Required Settings
      - RCLONE_MOUNT_NAME=pd_zurg
      ## Plex Debrid Required Settings
      - PD_ENABLED=true
      ## To utilize plex_debrid with Plex, the following environment variables are required
      - PLEX_USER=
      - PLEX_TOKEN=
      - PLEX_ADDRESS=
    devices:
      - /dev/fuse:/dev/fuse:rwm
    cap_add:
      - SYS_ADMIN     
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges

  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    devices:
     - /dev/dri:/dev/dri   # For GPU transcoding
    volumes:
      - your/host/path/plex/library:/config
      - your/host/path/plex/transcode:/transcode
      - your/host/path/plex/media:/data
      - your/host/path/mnt:/rclone  # Same mount point as used in pd_zurg for the debrid rclone mount
    environment:
      - TZ=
      - PLEX_UID=
      - PLEX_GID=
      - PLEX_CLAIM=
    depends_on:  # Used to delay the startup of plex to ensure the rclone mount is available.
      pd_zurg: # set to the name of the container running rclone
        condition: service_healthy