Debrid Media Bridge (DMB)

repository·master·Indexed 43 days ago

https://github.com/i-am-puid-0/dmb

An all-in-one, containerized platform for managing and automating media workflows using premium debrid services like Real-Debrid. DMB unifies tools such as Riven, Zurg, and Plex Debrid into a single Docker deployment environment. Note: This project is deprecated; the recommended successor is DUMB (Debrid Unlimited Media Bridge). Version 6.15.2.

Tokens
5.7K
Snippets
11
Records
15
Agent score
53%

What's inside DMB

  1. Important: Debrid Media Bridge is Deprecated

    master

    ⚠️ Project Status: Deprecated

    Debrid Media Bridge (DMB) is no longer under active development and will not receive new features or ongoing support. While it may continue to function, it is highly recommended to migrate to its successor.

    ➡️ Recommended Successor: DUMB (Debrid Unlimited Media Bridge)

    DUMB is a consolidated media orchestration platform that supersedes DMB by providing integrated service orchestration, automation, and operational control in a single, actively maintained platform. It includes support for:

    • Media Servers: Plex, Jellyfin, Emby
    • Arr Ecosystem: Sonarr, Radarr, Lidarr, Prowlarr, etc.
    • Debrid/Usenet Tooling: CLI Debrid, Riven, Decypharr, etc.
    • Storage: rclone, Zurg
    • Databases: PostgreSQL, pgAdmin
  2. Deploy DMB using Docker Compose

    master

    DMB is an All-In-One (AIO) Docker image. Use the following docker-compose.yml template as a starting point for deployment.

    Key Configuration Notes:

    • Volumes: Ensure you map the host paths (e.g., /home/username/docker/DMB/...) to the correct container paths to persist data for components like PostgreSQL, Riven, and Zilean.
    • Mount Propagation: The volume /mnt/debrid must use the :rshared flag to allow rclone mounts to propagate correctly.
    • Privileges: The container requires SYS_ADMIN capabilities and access to /dev/fuse to support FUSE-based mounts.
    • Networking: If RealDebrid blocks your IP address, you can attach the container to a VPN container (like gluetun) using network_mode: container:gluetun.
    services:
      DMB:
        container_name: DMB
        image: iampuid0/dmb:latest                                       ## Optionally, specify a specific version of DMB w/ image: iampuid0/dmb:2.0.0
        stop_grace_period: 30s                                           ## Adjust as need to allow for graceful shutdown of the container
        shm_size: 128mb                                                  ## Increased for PostgreSQL
        stdin_open: true                                                 ## docker run -i
        tty: true                                                        ## docker run -t
        volumes:
          - /home/username/docker/DMB/config:/config                     ## 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.
          - /home/username/docker/DMB/log:/log                           ## Location for logs
          - /home/username/docker/DMB/Zurg/RD:/zurg/RD                   ## Location for Zurg RealDebrid active configuration
          - /home/username/docker/DMB/Riven/data:/riven/backend/data     ## Location for Riven backend data
          - /home/username/docker/DMB/PostgreSQL/data:/postgres_data     ## Location for PostgreSQL database
          - /home/username/docker/DMB/pgAdmin4/data:/pgadmin/data        ## Location for pgAdmin 4 data
          - /home/username/docker/DMB/Zilean/data:/zilean/app/data       ## Location for Zilean data
          - /home/username/docker/DMB/plex_debrid:/plex_debrid/config    ## Location for plex_debrid data
          - /home/username/docker/DMB/cli_debrid:/cli_debrid/data        ## Location for cli_debrid data
          - /home/username/docker/DMB/phalanx_db:/phalanx_db/data        ## Location for phalanx_db data
          - /home/username/docker/DMB/decypharr:/decypharr               ## Location for decypharr data
          - /home/username/docker/DMB/mnt/debrid:/mnt/debrid:rshared    ## Location for all symlinks and rclone mounts     
        environment:
          - TZ=
          - PUID=
          - PGID=
        # network_mode: container:gluetun                               ## Example to attach to gluetun vpn container if realdebrid blocks IP address
        ports:
          - "3005:3005"                                                 ## DMB Frontend
          - "3000:3000"                                                 ## Riven Frontend
          - "5050:5050"                                                 ## pgAdmin 4
          - "5000:5000"                                                 ## CLI Debrid Frontend      
          - "8282:8282"                                                 ## Decypharr Frontend         
        devices:
          - /dev/fuse:/dev/fuse:rwm
        cap_add:
          - SYS_ADMIN
        security_opt:
          - apparmor:unconfined
          - no-new-privileges
  3. Integrate DMB with Plex via Docker Compose

    master

    To use DMB mounts in a Plex container, you must ensure the Plex server starts only after the rclone mount (provided by DMB) is healthy.

    Key Requirements:

    1. Dependency: Use depends_on with condition: service_healthy to delay Plex startup until the DMB container is ready.
    2. Volume Sharing: The DMB mount location (e.g., /mnt/debrid) must be shared to the Plex container.
    3. Library Management: Do not add the raw rclone mount location directly to the Plex library. Instead, add the symlink directories (e.g., from Riven) that are shared to the Plex container.
    4. Permissions: Ensure PLEX_UID and PLEX_GID match the PUID and PGID used by DMB.
    services:
      plex:
        image: plexinc/pms-docker:latest
        container_name: plex
        devices:
          - /dev/dri:/dev/dri
        volumes:
          - /home/username/docker/plex/library:/config
          - /home/username/docker/plex/transcode:/transcode
          - /home/username/docker/DMB/mnt/debrid:/mnt/debrid    ## mount location from DMB must be shared to Plex container. Add the symlinks directories to the Plex Libraries 
        environment:
          - TZ=
          - PLEX_UID=                                           ## Same as PUID
          - PLEX_GID=                                           ## Same as PGID
          - PLEX_CLAIM=claimToken                               ## Need for the first run of Plex - get claimToken here https://www.plex.tv/claim/
        ports:
          - "32400:32400"
        healthcheck:
          test: curl --connect-timeout 15 --silent --show-error --fail http://localhost:32400/identity
          interval: 1m00s
          timeout: 15s
          retries: 3
          start_period: 1m00s
        depends_on:
          DMB:
            condition: service_healthy
            restart: true
  4. Configure DMB Environment Variables

    master

    DMB requires specific environment variables for user permissions and localization. These can be set via the -e flag in Docker, within the environment: section of a docker-compose.yml file, or using a .env file in the config directory.

    PUID=1000
    PGID=1000
    TZ=Area/Location
  5. Start the Debrid Media Bridge service

    master

    The main() function serves as the primary entrypoint for the Debrid Media Bridge (DMB) service. When executed, it performs the following lifecycle steps:

    1. Initialization: Loads configuration, initializes dependencies, and sets up the ProcessHandler and Update manager.
    2. API Service: If enabled in the configuration (dmb.api_service.enabled), it starts the FastAPI process.
    3. User Management: Attempts to create the required system user.
    4. Component Setup & Auto-Updates: Iterates through enabled components (Frontend, Zurg instances, Rclone instances, Postgres, PGAdmin, Zilean, Plex-Debrid, Phalanx DB, CLI tools, Riven, and Decypharr) to perform setup and trigger auto-updates based on their individual auto_update configuration.
    5. Healthcheck: Spawns a background daemon thread that executes healthcheck.py every 60 seconds to monitor service health.
    6. Persistence: Enters a perpetual wait state to keep the service running.
    if __name__ == "__main__":
        main()
  6. Deploy DMB using Docker Compose

    master

    Use the following docker-compose.yml structure to deploy the DMB service. This configuration includes support for volume persistence, environment variables for user permissions, and specific device requirements for FUSE mounts.

    services:
      DMB:
        container_name: DMB
        image: iampuid0/dmb:latest
        stop_grace_period: 30s
        shm_size: 128mb
        stdin_open: true
        tty: true
        volumes:
          - /home/username/docker/DMB/config:/config
          - /home/username/docker/DMB/log:/log
          - /home/username/docker/DMB/Zurg/RD:/zurg/RD
          - /home/username/docker/DMB/Riven/data:/riven/backend/data
          - /home/username/docker/DMB/PostgreSQL/data:/postgres_data
          - /home/username/docker/DMB/pgAdmin4/data:/pgadmin/data
          - /home/username/docker/DMB/Zilean/data:/zilean/app/data
          - /home/username/docker/DMB/plex_debrid:/plex_debrid/config
          - /home/username/docker/DMB/cli_debrid:/cli_debrid/data
          - /home/username/docker/DMB/phalanx_db:/phalanx_db/data
          - /home/username/docker/DMB/decypharr:/decypharr
          - /home/username/docker/DMB/mnt/debrid:/mnt/debrid:rshared
        environment:
          - TZ=
          - PUID=
          - PGID=
        ports:
          - "3005:3005"
          - "3000:3000"
          - "5050:5050"
          - "5000:5000"
          - "8282:8282"
        devices:
          - /dev/fuse:/dev/fuse:rwm
        cap_add:
          - SYS_ADMIN
        security_opt:
          - apparmor:unconfined
          - no-new-privileges
  7. Route DMB traffic through a VPN (Gluetun)

    master

    If RealDebrid blocks your IP address, you can route the DMB container through a VPN container (e.g., gluetun) by setting the network_mode to container:gluetun. Note that when using this mode, you must manage port mappings on the VPN container instead of the DMB container.

        # network_mode: container:gluetun
  8. Deployment Restrictions for DMB

    master

    ⚠️ Docker Desktop Limitation

    Docker Desktop CANNOT be used to run DMB. This is because Docker Desktop does not support the mount propagation required for rclone mounts.

    💡 Windows Users

    To run DMB on Windows, you must use WSL2 (Windows Subsystem for Linux). Refer to the DMB documentation for specific alternative deployment options for WSL2.

  9. Configure DMB environment variables and volumes

    master

    Environment Variables

    • TZ: Set the system timezone.
    • PUID: Set the User ID for file permissions.
    • PGID: Set the Group ID for file permissions.

    Volume Mappings

    Ensure you map the following host paths to maintain persistence:

    • /config: Configuration files. Placing a Zurg config.yml or Zurg app here overrides default startup settings.
    • /log: Application logs.
    • /zurg/RD: Zurg RealDebrid active configuration.
    • /riven/backend/data: Riven backend data.
    • /postgres_data: PostgreSQL database.
    • /pgadmin/data: pgAdmin 4 data.
    • /zilean/app/data: Zilean data.
    • /plex_debrid/config: plex_debrid data.
    • /cli_debrid/data: cli_debrid data.
    • /phalanx_db/data: phalanx_db data.
    • /decypharr: decypharr data.
    • /mnt/debrid: Symlinks and rclone mounts (use :rshared mode).
  10. Configure enabled components and auto-updates

    master

    The DMB service uses a configuration manager to determine which sub-services and external tools to manage. For each component, you can specify if it is enabled and whether it should undergo auto_update.

    Supported component keys in the configuration include:

    • dmb.api_service (includes enabled and frontend settings)
    • zurg.instances (each instance can have enabled, process_name, and auto_update)
    • rclone.instances (each instance can have enabled, mount_name, and process_name)
    • postgres (enabled, process_name)
    • pgadmin (enabled, process_name)
    • zilean (enabled, process_name, auto_update)
    • plex_debrid (enabled, process_name, auto_update)
    • phalanx_db (enabled, process_name, auto_update)
    • cli_battery (enabled, process_name)
    • cli_debrid (enabled, process_name, auto_update)
    • riven_backend (enabled, process_name, auto_update)
    • riven_frontend (enabled, process_name, auto_update)
    • decypharr (enabled, process_name)

    Note: For rclone instances, a mount_name is required if the instance is enabled.

  11. DMB Service Ports Reference

    master

    The following ports are exposed by the DMB container for various frontend interfaces. Ensure these are mapped correctly in your Docker configuration.

    ports:
      - "3005:3005"  # DMB Frontend
      - "3000:3000"  # Riven Frontend
      - "5050:5050"  # pgAdmin 4
      - "5000:5000"  # CLI Debrid Frontend
      - "8282:8282"  # Decypharr Frontend
  12. Reference: DMB Required Environment Variables

    master

    The following environment variables are required by the DMB container:

    | Variable | Default | Description |
    | --- | --- | --- |
    | `PUID` | `1000` | Your User ID |
    | `PGID` | `1000` | Your Group ID |
    | `TZ` | `(null)` | Your time zone listed as `Area/Location` |