Skip to content

Settings

I-am-PUID-0 edited this page Sep 5, 2023 · 17 revisions

Deployment

pdrcrd allows for the simultaneous or individual deployment of plex_debrid and/or rclone_RD.

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

rclone_RD standalone deployment

version: "3.9"

services:
  pdrcrd:
    container_name: pdrcrd
    image: iampuid0/pdrcrd:latest  
    stdin_open: true # docker run -i
    tty: true        # docker run -t    
    volumes:
      - your/host/path/config:/config
      - your/host/path/log:/log
      - your/host/path/mnt:/data:shared
    environment:
      - TZ=
      - RD_API_KEY=
      - RCLONE_MOUNT_NAME=
      - RCLONE_DIR_CACHE_TIME=10s
    devices:
      - /dev/fuse:/dev/fuse:rwm
    cap_add:
      - SYS_ADMIN     
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges
#    restart: unless-stopped

plex_debrid standalone deployment

version: "3.9"

services:
  pdrcrd:
    container_name: pdrcrd
    image: iampuid0/pdrcrd:latest  
    stdin_open: true # docker run -i
    tty: true        # docker run -t    
    volumes:
      - your/host/path/config:/config
      - your/host/path/log:/log
    environment:
      - TZ=
      - RD_API_KEY=
      - PLEX_USER=
      - PLEX_TOKEN=
      - PLEX_ADDRESS=  
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges
#    restart: unless-stopped

plex_debrid w/ rclone_RD deployment

version: "3.9"

services:
  pdrcrd:
    container_name: pdrcrd
    image: iampuid0/pdrcrd:latest  
    stdin_open: true # docker run -i
    tty: true        # docker run -t    
    volumes:
      - your/host/path/config:/config
      - your/host/path/log:/log
      - your/host/path/mnt:/data:shared
    environment:
      - TZ=
      - RD_API_KEY=
      - RCLONE_MOUNT_NAME=
      - RCLONE_DIR_CACHE_TIME=10s
      - PLEX_USER=
      - PLEX_TOKEN=
      - PLEX_ADDRESS=
    devices:
      - /dev/fuse:/dev/fuse:rwm
    cap_add:
      - SYS_ADMIN     
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges
#    restart: unless-stopped

Example to access the rclone debrid mount from Plex

version: "3.9"

services:

  pdrcrd:
    container_name: pdrcrd
    image: iampuid0/pdrcrd:latest  
    stdin_open: true # docker run -i
    tty: true        # docker run -t    
    volumes:
      - your/host/path/config:/config
      - your/host/path/log:/log
      - your/host/path/mnt:/data:shared
    environment:
      - TZ=
      - RD_API_KEY=
      - RCLONE_MOUNT_NAME=
      - RCLONE_DIR_CACHE_TIME=10s
    devices:
      - /dev/fuse:/dev/fuse:rwm
    cap_add:
      - SYS_ADMIN     
    security_opt:
      - apparmor:unconfined    
      - no-new-privileges
#    restart: unless-stopped

  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 pdrcrd for the debrid 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
      pdrcrd: # set to the name of the container running rclone_RD
        condition: service_healthy  

Automatic Updates

To enable automatic updates for plex_debrid, utilize the AUTO_UPDATE environment variable. This will automatically update plex_debrid to the latest version on startup and at the interval specified by AUTO_UPDATE_INTERVAL. No values are required for AUTO_UPDATE.

The default value for AUTO_UPDATE_INTERVAL is 24 hours. If you would like to change this, you can do so by uncommenting the AUTO_UPDATE_INTERVAL variable in your docker-compose.yml file and setting the value to the number of hours you would like to wait between updates.

The automatic update is performed by comparing the installed version with the version available on GitHub. If a delta exists, it continues by pulling the latest version of plex_debrid from GitHub and replacing the existing plex_debrid container files. This will not affect any of your settings or configuration.

plex_debrid will be restarted automatically after the update is complete. As such, if you have any active scrapes running in plex_debrid, they will be interrupted and will be restarted once plex_debrid reloads. However, due to the lack of a caching feature within plex_debrid for items that have not exceeded their retry limit, the retry count will revert to 0 for any items that were in the process of being scraped when the update occurred. This means that any items that were in the process of being scraped when the update occurred will be re-scraped from the beginning. This is a known issue and will be addressed in a future update.

The benefit of this automatic update feature is that you will always be running the latest version of plex_debrid. This will ensure you always take advantage of the latest features and bug fixes. It also means that the container will not need to be rebuilt or restarted by pulling a new image when a new version of plex_debrid is released. This will save you time and bandwidth, but most importantly, it will prevent the rclone_RD mount from being reset and severing the connection to your Plex server. So, the Plex server won't need to be restarted because of applying updates for the inbuilt applications.

Healthchecks

pdrcrd has a built-in healthcheck function for monitoring through docker and with the standard output (stdout).

The helathcheck will monitor the state of plex_debrid and rclone_RD in any of the deployment states.

Deployment plex_debrid healthcheck rclone_RD healthcheck Indicators
rclone_RD Standalone ✔️ If the rclone_RD mount is inaccessible, a message will appear in the CLI, and the docker status will change to unhealthy
plex_debrid Standalone ✔️ If the plex_debrid process is inaccessible, a message will appear in the CLI, and the docker status will change to unhealthy
plex_debrid w/ rclone_RD ✔️ ✔️ A combination of the above indicators dependent upon the type of failure

Use of .env file for setting Environment Variables

If you would like to utilize a .env file to set the environment variables, you can do so by following the format below and saving the file in your config directory. NOTE: Be sure to remove any unused environment variables from the .env file before deploying.

TZ=
RD_API_KEY=
RCLONE_MOUNT_NAME=
RCLONE_LOG_LEVEL=
RCLONE_LOG_FILE=
RCLONE_DIR_CACHE_TIME=
RCLONE_CACHE_DIR=
RCLONE_VFS_CACHE_MODE=
RCLONE_VFS_CACHE_MAX_SIZE=
RCLONE_VFS_CACHE_MAX_AGE=
PLEX_USER=
PLEX_TOKEN=
PLEX_ADDRESS=
SHOW_MENU=
PD_LOGFILE=
AUTO_UPDATE=
AUTO_UPDATE_INTERVAL=

Duplicate Cleanup

The duplicate cleanup process will automatically identify any duplicates that exist in two separate directories, the rclone mount used for the debris service and any other directory location. It then deletes the duplicates from the rclone mount used for the debris service, preserving the files from any other directory.

To utilize the duplicate cleanup, ensure that DUPLICATE_CLEANUP=true and the following environment variables are set in the docker-compose file RCLONE_MOUNT_NAME, PLEX_TOKEN, & PLEX_ADDRESS.

Given that the RCLONE_MOUNT_NAME environment variable is required for this feature and that it is also the trigger to enable rclone_RD deployment within pdrcrd, the only options for deployment are the rclone_RD standalone deployment or the plex_debrid w/ rclone_RD deployment

The best deployment is in conjunction with the rclone_RD standalone deployment configuration.

Ensure that the rclone_RD mount name is visible within Plex. I.e., If the mount name is "realdebrid," it must appear within the plex library structure.

NOTE: The duplicate cleanup function has not been widely tested to account for all possible configurations and should be monitored during the first use to ensure the desired results occur. Testing has been conducted on several configurations; however, the potential for deletion of files could still exist. A sample process for monitoring the duplicate cleanup function is described below.

  1. From within Plex, follow the process for finding duplicates in the plex shows library.

  2. Sort the duplicates in alphabetical order (By Show), then select the first duplicate and follow the process for getting the metadata

  3. Confirm that the duplicate files associated with step 2 are within different directories. One of which should have the rclone mount name within the file's directory path.

  4. View the XML information as described in the link provided in Step 2.

  5. Configure the duplicate cleanup interval to a short period, e.g., 10-15 minutes, so that the process will execute while you're viewing the duplicate identified in Step 2.

  6. Start rclone_RD with pdrcrd, restart Plex, and navigate back to the duplicate identified in Step 2 or refresh your browser.

  7. View the output of pdrcrd while watching the duplicate within Plex.

  8. Once the duplicate cleanup process starts, it will list all the duplicates for the TV/Shows section first. It will then begin to delete those duplicates before moving on to the Movies section. Ensure that the duplicate identified in Step 2 has been listed by the duplicate cleanup process list of duplicates to delete.

  9. Be prepared to stop pdrcrd.

  10. Once the duplicate identified in Step 2 is listed as being deleted by the duplicate cleanup process, you can stop pdrcrd.

  11. Within Plex, refresh or find the item that was identified in Step 2 and "Get Info" or "View XML" again to confirm that the files previously listed no longer contain the rclone_RD mount name in the directory path of the file.

  12. If Step 11 fails to delete the appropriate file or other issues occur, please report it in the GitHub Issues.

Singular or Multipule rclone_RD debrid service mounts

The RD_API_KEY & AD_API_KEY dictate how rclone_RD and plex_debrid are to be configurated at startup. If a single debrid service API key is supplied, then the supplied RCLONE_MOUNT_NAME value and API key will be used to set up the appropriate mount. Additionally, the single debrid service API key, along with the appropriate debrid service, will be applied within the plex_debrid settings.json file.

If both the RD_API_KEY & AD_API_KEY are supplied, then the supplied RCLONE_MOUNT_NAME value will be appended with _RD & _AD to denote the individual mounts. Additionally, both debrid services will be added to the plex_debrid settings.json file.