├── .dockerignore ├── .github ├── CODEOWNERS ├── linters │ └── ct.yaml ├── renovate.json └── workflows │ ├── helm.yaml │ └── test-lint.yaml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── README.md ├── charts └── plex-media-server │ ├── .helmignore │ ├── Chart.yaml │ ├── LICENSE │ ├── README.md │ ├── README.md.gotmpl │ ├── UPGRADE.md │ ├── ci │ └── ci-values.yaml │ ├── templates │ ├── NOTES.txt │ ├── _helpers.tpl │ ├── configmap-init-script.yaml │ ├── ingress.yaml │ ├── service.yaml │ ├── serviceaccount.yaml │ └── statefulset.yaml │ └── values.yaml ├── docker-compose-bridge.yml.template ├── docker-compose-host.yml.template ├── docker-compose-macvlan.yml.template ├── img └── plex-server.png ├── plex-unRAID.xml └── root ├── etc ├── cont-init.d │ ├── 40-plex-first-run │ ├── 45-plex-hw-transcode-and-connected-tuner │ └── 50-plex-update └── services.d │ └── plex │ ├── finish │ ├── run │ └── timeout-finish ├── healthcheck.sh ├── installBinary.sh ├── plex-common.sh └── plex_service.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | README.md 4 | docker-compose-bridge.yml.template 5 | docker-compose-macvlan.yml.template 6 | docker-compose-host.yml.template 7 | docker-compose.yml 8 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | charts/** @plexinc/team-operations 2 | -------------------------------------------------------------------------------- /.github/linters/ct.yaml: -------------------------------------------------------------------------------- 1 | target-branch: master 2 | chart-dirs: 3 | - charts 4 | validate-maintainers: false 5 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:recommended", 4 | ":disableDependencyDashboard", 5 | "helpers:pinGitHubActionDigests" 6 | ], 7 | "enabledManagers": [ 8 | "github-actions", 9 | "helm-requirements", 10 | "helm-values", 11 | "helmv3", 12 | "devcontainer", 13 | "docker-compose" 14 | ], 15 | "prConcurrentLimit": 5, 16 | "prCreation": "not-pending", 17 | "prHourlyLimit": 1, 18 | "reviewersFromCodeOwners": true, 19 | "timezone": "Etc/UTC" 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/helm.yaml: -------------------------------------------------------------------------------- 1 | name: Helm 2 | 3 | # yamllint disable-line rule:truthy 4 | on: 5 | push: 6 | branches: 7 | - master 8 | paths: 9 | - 'charts/**' 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | 15 | changes: 16 | permissions: 17 | contents: read # for dorny/paths-filter to fetch a list of changed files 18 | pull-requests: read # for dorny/paths-filter to read pull requests 19 | runs-on: ubuntu-latest 20 | if: | 21 | (github.repository == 'plexinc/pms-docker') 22 | outputs: 23 | docs: ${{ steps.filter.outputs.docs }} 24 | charts: ${{ steps.filter.outputs.charts }} 25 | 26 | steps: 27 | - name: Checkout 28 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 29 | 30 | - name: Run Artifact Hub lint 31 | run: | 32 | wget https://github.com/artifacthub/hub/releases/download/v1.5.0/ah_1.5.0_linux_amd64.tar.gz 33 | echo 'ad0e44c6ea058ab6b85dbf582e88bad9fdbc64ded0d1dd4edbac65133e5c87da *ah_1.5.0_linux_amd64.tar.gz' | shasum -c 34 | tar -xzvf ah_1.5.0_linux_amd64.tar.gz ah 35 | ./ah lint -p charts/plex-media-server || exit 1 36 | rm -f ./ah ./ah_1.5.0_linux_amd64.tar.gz 37 | 38 | - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 39 | id: filter 40 | with: 41 | token: ${{ secrets.GITHUB_TOKEN }} 42 | filters: | 43 | charts: 44 | - 'charts/plex-media-server/Chart.yaml' 45 | - 'charts/plex-media-server/values.yaml' 46 | 47 | chart: 48 | name: Release Chart 49 | runs-on: ubuntu-latest 50 | 51 | permissions: 52 | contents: write # needed to write releases 53 | 54 | needs: 55 | - changes 56 | if: | 57 | (github.repository == 'plexinc/pms-docker') && 58 | (needs.changes.outputs.charts == 'true') 59 | 60 | steps: 61 | - name: Checkout master 62 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 63 | with: 64 | # Fetch entire history. Required for chart-releaser 65 | # see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896 66 | fetch-depth: 0 67 | 68 | - name: Setup 69 | shell: bash 70 | run: | 71 | git config --global user.name "$GITHUB_ACTOR" 72 | git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" 73 | 74 | - name: Helm Chart Releaser 75 | uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1 76 | env: 77 | CR_SKIP_EXISTING: "false" 78 | CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 79 | CR_RELEASE_NAME_TEMPLATE: "helm-chart-{{ .Version }}" 80 | with: 81 | charts_dir: charts 82 | -------------------------------------------------------------------------------- /.github/workflows/test-lint.yaml: -------------------------------------------------------------------------------- 1 | name: Lint and Test Charts 2 | 3 | # yamllint disable-line rule:truthy 4 | on: 5 | workflow_call: 6 | workflow_dispatch: 7 | pull_request: 8 | branches: 9 | - master 10 | paths: 11 | - 'charts/plex-media-server/**' 12 | 13 | env: 14 | KUBECONFORM_VERSION: v0.6.7 15 | 16 | jobs: 17 | docs: 18 | name: Bump Chart Version and Re-Generate Docs 19 | runs-on: ubuntu-latest 20 | permissions: 21 | contents: write 22 | steps: 23 | - uses: gabe565/setup-helm-docs-action@d5c35bdc9133cfbea3b671acadf50a29029e87c2 # v1 24 | 25 | - name: Checkout 26 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 27 | with: 28 | fetch-depth: 0 29 | ref: ${{ github.event.pull_request.head.ref }} 30 | 31 | - name: Set up chart-testing 32 | uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2 33 | 34 | # yamllint disable rule:line-length 35 | - name: Check if version bump is needed 36 | id: check_bump 37 | run: | 38 | set +e 39 | ct lint --config .github/linters/ct.yaml --check-version-increment --target-branch ${{ github.event.pull_request.base.ref }} | grep -q 'chart version not ok. Needs a version bump!' 40 | needsBump=$? 41 | 42 | if [ $needsBump -eq 0 ]; then 43 | echo "needsBump=true" >> "$GITHUB_OUTPUT" 44 | else 45 | echo "needsBump=false" >> "$GITHUB_OUTPUT" 46 | fi 47 | # yamllint enable rule:line-length 48 | 49 | - name: Cache binaries 50 | id: cache-bin 51 | if: ${{ steps.check_bump.outputs.needsBump == 'true' }} 52 | uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 53 | env: 54 | cache-name: cache-semver 55 | with: 56 | path: bin 57 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('bin/semver') }} 58 | restore-keys: | 59 | ${{ runner.os }}-build-${{ env.cache-name }}- 60 | ${{ runner.os }}-build- 61 | ${{ runner.os }}- 62 | 63 | - name: Setup semver 64 | if: ${{ steps.check_bump.outputs.needsBump == 'true' && steps.cache-bin.outputs.cache-hit != 'true' }} 65 | run: | 66 | mkdir -p bin 67 | wget -O bin/semver \ 68 | https://raw.githubusercontent.com/fsaintjacques/semver-tool/3.4.0/src/semver 69 | chmod +x bin/semver 70 | 71 | - name: Setup PATH 72 | if: ${{ steps.check_bump.outputs.needsBump == 'true' }} 73 | run: | 74 | echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH" 75 | 76 | - name: Compute version 77 | if: ${{ steps.check_bump.outputs.needsBump == 'true' }} 78 | id: get_version 79 | env: 80 | PATCH_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'chart: patch') }}" 81 | MINOR_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'chart: minor') }}" 82 | MAJOR_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'chart: major') }}" 83 | run: | 84 | current_ver=$(cat "charts/plex-media-server/Chart.yaml" | grep 'version:' | cut -d' ' -f2) 85 | 86 | BUMP_TYPE='' 87 | if [[ $MAJOR_LABEL == 'true' ]]; 88 | then 89 | BUMP_TYPE='major' 90 | elif [[ $MINOR_LABEL == 'true' ]]; 91 | then 92 | BUMP_TYPE='minor' 93 | elif [[ $PATCH_LABEL == 'true' ]]; 94 | then 95 | BUMP_TYPE='patch' 96 | else 97 | echo "::error title=Missing Label::Missing the chart versioning label" 98 | exit -1 99 | fi 100 | 101 | echo "running ${BUMP_TYPE} version bump" 102 | new_ver=$(semver bump "${BUMP_TYPE}" "$current_ver") 103 | echo "last=${current_ver}" >> "$GITHUB_OUTPUT" 104 | echo "new=${new_ver}" >> "$GITHUB_OUTPUT" 105 | 106 | # yamllint disable rule:line-length 107 | - name: Update Chart Version 108 | if: ${{ steps.check_bump.outputs.needsBump == 'true' }} 109 | shell: bash 110 | run: | 111 | sed -i "s/version: ${{ steps.get_version.outputs.last }}/version: ${{ steps.get_version.outputs.new }}/g" "charts/plex-media-server/Chart.yaml" 112 | # yamllint enable rule:line-length 113 | 114 | - name: Update Docs 115 | shell: bash 116 | run: | 117 | helm-docs --chart-search-root charts --chart-to-generate charts/plex-media-server 118 | 119 | # yamllint disable rule:line-length 120 | - name: Commit Changes 121 | env: 122 | message: ${{ steps.check_bump.outputs.needsBump == 'true' && format('to v{0}', steps.get_version.outputs.new) || 'documentation' }} 123 | run: | 124 | set +e 125 | git config user.email '<>' 126 | git config user.name github-actions 127 | if ! git diff-index --quiet HEAD; then 128 | git commit -m "chore: update $APP chart $message" --all 129 | git push origin "HEAD:$GITHUB_HEAD_REF" 130 | fi 131 | # yamllint enable rule:line-length 132 | 133 | lint-test: 134 | runs-on: ubuntu-latest 135 | steps: 136 | - name: Checkout 137 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 138 | with: 139 | fetch-depth: 0 140 | 141 | - name: Set up Helm 142 | uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4 143 | 144 | - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 145 | with: 146 | python-version: 3.x 147 | check-latest: true 148 | 149 | - name: Set up chart-testing 150 | uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2 151 | 152 | - name: Run chart-testing (list-changed) 153 | id: list-changed 154 | run: | 155 | changed=$(ct list-changed --config .github/linters/ct.yaml) 156 | if [[ -n "$changed" ]]; then 157 | echo "changed=true" >> "$GITHUB_OUTPUT" 158 | fi 159 | 160 | - name: Run chart-testing (lint) 161 | if: steps.list-changed.outputs.changed == 'true' 162 | run: ct lint --config .github/linters/ct.yaml 163 | 164 | - name: Cache kubeconform 165 | id: cache-kubeconform 166 | uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 167 | env: 168 | cache-name: cache-kubeconform 169 | with: 170 | path: bin 171 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.KUBECONFORM_VERSION }} 172 | restore-keys: | 173 | ${{ runner.os }}-build-${{ env.cache-name }}- 174 | ${{ runner.os }}-build- 175 | ${{ runner.os }}- 176 | 177 | # yamllint disable rule:line-length 178 | - name: Install kubeconform 179 | if: steps.cache-kubeconform.outputs.cache-hit != 'true' 180 | run: | 181 | mkdir -p "$GITHUB_WORKSPACE/bin" 182 | 183 | curl -sSLO \ 184 | "https://github.com/yannh/kubeconform/releases/download/${{ env.KUBECONFORM_VERSION }}/kubeconform-linux-amd64.tar.gz" && 185 | tar -xf "kubeconform-linux-amd64.tar.gz" && 186 | rm "kubeconform-linux-amd64.tar.gz" && 187 | mv kubeconform "$GITHUB_WORKSPACE/bin" 188 | # yamllint enable rule:line-length 189 | 190 | - name: Setup PATH 191 | run: | 192 | echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH" 193 | 194 | # yamllint disable rule:line-length 195 | - name: Run kubeconform 196 | id: kubeconform 197 | run: | 198 | app=plex-media-server 199 | helm template pms "charts/${app}" \ 200 | --namespace example \ 201 | --values "charts/${app}/ci/ci-values.yaml" \ 202 | --set 'pms.gpu.nvidia.enabled=true' | 203 | kubeconform \ 204 | -kubernetes-version=1.32.0 \ 205 | -schema-location default \ 206 | -strict \ 207 | -output tap 208 | # yamllint enable rule:line-length 209 | 210 | - name: Create kind cluster 211 | uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1 212 | if: steps.list-changed.outputs.changed == 'true' 213 | 214 | - name: Run chart-testing (install) 215 | run: ct install --config .github/linters/ct.yaml 216 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | docker-compose.yml 2 | 3 | test/ 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. 6 | 7 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 8 | 9 | ## Our Standards 10 | 11 | Examples of behavior that contributes to a positive environment for our community include: 12 | 13 | - Demonstrating empathy and kindness toward other people 14 | - Being respectful of differing opinions, viewpoints, and experiences 15 | - Giving and gracefully accepting constructive feedback 16 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 17 | - Focusing on what is best not just for us as individuals, but for the overall community 18 | 19 | Examples of unacceptable behavior include: 20 | 21 | - The use of sexualized language or imagery, and sexual attention or advances of any kind 22 | - Trolling, insulting or derogatory comments, and personal or political attacks 23 | - Public or private harassment 24 | - Publishing others' private information, such as a physical or email address, without their explicit permission 25 | - Publishing spam or promotional links 26 | - Other conduct which could reasonably be considered inappropriate in a professional setting 27 | 28 | ## Enforcement Responsibilities 29 | 30 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 31 | 32 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 33 | 34 | ## Scope 35 | 36 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. 37 | 38 | Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 39 | 40 | ## Enforcement 41 | 42 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at opensource@plex.tv. All complaints will be reviewed and investigated promptly and fairly. 43 | 44 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 45 | 46 | ## Enforcement Guidelines 47 | 48 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 49 | 50 | ### 1. Correction 51 | 52 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 53 | 54 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 55 | 56 | ### 2. Warning 57 | 58 | **Community Impact**: A violation through a single incident or series of actions. 59 | 60 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 61 | 62 | ### 3. Temporary Ban 63 | 64 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 65 | 66 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 67 | 68 | ### 4. Permanent Ban 69 | 70 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 71 | 72 | **Consequence**: A permanent ban from any sort of public interaction within the community. 73 | 74 | ## Attribution 75 | 76 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 77 | 78 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][mozilla coc]. 79 | 80 | For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][faq]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. 81 | 82 | [homepage]: https://www.contributor-covenant.org 83 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 84 | [mozilla coc]: https://github.com/mozilla/diversity 85 | [faq]: https://www.contributor-covenant.org/faq 86 | [translations]: https://www.contributor-covenant.org/translations 87 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ARG TARGETARCH 4 | ARG TARGETPLATFORM 5 | 6 | ARG DEBIAN_FRONTEND="noninteractive" 7 | ENV TERM="xterm" LANG="C.UTF-8" LC_ALL="C.UTF-8" 8 | 9 | ENTRYPOINT ["/init"] 10 | 11 | # Add user 12 | RUN useradd -U -d /config -s /bin/false plex && \ 13 | usermod -G users plex && \ 14 | \ 15 | # Setup directories 16 | mkdir -p \ 17 | /config \ 18 | /transcode \ 19 | /data 20 | 21 | RUN \ 22 | # Update and get dependencies 23 | apt-get update && \ 24 | apt-get install -y \ 25 | tzdata \ 26 | curl \ 27 | xmlstarlet \ 28 | uuid-runtime \ 29 | unrar && \ 30 | apt-get -y autoremove && \ 31 | apt-get -y clean && \ 32 | rm -rf /var/lib/apt/lists/* 33 | 34 | # Fetch and extract S6 overlay 35 | ARG S6_OVERLAY_VERSION=v2.2.0.3 36 | RUN if [ "${TARGETPLATFORM}" = 'linux/arm/v7' ]; then \ 37 | S6_OVERLAY_ARCH='armhf'; \ 38 | elif [ "${TARGETARCH}" = 'amd64' ]; then \ 39 | S6_OVERLAY_ARCH='amd64'; \ 40 | elif [ "${TARGETARCH}" = 'arm64' ]; then \ 41 | S6_OVERLAY_ARCH='aarch64'; \ 42 | fi \ 43 | && \ 44 | curl -J -L -o /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz && \ 45 | tar xzf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz -C / --exclude='./bin' && \ 46 | tar xzf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.gz -C /usr ./bin && \ 47 | rm -rf /tmp/* && \ 48 | rm -rf /var/tmp/* 49 | 50 | EXPOSE 32400/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp 51 | VOLUME /config /transcode 52 | 53 | ENV CHANGE_CONFIG_DIR_OWNERSHIP="true" \ 54 | HOME="/config" 55 | 56 | COPY root/ / 57 | 58 | # Save version and install 59 | ARG PLEX_DISTRO=debian 60 | ARG TAG=beta 61 | ARG URL= 62 | RUN /installBinary.sh 63 | 64 | HEALTHCHECK --interval=5s --timeout=2s --retries=20 CMD /healthcheck.sh || exit 1 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Official Docker container for Plex Media Server 2 | 3 | # plexinc/pms-docker 4 | 5 | With our easy-to-install Plex Media Server software and your Plex apps, available on all your favorite phones, tablets, streaming devices, gaming consoles, and smart TVs, you can stream your video, music, and photo collections any time, anywhere, to any device. 6 | 7 | ## Usage 8 | 9 | Before you create your container, you must decide on the type of networking you wish to use. There are essentially three types of networking available: 10 | 11 | - `bridge` (default) 12 | - `host` 13 | - `macvlan` 14 | 15 | The `bridge` networking creates an entirely new network within the host and runs containers within there. This network is connected to the physical network via an internal router and docker configures this router to forward certain ports through to the containers within. The `host` networking uses the IP address of the host running docker such that a container's networking appears to be the host rather than separate. The `macvlan` networking creates a new virtual computer on the network which is the container. For purposes of setting up a plex container, the `host` and `macvlan` are very similar in configuration. 16 | 17 | Using `host` or `macvlan` is the easier of the three setups and has the fewest issues that need to be worked around. However, some setups may be restricted to only running in the `bridge` mode. Plex can be made to work in this mode, but it is more complicated. 18 | 19 | For those who use docker-compose, this repository provides the necessary YML template files to be modified for your own use. 20 | 21 | ### Host Networking 22 | 23 | ``` 24 | docker run \ 25 | -d \ 26 | --name plex \ 27 | --network=host \ 28 | -e TZ="" \ 29 | -e PLEX_CLAIM="" \ 30 | -v :/config \ 31 | -v :/transcode \ 32 | -v :/data \ 33 | plexinc/pms-docker 34 | ``` 35 | 36 | Note: If your `/etc/hosts` file is missing an entry for `localhost`, you should add one before using host networking. 37 | 38 | ### Macvlan Networking 39 | 40 | ``` 41 | docker run \ 42 | -d \ 43 | --name plex \ 44 | --network=physical \ 45 | --ip= \ 46 | -e TZ="" \ 47 | -e PLEX_CLAIM="" \ 48 | -h \ 49 | -v :/config \ 50 | -v :/transcode \ 51 | -v :/data \ 52 | plexinc/pms-docker 53 | ``` 54 | 55 | Similar to `Host Networking` above with these changes: 56 | 57 | - The network has been changed to `physical` which is the name of the `macvlan` network (yours is likely to be different). 58 | - The `--ip` parameter has been added to specify the IP address of the container. This parameter is optional since the network may specify IPs to use but this parameter overrides those settings. 59 | - The `-h ` has been added since this networking type doesn't use the hostname of the host. 60 | 61 | ### Bridge Networking 62 | 63 | ``` 64 | docker run \ 65 | -d \ 66 | --name plex \ 67 | -p 32400:32400/tcp \ 68 | -p 8324:8324/tcp \ 69 | -p 32469:32469/tcp \ 70 | -p 1900:1900/udp \ 71 | -p 32410:32410/udp \ 72 | -p 32412:32412/udp \ 73 | -p 32413:32413/udp \ 74 | -p 32414:32414/udp \ 75 | -e TZ="" \ 76 | -e PLEX_CLAIM="" \ 77 | -e ADVERTISE_IP="http://:32400/" \ 78 | -h \ 79 | -v :/config \ 80 | -v :/transcode \ 81 | -v :/data \ 82 | plexinc/pms-docker 83 | ``` 84 | 85 | Note: In this configuration, you must do some additional configuration: 86 | 87 | - If you wish your Plex Media Server to be accessible outside of your home network, you must manually setup port forwarding on your router to forward to the `ADVERTISE_IP` specified above. By default you can forward port 32400, but if you choose to use a different external port, be sure you configure this in Plex Media Server's `Remote Access` settings. With this type of docker networking, the Plex Media Server is essentially behind two routers and it cannot automatically setup port forwarding on its own. 88 | - (Plex Pass only) After the server has been set up, you should configure the `LAN Networks` preference to contain the network of your LAN. This instructs the Plex Media Server to treat these IP addresses as part of your LAN when applying bandwidth controls. The syntax is the same as the `ALLOWED_NETWORKS` below. For example `192.168.1.0/24,172.16.0.0/16` will allow access to the entire `192.168.1.x` range and the `172.16.x.x` range. 89 | 90 | ## Parameters 91 | 92 | - `-p 32400:32400/tcp` Forwards port 32400 from the host to the container. This is the primary port that Plex uses for communication and is required for Plex Media Server to operate. 93 | - `-p …` Forwards complete set of other ports used by Plex to the container. For a full explanation of which you may need, please see the help article: [https://support.plex.tv/hc/en-us/articles/201543147-What-network-ports-do-I-need-to-allow-through-my-firewall](https://support.plex.tv/hc/en-us/articles/201543147-What-network-ports-do-I-need-to-allow-through-my-firewall) 94 | - `-v :/config` The path where you wish Plex Media Server to store its configuration data. This database can grow to be quite large depending on the size of your media collection. This is usually a few GB but for large libraries or libraries where index files are generated, this can easily hit the 100s of GBs. If you have an existing database directory see the section below on the directory setup. **Note**: the underlying filesystem needs to support file locking. This is known to not be default enabled on remote filesystems like NFS, SMB, and many many others. The 9PFS filesystem used by FreeNAS Corral is known to work but the vast majority will result in database corruption. Use a network share at your own risk. 95 | - `-v :/transcode` The path where you would like Plex Media Server to store its transcoder temp files. If not provided, the storage space within the container will be used. Expect sizes in the 10s of GB. 96 | - `-v :/data` This is provided as examples for providing media into the container. The exact structure of how the media is organized and presented inside the container is a matter of user preference. You can use as many or as few of these parameters as required to provide your media to the container. 97 | - `-e KEY="value"` These are environment variables which configure the container. See below for a description of their meanings. 98 | 99 | The following are the recommended parameters. Each of the following parameters to the container are treated as first-run parameters only. That is, all other parameters are ignored on subsequent runs of the server. We recommend that you set the following parameters: 100 | 101 | - **HOSTNAME** Sets the hostname inside the docker container. For example `-h PlexServer` will set the servername to `PlexServer`. Not needed in Host Networking. 102 | - **TZ** Set the timezone inside the container. For example: `Europe/London`. The complete list can be found here: [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) 103 | - **PLEX_CLAIM** The claim token for the server to obtain a real server token. If not provided, server will not be automatically logged in. If server is already logged in, this parameter is ignored. You can obtain a claim token to login your server to your plex account by visiting [https://www.plex.tv/claim](https://www.plex.tv/claim) 104 | - **ADVERTISE_IP** This variable defines the additional IPs on which the server may be found. For example: `http://10.1.1.23:32400`. This adds to the list where the server advertises that it can be found. This is only needed in Bridge Networking. 105 | 106 | These parameters are usually not required but some special setups may benefit from their use. As in the previous section, each is treated as first-run parameters only: 107 | 108 | - **PLEX_UID** The user id of the `plex` user created inside the container. 109 | - **PLEX_GID** The group id of the `plex` group created inside the container 110 | - **CHANGE_CONFIG_DIR_OWNERSHIP** Change ownership of config directory to the plex user. Defaults to `true`. If you are certain permissions are already set such that the `plex` user within the container can read/write data in it's config directory, you can set this to `false` to speed up the first run of the container. 111 | - **ALLOWED_NETWORKS** IP/netmask entries which allow access to the server without requiring authorization. We recommend you set this only if you do not sign in your server. For example `192.168.1.0/24,172.16.0.0/16` will allow access to the entire `192.168.1.x` range and the `172.16.x.x` range. Note: If you are using Bridge networking, then localhost will appear to plex as coming from the docker networking gateway which is often `172.16.0.1`. 112 | 113 | ## Users/Groups 114 | Permissions of mounted media outside the container do apply to the Plex Media Server running within the container. As stated above, the Plex Media Server runs as a specially created `plex` user within the container. This user may not exist outside the container and so the `PLEX_UID` and `PLEX_GID` parameters are used to set the user id and group id of this user within the container. If you wish for the Plex Media Server to run under the same permissions as your own user, execute the following to find out these ids: 115 | 116 | ``` 117 | $ id `whoami` 118 | ``` 119 | 120 | You'll see a line like the following: 121 | 122 | ``` 123 | uid=1001(myuser) gid=1001(myuser) groups=1001(myuser) 124 | ``` 125 | 126 | In the above case, if you set the `PLEX_UID` and `PLEX_GID` to `1001`, then the permissions will match that of your own user. 127 | 128 | ## Tags 129 | In addition to the standard version and `latest` tags, two other tags exist: `beta` and `public`. These two images behave differently than your typical containers. These two images do **not** have any Plex Media Server binary installed. Instead, when these containers are run, they will perform an update check and fetch the latest version, install it, and then continue execution. They also run the update check whenever the container is restarted. To update the version in the container, simply stop the container and start container again when you have a network connection. The startup script will automatically fetch the appropriate version and install it before starting the Plex Media Server. 130 | 131 | The `public` restricts this check to public versions only where as `beta` will fetch beta versions. If the server is not logged in or you do not have Plex Pass on your account, the `beta` tagged images will be restricted to publicly available versions only. 132 | 133 | To view the Docker images head over to [https://hub.docker.com/r/plexinc/pms-docker/tags/](https://hub.docker.com/r/plexinc/pms-docker/tags/) 134 | 135 | ## Config Directory 136 | Inside the docker container, the database is stored with a `Library/Application Support/Plex Media Server` in the `config` directory. 137 | 138 | If you wish to migrate an existing directory to the docker config directory: 139 | 140 | - Locate the current config directory as directed here: [https://support.plex.tv/hc/en-us/articles/202915258-Where-is-the-Plex-Media-Server-data-directory-located-](https://support.plex.tv/hc/en-us/articles/202915258-Where-is-the-Plex-Media-Server-data-directory-located-) 141 | - If the config dir is stored in a location such as `/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/`, the config dir will be `/var/lib/plexmediaserver`. 142 | - If the config dir does not contain `Library/Application Support/Plex Media Server/` or the directory containing `Library` has data unrelated to Plex, such as OS X, then you should: 143 | - Create a new directory which will be your new config dir. 144 | - Within that config dir, create the directories `Library/Application Support` 145 | - Copy `Plex Media Server` into that `Library/Application Support` 146 | - Note: by default Plex will claim ownership of the entire contents of the `config` dir (see CHANGE_CONFIG_DIR_OWNERSHIP for more information). As such, there should be nothing in that dir that you do not wish for Plex to own. 147 | 148 | ## Useful information 149 | - Start the container: `docker start plex` 150 | - Stop the container: `docker stop plex` 151 | - Shell access to the container while it is running: `docker exec -it plex /bin/bash` 152 | - See the logs given by the startup script in real time: `docker logs -f plex` 153 | - Restart the application and upgrade to the latest version: `docker restart plex` 154 | 155 | ## Fedora, CentOS, Red Hat 156 | 157 | If you get the following output after you have started the container, then this is due to a patched version of Docker ([#158](https://github.com/just-containers/s6-overlay/issues/158#issuecomment-266913426)) 158 | ``` 159 | plex | s6-supervise (child): fatal: unable to exec run: Permission denied 160 | plex | s6-supervise avahi: warning: unable to spawn ./run - waiting 10 seconds 161 | ``` 162 | As a workaround you can add `- /run` to volumes in your docker-compose.yml or `-v /run` to the docker create command. 163 | 164 | ## Intel Quick Sync Hardware Transcoding Support 165 | If your Docker host has access to a supported CPU with the Intel Quick Sync feature set and you are a current Plex Pass subscriber, you can enable hardware transcoding within your Plex Docker container. 166 | 167 | A list of current and previous Intel CPU's supporting Quick Sync is available on the Intel [website](https://ark.intel.com/content/www/us/en/ark/search/featurefilter.html?productType=873&0_QuickSyncVideo=True). 168 | 169 | Hardware transcoding is a Plex Pass feature that can be added to your Docker container by bind mounting the relevant kernel device to the container. To confirm your host kernel supports the Intel Quick Sync feature, the following command can be executed on the host: 170 | 171 | `lspci -v -s $(lspci | grep VGA | cut -d" " -f 1)` 172 | 173 | which should output `Kernel driver in use: i915` if Quick Sync is available. To pass the kernel device through to the container, add the device parameter like so: 174 | 175 | ``` 176 | docker run \ 177 | -d \ 178 | --name plex \ 179 | --network=host \ 180 | -e TZ="" \ 181 | -e PLEX_CLAIM="" \ 182 | -v :/config \ 183 | -v :/transcode \ 184 | -v :/data \ 185 | --device=/dev/dri:/dev/dri \ 186 | plexinc/pms-docker 187 | ``` 188 | 189 | In the example above, the `--device=/dev/dri:/dev/dri` was added to the `docker run` command to pass through the kernel device. Once the Plex Media Server container is running, the following steps will turn on the Hardware Transcoding option: 190 | 191 | 1. Open the Plex Web app. 192 | 2. Navigate to Settings > Server > Transcoder to access the server settings. 193 | 3. Turn on Show Advanced in the upper-right corner to expose advanced settings. 194 | 4. Turn on Use hardware acceleration when available. 195 | 5. Click Save Changes at the bottom. 196 | 197 | **NOTE:** Intel Quick Sync support also requires newer _64-bit versions of the Ubuntu or Fedora Linux operating system_ to make use of this feature. If your Docker host also has a dedicated graphics card, the video encoding acceleration of Intel Quick Sync Video may become unavailable when the GPU is in use. _If your computer has an NVIDIA GPU_, please install the latest Latest NVIDIA drivers for Linux to make sure that Plex can use your NVIDIA graphics card for video encoding (only) when Intel Quick Sync Video becomes unavailable._ 198 | 199 | Your mileage may vary when enabling hardware transcoding as newer generations of Intel CPU's provide transcoding of higher resolution video and newer codecs. There is a useful Wikipedia page [here](https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding) which provides a handy matrix for each CPU generation's support of on-chip video decoding. 200 | 201 | ## Windows (Not Recommended) 202 | 203 | Docker on Windows works differently than it does on Linux; it uses a VM to run a stripped-down Linux and then runs docker within that. The volume mounts are exposed to the docker in this VM via SMB mounts. While this is fine for media, it is unacceptable for the `/config` directory because SMB does not support file locking. This **will** eventually corrupt your database which can lead to slow behavior and crashes. If you must run in docker on Windows, you should put the `/config` directory mount inside the VM and not on the Windows host. It's worth noting that this warning also extends to other containers which use SQLite databases. 204 | 205 | ## Running on a headless server with container using host networking 206 | 207 | If the claim token is not added during initial configuration you will need to use ssh tunneling to gain access and setup the server for first run. During first run you setup the server to make it available and configurable. However, this setup option will only be triggered if you access it over http://localhost:32400/web, it will not be triggered if you access it over http://ip_of_server:32400/web. If you are setting up PMS on a headless server, you can use a SSH tunnel to link http://localhost:32400/web (on your current computer) to http://localhost:32400/web (on the headless server running PMS): 208 | 209 | `ssh username@ip_of_server -L 32400:ip_of_server:32400 -N` 210 | -------------------------------------------------------------------------------- /charts/plex-media-server/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /charts/plex-media-server/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: plex-media-server 3 | description: A Helm chart for deploying a PMS server to a Kubernetes cluster 4 | 5 | keywords: 6 | - plex 7 | - pms 8 | - Personal Media Server 9 | 10 | home: https://www.plex.tv 11 | icon: https://www.plex.tv/wp-content/themes/plex/assets/img/favicons/plex-152.png 12 | # A chart can be either an 'application' or a 'library' chart. 13 | # 14 | # Application charts are a collection of templates that can be packaged into versioned archives 15 | # to be deployed. 16 | # 17 | # Library charts provide useful utilities or functions for the chart developer. They're included as 18 | # a dependency of application charts to inject those utilities and functions into the rendering 19 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 20 | type: application 21 | 22 | # This is the chart version. This version number should be incremented each time you make changes 23 | # to the chart and its templates, including the app version. 24 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 25 | version: 1.0.2 26 | 27 | # This is the version number of the application being deployed. This version number should be 28 | # incremented each time you make changes to the application. Versions are not expected to 29 | # follow Semantic Versioning. They should reflect the version the application is using. 30 | # It is recommended to use it with quotes. 31 | appVersion: "1.41.6" 32 | 33 | sources: 34 | - https://github.com/plexinc/pms-docker 35 | -------------------------------------------------------------------------------- /charts/plex-media-server/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /charts/plex-media-server/README.md: -------------------------------------------------------------------------------- 1 | # plex-media-server 2 | 3 | ![Version: 1.0.2](https://img.shields.io/badge/Version-1.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.41.6](https://img.shields.io/badge/AppVersion-1.41.6-informational?style=flat-square) 4 | 5 | **Homepage:** 6 | 7 | A Helm chart for deploying a PMS server to a Kubernetes cluster 8 | 9 | While Plex is responsible for maintaining this Helm chart, we cannot provide support for troubleshooting related to its usage. For community assistance, please visit our [support forums](https://forums.plex.tv/). 10 | 11 | ### Installation via Helm 12 | 13 | 1. Add the Helm chart repo 14 | 15 | ```bash 16 | helm repo add plex https://raw.githubusercontent.com/plexinc/pms-docker/gh-pages 17 | ``` 18 | 19 | 2. Inspect & modify the default values (optional) 20 | 21 | ```bash 22 | helm show values plex/plex-media-server > values.yaml 23 | ``` 24 | 25 | 3. Install the chart 26 | 27 | ```bash 28 | helm upgrade --install plex plex/plex-media-server --values values.yaml 29 | ``` 30 | 31 | [Additional details available here](https://www.plex.tv/blog/plex-pro-week-23-a-z-on-k8s-for-plex-media-server/) 32 | 33 | ### Sample init Container scripts 34 | 35 | If you already have a different PMS server running elsewhere and wish to migrate it to be running in Kubernetes 36 | the easiest way to do that is to import the existing PMS database through the use of a custom init script. 37 | 38 | **Note: the init script must include a mechanism to exit early if the pms database already exists to prevent from overwriting its contents** 39 | 40 | The following script is an example (using the default `alpine` init container) that will pull 41 | a tar gziped file that contains the pms `Library` directory from some web server. 42 | 43 | ```sh 44 | #!/bin/sh 45 | echo "fetching pre-existing pms database to import..." 46 | 47 | if [ -d "/config/Library" ]; then 48 | echo "PMS library already exists, exiting." 49 | exit 0 50 | fi 51 | 52 | apk --no-cache add curl 53 | curl http://example.com/pms.tgz -o pms.tgz 54 | tar -xvzf pms.tgz -C /config 55 | rm pms.tgz 56 | 57 | echo "Done." 58 | ``` 59 | 60 | This next example could be used if you don't have or can't host the existing pms database archive on a web server. 61 | However, this one _does_ require that two commands are run manually once the init container starts up. 62 | 63 | 1. Manually copy the pms database into the pod: `kubectl cp pms.tgz /:/pms.tgz.up -c -pms-chart-pms-init` 64 | 2. Once the file is uploaded copy rename it on the pod to the correct name that will be processed `kubectl exec -n --stdin --tty -c -pms-chart-pms-init h -- mv /pms.tgz.up /pms.tgz` 65 | 66 | The file is being uploaded with a temporary name so that the script does not start trying to unpack the database until it has finished uploading. 67 | 68 | ```sh 69 | #!/bin/sh 70 | echo "waiting for pre-existing pms database to uploaded..." 71 | 72 | if [ -d "/config/Library" ]; then 73 | echo "PMS library already exists, exiting." 74 | exit 0 75 | fi 76 | 77 | # wait for the database archive to be manually copied to the server 78 | while [ ! -f /pms.tgz ]; do sleep 2; done; 79 | 80 | tar -xvzf /pms.tgz -C /config 81 | rm pms.tgz 82 | 83 | echo "Done." 84 | ``` 85 | 86 | ## Contributing 87 | 88 | Before contributing, please read the [Code of Conduct](../../CODE_OF_CONDUCT.md). 89 | 90 | ## License 91 | 92 | [GNU GPLv3](./LICENSE) 93 | 94 | ## Source Code 95 | 96 | * 97 | 98 | ## Values 99 | 100 | | Key | Type | Default | Description | 101 | |-----|------|---------|-------------| 102 | | affinity | object | `{}` | | 103 | | commonLabels | object | `{}` | Common Labels for all resources created by this chart. | 104 | | dnsConfig | object | `{}` | Optional DNS configuration for the Pod | 105 | | extraContainers | list | `[]` | | 106 | | extraEnv | object | `{}` | | 107 | | extraInitContainers | object | `{}` | | 108 | | extraVolumeMounts | list | `[]` | Optionally specify additional volume mounts for the PMS and init containers. | 109 | | extraVolumes | list | `[]` | Optionally specify additional volumes for the pod. | 110 | | fullnameOverride | string | `""` | | 111 | | global.imageRegistry | string | `""` | Allow parent charts to override registry hostname | 112 | | image | object | `{"pullPolicy":"IfNotPresent","registry":"index.docker.io","repository":"plexinc/pms-docker","sha":"","tag":"1.41.6.9685-d301f511a"}` | The docker image information for the pms application | 113 | | image.registry | string | `"index.docker.io"` | The public dockerhub registry | 114 | | image.tag | string | `"1.41.6.9685-d301f511a"` | If unset use "latest" | 115 | | imagePullSecrets | list | `[]` | | 116 | | ingress.annotations | object | `{}` | Custom annotations to put on the ingress resource | 117 | | ingress.enabled | bool | `false` | Specify if an ingress resource for the pms server should be created or not | 118 | | ingress.ingressClassName | string | `"ingress-nginx"` | The ingress class that should be used | 119 | | ingress.tls | list | `[]` | Optional TLS configuration to provide valid https connections using an existing SSL certificate | 120 | | ingress.url | string | `""` | The url to use for the ingress reverse proxy to point at this pms instance | 121 | | initContainer | object | `{"image":{"pullPolicy":"IfNotPresent","registry":"index.docker.io","repository":"alpine","sha":"","tag":"3.21"},"script":""}` | A basic image that will convert the configmap to a file in the rclone config volume this is ignored if rclone is not enabled | 122 | | initContainer.image.registry | string | `"index.docker.io"` | The public dockerhub registry | 123 | | initContainer.image.tag | string | `"3.21"` | If unset use latest | 124 | | initContainer.script | string | `""` | A custom script that will be run in an init container to do any setup before the PMS service starts up This will be run every time the pod starts, make sure that some mechanism is included to prevent this from running more than once if it should only be run on the first startup. | 125 | | nameOverride | string | `""` | | 126 | | nodeSelector | object | `{}` | | 127 | | pms.claimSecret.key | string | `""` | | 128 | | pms.claimSecret.name | string | `""` | | 129 | | pms.configExistingClaim | string | `""` | Name of an existing `PersistentVolumeClaim` for the PMS database NOTE: When set, 'configStorage' and 'storageClassName' are ignored. | 130 | | pms.configStorage | string | `"2Gi"` | The volume size to provision for the PMS database | 131 | | pms.gpu.nvidia.enabled | bool | `false` | | 132 | | pms.livenessProbe | object | `{}` | Add kubernetes liveness probe to pms container. | 133 | | pms.readinessProbe | object | `{}` | Add kubernetes readiness probe to pms container. | 134 | | pms.resources | object | `{}` | | 135 | | pms.securityContext | object | `{}` | Security context for PMS pods | 136 | | pms.shareProcessNamespace | bool | `false` | Enable process namespace sharing within the pod. | 137 | | pms.storageClassName | string | `nil` | The storage class to use when provisioning the pms config volume this needs to be created manually, null will use the default | 138 | | priorityClassName | string | `""` | | 139 | | rclone | object | `{"additionalArgs":[],"configSecret":"","enabled":false,"image":{"pullPolicy":"IfNotPresent","registry":"index.docker.io","repository":"rclone/rclone","sha":"","tag":"1.69.2"},"readOnly":true,"remotes":[],"resources":{}}` | The settings specific to rclone | 140 | | rclone.additionalArgs | list | `[]` | Additional arguments to give to rclone when mounting the volume | 141 | | rclone.configSecret | string | `""` | The name of the secret that contains the rclone configuration file. The rclone config key must be called `rclone.conf` in the secret All keys in configSecret will be available in /etc/rclone/. This might be useful if other files are needed, such as a private key for sftp mode. | 142 | | rclone.enabled | bool | `false` | If the rclone sidecar should be created | 143 | | rclone.image | object | `{"pullPolicy":"IfNotPresent","registry":"index.docker.io","repository":"rclone/rclone","sha":"","tag":"1.69.2"}` | The rclone image that should be used | 144 | | rclone.image.registry | string | `"index.docker.io"` | The public dockerhub registry | 145 | | rclone.image.tag | string | `"1.69.2"` | If unset use latest | 146 | | rclone.readOnly | bool | `true` | If the remote volumes should be mounted as read only | 147 | | rclone.remotes | list | `[]` | The remote drive that should be mounted using rclone this must be in the form of `name:[/optional/path]` this remote will be mounted at `/data/name` in the PMS container | 148 | | runtimeClassName | string | `""` | Specify your own runtime class name eg use gpu | 149 | | service.annotations | object | `{}` | Optional extra annotations to add to the service resource | 150 | | service.port | int | `32400` | | 151 | | service.type | string | `"ClusterIP"` | | 152 | | serviceAccount.annotations | object | `{}` | Annotations to add to the service account | 153 | | serviceAccount.automountServiceAccountToken | bool | `false` | If the service account token should be auto mounted | 154 | | serviceAccount.create | bool | `true` | Specifies whether a service account should be created | 155 | | serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | 156 | | statefulSet.annotations | object | `{}` | Optional extra annotations to add to the service resource | 157 | | statefulSet.podAnnotations | object | `{}` | Optional extra annotations to add to the pods in the statefulset | 158 | | tolerations | list | `[]` | | 159 | 160 | ---------------------------------------------- 161 | Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) 162 | -------------------------------------------------------------------------------- /charts/plex-media-server/README.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{ template "chart.header" . }} 2 | {{ template "chart.deprecationWarning" . }} 3 | 4 | {{ template "chart.badgesSection" . }} 5 | 6 | {{ template "chart.homepageLine" . }} 7 | 8 | {{ template "chart.description" . }} 9 | 10 | 11 | While Plex is responsible for maintaining this Helm chart, we cannot provide support for troubleshooting related to its usage. For community assistance, please visit our [support forums](https://forums.plex.tv/). 12 | 13 | ### Installation via Helm 14 | 15 | 1. Add the Helm chart repo 16 | 17 | ```bash 18 | helm repo add plex https://raw.githubusercontent.com/plexinc/pms-docker/gh-pages 19 | ``` 20 | 21 | 2. Inspect & modify the default values (optional) 22 | 23 | ```bash 24 | helm show values plex/plex-media-server > values.yaml 25 | ``` 26 | 27 | 3. Install the chart 28 | 29 | ```bash 30 | helm upgrade --install plex plex/plex-media-server --values values.yaml 31 | ``` 32 | 33 | [Additional details available here](https://www.plex.tv/blog/plex-pro-week-23-a-z-on-k8s-for-plex-media-server/) 34 | 35 | ### Sample init Container scripts 36 | 37 | If you already have a different PMS server running elsewhere and wish to migrate it to be running in Kubernetes 38 | the easiest way to do that is to import the existing PMS database through the use of a custom init script. 39 | 40 | **Note: the init script must include a mechanism to exit early if the pms database already exists to prevent from overwriting its contents** 41 | 42 | The following script is an example (using the default `alpine` init container) that will pull 43 | a tar gziped file that contains the pms `Library` directory from some web server. 44 | 45 | ```sh 46 | #!/bin/sh 47 | echo "fetching pre-existing pms database to import..." 48 | 49 | if [ -d "/config/Library" ]; then 50 | echo "PMS library already exists, exiting." 51 | exit 0 52 | fi 53 | 54 | apk --no-cache add curl 55 | curl http://example.com/pms.tgz -o pms.tgz 56 | tar -xvzf pms.tgz -C /config 57 | rm pms.tgz 58 | 59 | echo "Done." 60 | ``` 61 | 62 | This next example could be used if you don't have or can't host the existing pms database archive on a web server. 63 | However, this one _does_ require that two commands are run manually once the init container starts up. 64 | 65 | 1. Manually copy the pms database into the pod: `kubectl cp pms.tgz /:/pms.tgz.up -c -pms-chart-pms-init` 66 | 2. Once the file is uploaded copy rename it on the pod to the correct name that will be processed `kubectl exec -n --stdin --tty -c -pms-chart-pms-init h -- mv /pms.tgz.up /pms.tgz` 67 | 68 | The file is being uploaded with a temporary name so that the script does not start trying to unpack the database until it has finished uploading. 69 | 70 | ```sh 71 | #!/bin/sh 72 | echo "waiting for pre-existing pms database to uploaded..." 73 | 74 | if [ -d "/config/Library" ]; then 75 | echo "PMS library already exists, exiting." 76 | exit 0 77 | fi 78 | 79 | # wait for the database archive to be manually copied to the server 80 | while [ ! -f /pms.tgz ]; do sleep 2; done; 81 | 82 | tar -xvzf /pms.tgz -C /config 83 | rm pms.tgz 84 | 85 | echo "Done." 86 | ``` 87 | 88 | ## Contributing 89 | 90 | Before contributing, please read the [Code of Conduct](../../CODE_OF_CONDUCT.md). 91 | 92 | ## License 93 | 94 | [GNU GPLv3](./LICENSE) 95 | 96 | {{ template "chart.maintainersSection" . }} 97 | 98 | {{ template "chart.sourcesSection" . }} 99 | 100 | {{ template "chart.requirementsSection" . }} 101 | 102 | {{ template "chart.valuesSection" . }} 103 | 104 | {{ template "helm-docs.versionFooter" . }} 105 | -------------------------------------------------------------------------------- /charts/plex-media-server/UPGRADE.md: -------------------------------------------------------------------------------- 1 | # Upgrade 2 | 3 | ## From v0.9.x to v1.x 4 | 5 | This version adds a more flexible way to define TLS configuration for the 6 | Ingress resource. Users should replace any previous `certificateSecret` 7 | configuration values with an equivalent `tls` block as described below: 8 | 9 | ```diff 10 | - certificateSecret: plex.example.com 11 | + tls: 12 | + - hosts: 13 | + - plex.example.com 14 | + secretName: cert-example-com 15 | ``` 16 | -------------------------------------------------------------------------------- /charts/plex-media-server/ci/ci-values.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | tag: null 3 | pullPolicy: Always 4 | 5 | global: 6 | imageRegistry: "" 7 | 8 | dnsConfig: {} 9 | 10 | ingress: 11 | enabled: true 12 | ingressClassName: my-class 13 | url: example.com 14 | tls: 15 | - hosts: 16 | - plex.example.com 17 | secretName: cert-example-com 18 | 19 | annotations: 20 | plex.tv/description: just an annotation 21 | 22 | pms: 23 | configStorage: 1Gi 24 | 25 | resources: 26 | limits: 27 | cpu: 100m 28 | memory: 128Mi 29 | requests: 30 | cpu: 100m 31 | memory: 128Mi 32 | 33 | securityContext: {} 34 | 35 | shareProcessNamespace: true 36 | 37 | service: 38 | type: ClusterIP 39 | port: 32400 40 | annotations: 41 | plex.tv/description: just an annotation 42 | 43 | priorityClassName: system-node-critical 44 | 45 | commonLabels: 46 | plex.tv/name: pms 47 | 48 | extraEnv: 49 | HOSTNAME: PlexServer 50 | TZ: Etc/UTC 51 | PLEX_UPDATE_CHANNEL: '5' 52 | PLEX_UID: '1000' 53 | PLEX_GID: '1000' 54 | ALLOWED_NETWORKS: '0.0.0.0/0' 55 | 56 | extraVolumeMounts: 57 | - name: dev-dri 58 | mountPath: /dev/dri 59 | 60 | extraVolumes: 61 | - name: dev-dri 62 | hostPath: 63 | path: /dev/dri 64 | type: Directory 65 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | Thank you for installing {{ .Chart.Name }}. 2 | 3 | Your release is named {{ .Release.Name }}. 4 | 5 | To learn more about the release, try: 6 | 7 | $ helm status {{ .Release.Name }} 8 | $ helm get all {{ .Release.Name }} 9 | 10 | 11 | Mount path for remote is available at {{ .Values.rclone.path }} 12 | You can use this as a volume within your other pods to view the file system for your remote. 13 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Expand the name of the chart. 3 | */}} 4 | {{- define "pms-chart.name" -}} 5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} 6 | {{- end }} 7 | 8 | {{/* 9 | Create a default fully qualified app name. 10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 11 | If release name contains chart name it will be used as a full name. 12 | */}} 13 | {{- define "pms-chart.fullname" -}} 14 | {{- if .Values.fullnameOverride }} 15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} 16 | {{- else }} 17 | {{- $name := default .Chart.Name .Values.nameOverride }} 18 | {{- if contains $name .Release.Name }} 19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} 20 | {{- else }} 21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} 22 | {{- end }} 23 | {{- end }} 24 | {{- end }} 25 | 26 | {{/* 27 | Create chart name and version as used by the chart label. 28 | */}} 29 | {{- define "pms-chart.chart" -}} 30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} 31 | {{- end }} 32 | 33 | {{/* 34 | The image to use for pms 35 | */}} 36 | {{- define "pms-chart.image" -}} 37 | {{- if .Values.image.sha }} 38 | {{- if .Values.global.imageRegistry }} 39 | {{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository (default ("latest") .Values.image.tag) .Values.image.sha }} 40 | {{- else }} 41 | {{- printf "%s/%s:%s@%s" .Values.image.registry .Values.image.repository (default ("latest") .Values.image.tag) .Values.image.sha }} 42 | {{- end }} 43 | {{- else }} 44 | {{- if .Values.global.imageRegistry }} 45 | {{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository (default ( "latest") .Values.image.tag) }} 46 | {{- else }} 47 | {{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository (default ( "latest") .Values.image.tag) }} 48 | {{- end }} 49 | {{- end }} 50 | {{- end }} 51 | 52 | {{/* 53 | The image to use for the init containers 54 | */}} 55 | {{- define "pms-chart.init_image" -}} 56 | {{- if .Values.initContainer.image.sha }} 57 | {{- if .Values.global.imageRegistry }} 58 | {{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.initContainer.image.repository (default ("latest") .Values.initContainer.image.tag) .Values.initContainer.image.sha }} 59 | {{- else }} 60 | {{- printf "%s/%s:%s@%s" .Values.initContainer.image.registry .Values.initContainer.image.repository (default ("latest") .Values.initContainer.image.tag) .Values.initContainer.image.sha }} 61 | {{- end }} 62 | {{- else }} 63 | {{- if .Values.global.imageRegistry }} 64 | {{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.initContainer.image.repository (default ( "latest") .Values.initContainer.image.tag) }} 65 | {{- else }} 66 | {{- printf "%s/%s:%s" .Values.initContainer.image.registry .Values.initContainer.image.repository (default ( "latest") .Values.initContainer.image.tag) }} 67 | {{- end }} 68 | {{- end }} 69 | {{- end }} 70 | 71 | {{/* 72 | The image to use for rclone 73 | */}} 74 | {{- define "pms-chart.rclone_image" -}} 75 | {{- if .Values.rclone.image.sha }} 76 | {{- if .Values.global.imageRegistry }} 77 | {{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.rclone.image.repository (default ("latest") .Values.rclone.image.tag) .Values.rclone.image.sha }} 78 | {{- else }} 79 | {{- printf "%s/%s:%s@%s" .Values.rclone.image.registry .Values.rclone.image.repository (default ("latest") .Values.rclone.image.tag) .Values.rclone.image.sha }} 80 | {{- end }} 81 | {{- else }} 82 | {{- if .Values.global.imageRegistry }} 83 | {{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.rclone.image.repository (default ( "latest") .Values.rclone.image.tag) }} 84 | {{- else }} 85 | {{- printf "%s/%s:%s" .Values.rclone.image.registry .Values.rclone.image.repository (default ( "latest") .Values.rclone.image.tag) }} 86 | {{- end }} 87 | {{- end }} 88 | {{- end }} 89 | 90 | {{/* 91 | Common labels 92 | */}} 93 | {{- define "pms-chart.labels" -}} 94 | app: {{ template "pms-chart.name" . }} 95 | helm.sh/chart: {{ include "pms-chart.chart" . }} 96 | {{ include "pms-chart.selectorLabels" . }} 97 | {{- if .Chart.AppVersion }} 98 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 99 | {{- end }} 100 | app.kubernetes.io/managed-by: {{ .Release.Service }} 101 | {{- if .Values.commonLabels}} 102 | {{ toYaml .Values.commonLabels }} 103 | {{- end }} 104 | {{- end }} 105 | 106 | {{/* 107 | Selector labels 108 | */}} 109 | {{- define "pms-chart.selectorLabels" -}} 110 | app.kubernetes.io/name: {{ include "pms-chart.name" . }} 111 | app.kubernetes.io/instance: {{ .Release.Name }} 112 | {{- end }} 113 | 114 | {{/* 115 | Create the name of the service account to use 116 | */}} 117 | {{- define "pms-chart.serviceAccountName" -}} 118 | {{- if .Values.serviceAccount.create }} 119 | {{- default (include "pms-chart.fullname" .) .Values.serviceAccount.name }} 120 | {{- else }} 121 | {{- default "default" .Values.serviceAccount.name }} 122 | {{- end }} 123 | {{- end }} 124 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/configmap-init-script.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.initContainer.script -}} 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: {{ include "pms-chart.fullname" . }}-init-script 6 | labels: 7 | {{- include "pms-chart.labels" . | nindent 4 }} 8 | data: 9 | init.sh: | 10 | {{ .Values.initContainer.script | indent 4 }} 11 | {{- end -}} 12 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingress.enabled -}} 2 | apiVersion: networking.k8s.io/v1 3 | kind: Ingress 4 | metadata: 5 | name: {{ include "pms-chart.fullname" . }}-ingress 6 | labels: 7 | name: {{ include "pms-chart.fullname" . }}-ingress 8 | {{ include "pms-chart.labels" . | indent 4 }} 9 | {{- with .Values.ingress.annotations }} 10 | annotations: 11 | {{ toYaml . | indent 4 }} 12 | {{- end }} 13 | spec: 14 | {{- if .Values.ingress.ingressClassName }} 15 | ingressClassName: {{ .Values.ingress.ingressClassName }} 16 | {{- end }} 17 | rules: 18 | - host: {{ trimPrefix "https://" .Values.ingress.url }} 19 | http: 20 | paths: 21 | - path: '/' 22 | pathType: Prefix 23 | backend: 24 | service: 25 | name: {{ include "pms-chart.fullname" . }} 26 | port: 27 | number: 32400 28 | {{- if .Values.ingress.tls }} 29 | tls: 30 | {{- range .Values.ingress.tls }} 31 | - hosts: 32 | {{- range .hosts }} 33 | - {{ tpl . $ | quote }} 34 | {{- end }} 35 | {{- with .secretName }} 36 | secretName: {{ tpl . $ }} 37 | {{- end }} 38 | {{- end }} 39 | {{- end }} 40 | {{- end -}} 41 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "pms-chart.fullname" . }} 5 | labels: 6 | {{- include "pms-chart.labels" . | nindent 4 }} 7 | {{- with .Values.service.annotations }} 8 | annotations: 9 | {{ toYaml . | indent 4 }} 10 | {{- end }} 11 | spec: 12 | type: {{ .Values.service.type }} 13 | {{- if .Values.service.loadBalancerIP }} 14 | loadBalancerIP: {{ .Values.service.loadBalancerIP }} 15 | {{- end }} 16 | {{- if .Values.service.externalTrafficPolicy }} 17 | externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} 18 | {{- end }} 19 | ports: 20 | - port: {{ .Values.service.port }} 21 | targetPort: 32400 22 | {{- if eq .Values.service.type "NodePort" }} 23 | nodePort: {{ default "32400" .Values.service.nodePort }} 24 | {{- end }} 25 | protocol: TCP 26 | name: pms 27 | selector: 28 | {{- include "pms-chart.selectorLabels" . | nindent 4 }} 29 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccount.create -}} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: {{ include "pms-chart.serviceAccountName" . }} 6 | labels: 7 | {{- include "pms-chart.labels" . | nindent 4 }} 8 | {{- with .Values.serviceAccount.annotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} 13 | {{- end }} 14 | -------------------------------------------------------------------------------- /charts/plex-media-server/templates/statefulset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: {{ include "pms-chart.fullname" . }} 5 | labels: 6 | name: {{ include "pms-chart.fullname" . }} 7 | {{ include "pms-chart.labels" . | indent 4 }} 8 | {{- with .Values.statefulSet.annotations }} 9 | annotations: 10 | {{ toYaml . | indent 4 }} 11 | {{- end }} 12 | spec: 13 | serviceName: {{ include "pms-chart.fullname" . }} 14 | selector: 15 | matchLabels: 16 | {{- include "pms-chart.selectorLabels" . | nindent 6 }} 17 | template: 18 | metadata: 19 | labels: 20 | {{- include "pms-chart.labels" . | nindent 8 }} 21 | annotations: 22 | {{- toYaml .Values.statefulSet.podAnnotations | nindent 8 }} 23 | spec: 24 | {{- if .Values.dnsConfig }} 25 | dnsConfig: 26 | {{- toYaml .Values.dnsConfig | nindent 8 }} 27 | {{- end }} 28 | {{- if .Values.runtimeClassName }} 29 | runtimeClassName: {{ .Values.runtimeClassName | quote }} 30 | {{- end }} 31 | serviceAccountName: {{ include "pms-chart.serviceAccountName" . }} 32 | {{- if .Values.pms.shareProcessNamespace }} 33 | shareProcessNamespace: {{ .Values.pms.shareProcessNamespace }} 34 | {{- end }} 35 | tolerations: 36 | {{- toYaml .Values.tolerations | nindent 8 }} 37 | nodeSelector: 38 | {{- toYaml .Values.nodeSelector | nindent 8 }} 39 | affinity: 40 | {{- toYaml .Values.affinity | nindent 8 }} 41 | {{- if .Values.priorityClassName }} 42 | priorityClassName: {{ .Values.priorityClassName | quote }} 43 | {{- end }} 44 | volumes: 45 | {{- if .Values.pms.configExistingClaim }} 46 | - name: pms-config 47 | persistentVolumeClaim: 48 | claimName: {{ .Values.pms.configExistingClaim | quote }} 49 | {{- end }} 50 | - name: pms-transcode 51 | emptyDir: {} 52 | {{- if and .Values.rclone.enabled .Values.rclone.configSecret }} 53 | {{- range .Values.rclone.remotes }} 54 | - name: rclone-media-{{ (split ":" .)._0 }} 55 | emptyDir: {} 56 | {{- end }} 57 | - name: rclone-config 58 | emptyDir: {} 59 | - name: rclone-config-data 60 | secret: 61 | secretName: {{ .Values.rclone.configSecret }} 62 | {{- end }} 63 | {{- if .Values.initContainer.script }} 64 | - name: init-script-configmap 65 | configMap: 66 | defaultMode: 0700 67 | name: {{ include "pms-chart.fullname" . }}-init-script 68 | {{- end }} 69 | {{- if .Values.extraVolumes }} 70 | {{ toYaml .Values.extraVolumes | indent 6 }} 71 | {{- end }} 72 | {{- with .Values.imagePullSecrets }} 73 | imagePullSecrets: 74 | {{- toYaml . | nindent 8 }} 75 | {{- end }} 76 | terminationGracePeriodSeconds: 120 77 | initContainers: 78 | {{- if .Values.initContainer.script }} 79 | - name: {{ include "pms-chart.fullname" . }}-pms-init 80 | image: {{ include "pms-chart.init_image" . }} 81 | command: ["/init/init.sh"] 82 | volumeMounts: 83 | - name: pms-config 84 | mountPath: /config 85 | - name: init-script-configmap 86 | mountPath: /init 87 | {{- if .Values.extraVolumeMounts }} 88 | {{ toYaml .Values.extraVolumeMounts | indent 8}} 89 | {{- end }} 90 | {{- end }} 91 | {{- if and .Values.rclone.enabled .Values.rclone.configSecret }} 92 | - name: {{ include "pms-chart.fullname" . }}-config 93 | image: {{ include "pms-chart.init_image" . }} 94 | command: 95 | - sh 96 | - -c 97 | args: 98 | - cp -v /in/* /out/ 99 | volumeMounts: 100 | - name: rclone-config-data 101 | mountPath: /in 102 | readOnly: true 103 | - name: rclone-config 104 | mountPath: /out 105 | {{- end }} 106 | {{- with .Values.extraInitContainers }} 107 | {{- toYaml . | nindent 6 }} 108 | {{- end }} 109 | containers: 110 | - name: {{ include "pms-chart.fullname" . }}-pms 111 | image: {{ include "pms-chart.image" . }} 112 | imagePullPolicy: {{ .Values.image.pullPolicy }} 113 | ports: 114 | - containerPort: 32400 115 | name: pms 116 | env: 117 | {{- if .Values.ingress.enabled }} 118 | - name: ADVERTISE_IP 119 | value: {{ .Values.ingress.url }}:443 120 | {{- end }} 121 | {{- range $key, $value := .Values.extraEnv }} 122 | - name: {{ $key }} 123 | value: {{ $value | quote }} 124 | {{- end }} 125 | {{- if and .Values.pms.claimSecret.name .Values.pms.claimSecret.value }} 126 | - name: PLEX_CLAIM 127 | valueFrom: 128 | secretKeyRef: 129 | name: {{ .Values.pms.claimSecret.name }} 130 | key: {{ .Values.pms.claimSecret.key }} 131 | {{- end }} 132 | {{- if .Values.pms.gpu.nvidia.enabled }} 133 | - name: NVIDIA_VISIBLE_DEVICES 134 | value: all 135 | - name: NVIDIA_DRIVER_CAPABILITIES 136 | value: compute,video,utility 137 | {{- end }} 138 | {{- with .Values.pms.livenessProbe }} 139 | livenessProbe: 140 | {{- toYaml . | nindent 10 }} 141 | {{- end }} 142 | {{- with .Values.pms.readinessProbe }} 143 | readinessProbe: 144 | {{- toYaml . | nindent 10 }} 145 | {{- end }} 146 | {{- with .Values.pms.resources }} 147 | resources: 148 | limits: 149 | {{- with .limits }} 150 | {{ toYaml . | indent 12 | trim }} 151 | {{- end }} 152 | {{- if and $.Values.pms.gpu.nvidia.enabled (not (hasKey .limits "nvidia.com/gpu")) }} 153 | nvidia.com/gpu: 1 154 | {{- end }} 155 | {{- if .requests }} 156 | requests: 157 | {{ toYaml .requests | indent 12 | trim }} 158 | {{- end }} 159 | {{- end }} 160 | {{- with .Values.pms.securityContext }} 161 | securityContext: 162 | {{- toYaml . | nindent 10 }} 163 | {{- end }} 164 | volumeMounts: 165 | - name: pms-config 166 | mountPath: /config 167 | - name: pms-transcode 168 | mountPath: /transcode 169 | {{- if and .Values.rclone.enabled .Values.rclone.configSecret }} 170 | {{- range .Values.rclone.remotes }} 171 | - name: rclone-media-{{ (split ":" .)._0 }} 172 | mountPath: "/data/{{ (split ":" .)._0 }}" 173 | mountPropagation: HostToContainer 174 | {{- end }} 175 | {{- end }} 176 | {{- if .Values.extraVolumeMounts }} 177 | {{ toYaml .Values.extraVolumeMounts | indent 8 }} 178 | {{- end }} 179 | {{- if and .Values.rclone.enabled .Values.rclone.configSecret }} 180 | {{- range .Values.rclone.remotes }} 181 | - name: {{ include "pms-chart.fullname" $ }}-rclone-{{ (split ":" .)._0 }} 182 | image: {{ include "pms-chart.rclone_image" $ }} 183 | imagePullPolicy: {{ $.Values.rclone.image.pullPolicy }} 184 | args: 185 | - mount 186 | - "{{ . }}" 187 | - "/data/{{ (split ":" .)._0 }}" 188 | - --config=/etc/rclone/rclone.conf 189 | - --allow-non-empty 190 | - --allow-other 191 | {{- if $.Values.rclone.readOnly }} 192 | - --read-only 193 | {{- end }} 194 | {{- range $.Values.rclone.additionalArgs }} 195 | - {{ . }} 196 | {{- end }} 197 | {{- with $.Values.rclone.resources }} 198 | resources: 199 | {{ toYaml . | indent 10 }} 200 | {{- end }} 201 | lifecycle: 202 | preStop: 203 | exec: 204 | command: ["/bin/sh","-c","fusermount3 -uz /data/{{ (split ":" .)._0 }}"] 205 | securityContext: 206 | privileged: true 207 | capabilities: 208 | add: 209 | - SYS_ADMIN 210 | volumeMounts: 211 | - name: rclone-config 212 | mountPath: /etc/rclone 213 | - name: rclone-media-{{ (split ":" .)._0 }} 214 | mountPath: "/data/{{ (split ":" .)._0 }}" 215 | mountPropagation: Bidirectional 216 | {{- end }} 217 | {{- end }} 218 | {{- with .Values.extraContainers }} 219 | {{- toYaml . | nindent 6 }} 220 | {{- end }} 221 | {{- if not .Values.pms.configExistingClaim }} 222 | volumeClaimTemplates: 223 | - apiVersion: v1 224 | kind: PersistentVolumeClaim 225 | metadata: 226 | name: pms-config 227 | spec: 228 | accessModes: [ "ReadWriteOnce" ] 229 | {{- if .Values.pms.storageClassName }} 230 | storageClassName: {{ .Values.pms.storageClassName }} 231 | {{- end }} 232 | resources: 233 | requests: 234 | storage: {{ .Values.pms.configStorage }} 235 | {{- end }} 236 | -------------------------------------------------------------------------------- /charts/plex-media-server/values.yaml: -------------------------------------------------------------------------------- 1 | # -- The docker image information for the pms application 2 | image: 3 | # -- The public dockerhub registry 4 | registry: index.docker.io 5 | repository: plexinc/pms-docker 6 | # -- If unset use "latest" 7 | tag: "1.41.6.9685-d301f511a" 8 | sha: "" 9 | pullPolicy: IfNotPresent 10 | 11 | global: 12 | # -- Allow parent charts to override registry hostname 13 | imageRegistry: "" 14 | 15 | # -- Optional DNS configuration for the Pod 16 | dnsConfig: {} 17 | 18 | ingress: 19 | # -- Specify if an ingress resource for the pms server should be created or not 20 | enabled: false 21 | 22 | # -- The ingress class that should be used 23 | ingressClassName: "ingress-nginx" 24 | 25 | # -- The url to use for the ingress reverse proxy to point at this pms instance 26 | url: "" 27 | 28 | # -- Optional TLS configuration to provide valid https connections 29 | # using an existing SSL certificate 30 | tls: [] 31 | # - hosts: 32 | # - plex.example.com 33 | # secretName: cert-example-com 34 | 35 | # -- Custom annotations to put on the ingress resource 36 | annotations: {} 37 | 38 | pms: 39 | # -- The storage class to use when provisioning the pms config volume 40 | # this needs to be created manually, null will use the default 41 | storageClassName: null 42 | 43 | # -- The volume size to provision for the PMS database 44 | configStorage: 2Gi 45 | 46 | # -- Name of an existing `PersistentVolumeClaim` for the PMS database 47 | # NOTE: When set, 'configStorage' and 'storageClassName' are ignored. 48 | configExistingClaim: "" 49 | 50 | # Providing both name and key will add in the PLEX_CLAIM environment variable 51 | # with the correct secretKeyRef configuration 52 | # Clashes with providing PLEX_CLAIM via `extraEnv` so only provide one or the other! 53 | claimSecret: 54 | name: "" 55 | key: "" 56 | 57 | # Enabling this will add nvidia.com/gpu: 1 to limits, and will set 58 | # environment for the nvidia operator 59 | gpu: 60 | nvidia: 61 | enabled: false 62 | 63 | resources: {} 64 | # We usually recommend not to specify default resources and to leave this as a conscious 65 | # choice for the user. This also increases chances charts run on environments with little 66 | # resources, such as Minikube. If you do want to specify resources, uncomment the following 67 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. 68 | # limits: 69 | # cpu: 100m 70 | # memory: 128Mi 71 | # requests: 72 | # cpu: 100m 73 | # memory: 128Mi 74 | 75 | # -- Security context for PMS pods 76 | securityContext: {} 77 | 78 | # -- Enable process namespace sharing within the pod. 79 | shareProcessNamespace: false 80 | 81 | # -- Add kubernetes liveness probe to pms container. 82 | livenessProbe: {} 83 | # httpGet: 84 | # path: /identity 85 | # port: 32400 86 | # initialDelaySeconds: 60 87 | # periodSeconds: 60 88 | # timeoutSeconds: 1 89 | # failureThreshold: 3 90 | 91 | # -- Add kubernetes readiness probe to pms container. 92 | readinessProbe: {} 93 | # httpGet: 94 | # path: /identity 95 | # port: 32400 96 | # initialDelaySeconds: 60 97 | # periodSeconds: 60 98 | # timeoutSeconds: 1 99 | # failureThreshold: 3 100 | 101 | # -- A basic image that will convert the configmap to a file in the rclone config volume 102 | # this is ignored if rclone is not enabled 103 | initContainer: 104 | image: 105 | # -- The public dockerhub registry 106 | registry: index.docker.io 107 | repository: alpine 108 | # -- If unset use latest 109 | tag: '3.21' 110 | sha: "" 111 | pullPolicy: IfNotPresent 112 | 113 | # -- A custom script that will be run in an init container to do any setup before the PMS service starts up 114 | # This will be run every time the pod starts, make sure that some mechanism is included to prevent 115 | # this from running more than once if it should only be run on the first startup. 116 | script: "" 117 | ### 118 | ### Example init script that will import a pre-existing pms database if one has not already been setup 119 | ### This pms database must be available through a URL (or some other mechanism to be pulled into the container) 120 | # script: |- 121 | # #!/bin/sh 122 | # echo "fetching pre-existing pms database to import..." 123 | # 124 | # if [ -d "/config/Library" ]; then 125 | # echo "PMS library already exists, exiting." 126 | # exit 0 127 | # fi 128 | # 129 | # apk --update add curl 130 | # curl http://example.com/pms.tgz -o pms.tgz 131 | # tar -xvzf pms.tgz -C /config 132 | # cp -r /config/data/Library /config/Library 133 | # rm -rf /config/data pms.tgz 134 | # 135 | # echo "Done." 136 | 137 | extraInitContainers: {} 138 | # extraContainers: 139 | # - name: 140 | # args: 141 | # - ... 142 | # image: 143 | # imagePullPolicy: IfNotPresent 144 | # resources: 145 | # limits: 146 | # memory: 128Mi 147 | # requests: 148 | # cpu: 100m 149 | # memory: 128Mi 150 | # volumeMounts: 151 | # - ... 152 | 153 | # -- Specify your own runtime class name eg use gpu 154 | runtimeClassName: "" 155 | 156 | # -- The settings specific to rclone 157 | rclone: 158 | # -- If the rclone sidecar should be created 159 | enabled: false 160 | 161 | # -- The rclone image that should be used 162 | image: 163 | # -- The public dockerhub registry 164 | registry: index.docker.io 165 | repository: rclone/rclone 166 | # -- If unset use latest 167 | tag: 1.69.2 168 | sha: "" 169 | pullPolicy: IfNotPresent 170 | 171 | # -- The name of the secret that contains the rclone configuration file. 172 | # The rclone config key must be called `rclone.conf` in the secret 173 | # 174 | # All keys in configSecret will be available in /etc/rclone/. This might 175 | # be useful if other files are needed, such as a private key for sftp mode. 176 | configSecret: "" 177 | 178 | # -- The remote drive that should be mounted using rclone 179 | # this must be in the form of `name:[/optional/path]` 180 | # this remote will be mounted at `/data/name` in the PMS container 181 | remotes: [] 182 | 183 | # -- If the remote volumes should be mounted as read only 184 | readOnly: true 185 | 186 | # -- Additional arguments to give to rclone when mounting the volume 187 | additionalArgs: [] 188 | 189 | resources: {} 190 | # We usually recommend not to specify default resources and to leave this as a conscious 191 | # choice for the user. This also increases chances charts run on environments with little 192 | # resources, such as Minikube. If you do want to specify resources, uncomment the following 193 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. 194 | # limits: 195 | # cpu: 100m 196 | # memory: 128Mi 197 | # requests: 198 | # cpu: 100m 199 | # memory: 128Mi 200 | 201 | imagePullSecrets: [] 202 | nameOverride: "" 203 | fullnameOverride: "" 204 | 205 | serviceAccount: 206 | # -- Specifies whether a service account should be created 207 | create: true 208 | # -- If the service account token should be auto mounted 209 | automountServiceAccountToken: false 210 | # -- Annotations to add to the service account 211 | annotations: {} 212 | # -- The name of the service account to use. 213 | # If not set and create is true, a name is generated using the fullname template 214 | name: "" 215 | 216 | statefulSet: 217 | # -- Optional extra annotations to add to the service resource 218 | annotations: {} 219 | # -- Optional extra annotations to add to the pods in the statefulset 220 | podAnnotations: {} 221 | 222 | service: 223 | type: ClusterIP 224 | port: 32400 225 | 226 | # -- Deprecated: Pre-defined IP address of the PMS service. 227 | # Used by cloud providers to connect the resulting load balancer service to a 228 | # pre-existing static IP. 229 | # Users are encouraged to use implementation-specific annotations when available instead. 230 | # Ref: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer 231 | # loadBalancerIP: "" 232 | 233 | # Port to use when type of service is "NodePort" (32400 by default) 234 | # nodePort: 32400 235 | 236 | # when NodePort is used, plex is unable to determine user IP 237 | # all traffic seems to come from within the cluster 238 | # setting this to 'Local' will allow Plex to determine the actual IP of user. 239 | # used to determine bitrate for remote transcoding 240 | # but the pods can only be accessed by the Node IP where the pod is running 241 | # Read more here: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip 242 | # https://access.redhat.com/solutions/7028639 243 | # externalTrafficPolicy: Local 244 | 245 | # -- Optional extra annotations to add to the service resource 246 | annotations: {} 247 | 248 | nodeSelector: {} 249 | 250 | tolerations: [] 251 | 252 | affinity: {} 253 | 254 | priorityClassName: "" 255 | 256 | # -- Common Labels for all resources created by this chart. 257 | commonLabels: {} 258 | 259 | extraEnv: {} 260 | # extraEnv: 261 | # This claim is optional, and is only used for the first startup of PMS 262 | # The claim is obtained from https://www.plex.tv/claim/ is is only valid for a few minutes 263 | # PLEX_CLAIM: "claim" 264 | # HOSTNAME: "PlexServer" 265 | # TZ: "Etc/UTC" 266 | # PLEX_UPDATE_CHANNEL: "5" 267 | # PLEX_UID: "uid of plex user" 268 | # PLEX_GID: "group id of plex user" 269 | # a list of CIDRs that can use the server without authentication 270 | # this is only used for the first startup of PMS 271 | # ALLOWED_NETWORKS: "0.0.0.0/0" 272 | 273 | # -- Optionally specify additional volume mounts for the PMS and init containers. 274 | extraVolumeMounts: [] 275 | # extraVolumeMounts: 276 | # - name: dev-dri 277 | # mountPath: /dev/dri 278 | 279 | # -- Optionally specify additional volumes for the pod. 280 | extraVolumes: [] 281 | # extraVolumes: 282 | # - name: dev-dri 283 | # hostPath: 284 | # path: /dev/dri 285 | # type: Directory 286 | 287 | extraContainers: [] 288 | # extraContainers: 289 | # - name: 290 | # args: 291 | # - ... 292 | # image: 293 | # imagePullPolicy: IfNotPresent 294 | # resources: 295 | # limits: 296 | # memory: 128Mi 297 | # requests: 298 | # cpu: 100m 299 | # memory: 128Mi 300 | # volumeMounts: 301 | # - ... 302 | -------------------------------------------------------------------------------- /docker-compose-bridge.yml.template: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | plex: 4 | container_name: plex 5 | image: plexinc/pms-docker 6 | restart: unless-stopped 7 | ports: 8 | - 32400:32400/tcp 9 | - 8324:8324/tcp 10 | - 32469:32469/tcp 11 | - 1900:1900/udp 12 | - 32410:32410/udp 13 | - 32412:32412/udp 14 | - 32413:32413/udp 15 | - 32414:32414/udp 16 | environment: 17 | - TZ= 18 | - PLEX_CLAIM= 19 | - ADVERTISE_IP=http://:32400/ 20 | hostname: 21 | volumes: 22 | - :/config 23 | - :/transcode 24 | - :/data 25 | -------------------------------------------------------------------------------- /docker-compose-host.yml.template: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | plex: 4 | container_name: plex 5 | image: plexinc/pms-docker 6 | restart: unless-stopped 7 | environment: 8 | - TZ= 9 | - PLEX_CLAIM= 10 | network_mode: host 11 | volumes: 12 | - :/config 13 | - :/transcode 14 | - :/data 15 | -------------------------------------------------------------------------------- /docker-compose-macvlan.yml.template: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | plex: 4 | container_name: plex 5 | image: plexinc/pms-docker 6 | restart: unless-stopped 7 | environment: 8 | - TZ= 9 | - PLEX_CLAIM= 10 | networks: 11 | physical: 12 | ipv4_address: 13 | hostname: 14 | volumes: 15 | - :/config 16 | - :/transcode 17 | - :/data 18 | networks: 19 | physical: 20 | external: true 21 | -------------------------------------------------------------------------------- /img/plex-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plexinc/pms-docker/c15cb5d9bc43b1a46cd323bf2017d1f151d677d1/img/plex-server.png -------------------------------------------------------------------------------- /plex-unRAID.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | False 4 | MediaServer:Video MediaServer:Music MediaServer:Photos 5 | 2017-01-30 6 | 7 | [a href='https://forums.plex.tv/discussion/62832/plex-media-server#latest' target='_blank']Latest Plex Media Server changes[/a] 8 | 9 | Plex Media Server 10 | https://forums.plex.tv/categories/docker 11 | 12 | [b]Plex Media Server[/b][br][br] 13 | 14 | Enjoy your media on all your devices.[br] 15 | All your movie, TV Show, music, and photo collections at your fingertips, anywhere you go on all the devices you love. 16 | 17 | https://plex.tv/ 18 | https://hub.docker.com/r/plexinc/pms-docker/ 19 | plexinc/pms-docker 20 | true 21 | false 22 | 23 | 24 | PLEX_CLAIM 25 | Insert Token from https://plex.tv/claim 26 | 27 | 28 | PLEX_UID 29 | 99 30 | 31 | 32 | PLEX_GID 33 | 100 34 | 35 | 36 | VERSION 37 | latest 38 | 39 | 40 | 41 | host 42 | 43 | 44 | 45 | 46 | 47 | /config 48 | rw 49 | 50 | 51 | 52 | /transcode 53 | rw 54 | 55 | 56 | 57 | /data 58 | rw 59 | 60 | 61 | http://[IP]:[PORT:32400]/web 62 | https://raw.githubusercontent.com/plexinc/pms-docker/master/img/plex-server.png 63 | 64 | 65 | -------------------------------------------------------------------------------- /root/etc/cont-init.d/40-plex-first-run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | # If we are debugging, enable trace 4 | if [ "${DEBUG,,}" = "true" ]; then 5 | set -x 6 | fi 7 | 8 | # If the first run completed successfully, we are done 9 | if [ -e /.firstRunComplete ]; then 10 | exit 0 11 | fi 12 | 13 | function getPref { 14 | local key="$1" 15 | 16 | xmlstarlet sel -T -t -m "/Preferences" -v "@${key}" -n "${prefFile}" 17 | } 18 | 19 | function setPref { 20 | local key="$1" 21 | local value="$2" 22 | 23 | count="$(xmlstarlet sel -t -v "count(/Preferences/@${key})" "${prefFile}")" 24 | count=$(($count + 0)) 25 | if [[ $count > 0 ]]; then 26 | xmlstarlet ed --inplace --update "/Preferences/@${key}" -v "${value}" "${prefFile}" 27 | else 28 | xmlstarlet ed --inplace --insert "/Preferences" --type attr -n "${key}" -v "${value}" "${prefFile}" 29 | fi 30 | } 31 | 32 | home="$(echo ~plex)" 33 | [ -f /etc/default/plexmediaserver ] && . /etc/default/plexmediaserver 34 | pmsApplicationSupportDir="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-${home}/Library/Application Support}" 35 | prefFile="${pmsApplicationSupportDir}/Plex Media Server/Preferences.xml" 36 | 37 | # Setup user/group ids 38 | if [ ! -z "${PLEX_UID}" ]; then 39 | if [ ! "$(id -u plex)" -eq "${PLEX_UID}" ]; then 40 | 41 | # usermod likes to chown the home directory, so create a new one and use that 42 | # However, if the new UID is 0, we can't set the home dir back because the 43 | # UID of 0 is already in use (executing this script). 44 | if [ ! "${PLEX_UID}" -eq 0 ]; then 45 | mkdir /tmp/temphome 46 | usermod -d /tmp/temphome plex 47 | fi 48 | 49 | # Change the UID 50 | usermod -o -u "${PLEX_UID}" plex 51 | 52 | # Cleanup the temp home dir 53 | if [ ! "${PLEX_UID}" -eq 0 ]; then 54 | usermod -d /config plex 55 | rm -Rf /tmp/temphome 56 | fi 57 | fi 58 | fi 59 | 60 | if [ ! -z "${PLEX_GID}" ]; then 61 | if [ ! "$(id -g plex)" -eq "${PLEX_GID}" ]; then 62 | groupmod -o -g "${PLEX_GID}" plex 63 | fi 64 | fi 65 | 66 | # Update ownership of dirs we need to write 67 | if [ "${CHANGE_CONFIG_DIR_OWNERSHIP,,}" = "true" ]; then 68 | if [ -f "${prefFile}" ]; then 69 | if [ ! "$(stat -c %u "${prefFile}")" = "$(id -u plex)" ]; then 70 | find /config \! \( -uid $(id -u plex) -gid $(id -g plex) \) -print0 | xargs -0 chown -h plex:plex 71 | fi 72 | else 73 | find /config \! \( -uid $(id -u plex) -gid $(id -g plex) \) -print0 | xargs -0 chown -h plex:plex 74 | fi 75 | chown -R plex:plex /transcode 76 | fi 77 | 78 | # Create empty shell pref file if it doesn't exist already 79 | if [ ! -e "${prefFile}" ]; then 80 | echo "Creating pref shell" 81 | mkdir -p "$(dirname "${prefFile}")" 82 | cat > "${prefFile}" <<-EOF 83 | 84 | 85 | EOF 86 | chown -R plex:plex "$(dirname "${prefFile}")" 87 | fi 88 | 89 | # Setup Server's client identifier 90 | serial="$(getPref "MachineIdentifier")" 91 | if [ -z "${serial}" ]; then 92 | serial="$(uuidgen)" 93 | setPref "MachineIdentifier" "${serial}" 94 | fi 95 | clientId="$(getPref "ProcessedMachineIdentifier")" 96 | if [ -z "${clientId}" ]; then 97 | clientId="$(echo -n "${serial}- Plex Media Server" | sha1sum | cut -b 1-40)" 98 | setPref "ProcessedMachineIdentifier" "${clientId}" 99 | fi 100 | 101 | # Get server token and only turn claim token into server token if we have former but not latter. 102 | token="$(getPref "PlexOnlineToken")" 103 | if [ -z "${PLEX_CLAIM}" ] && [ -f "${PLEX_CLAIM_FILE}" ]; then 104 | PLEX_CLAIM=$(cat ${PLEX_CLAIM_FILE}) 105 | fi 106 | if [ ! -z "${PLEX_CLAIM}" ] && [ -z "${token}" ]; then 107 | echo "Attempting to obtain server token from claim token" 108 | loginInfo="$(curl -X POST \ 109 | -H 'X-Plex-Client-Identifier: '${clientId} \ 110 | -H 'X-Plex-Product: Plex Media Server'\ 111 | -H 'X-Plex-Version: 1.1' \ 112 | -H 'X-Plex-Provides: server' \ 113 | -H 'X-Plex-Platform: Linux' \ 114 | -H 'X-Plex-Platform-Version: 1.0' \ 115 | -H 'X-Plex-Device-Name: PlexMediaServer' \ 116 | -H 'X-Plex-Device: Linux' \ 117 | "https://plex.tv/api/claim/exchange?token=${PLEX_CLAIM}")" 118 | token="$(echo "$loginInfo" | sed -n 's/.*\(.*\)<\/authentication-token>.*/\1/p')" 119 | 120 | if [ "$token" ]; then 121 | echo "Token obtained successfully" 122 | setPref "PlexOnlineToken" "${token}" 123 | fi 124 | fi 125 | 126 | if [ ! -z "${ADVERTISE_IP}" ]; then 127 | setPref "customConnections" "${ADVERTISE_IP}" 128 | fi 129 | 130 | if [ ! -z "${ALLOWED_NETWORKS}" ]; then 131 | setPref "allowedNetworks" "${ALLOWED_NETWORKS}" 132 | fi 133 | 134 | # Set transcoder temp if not yet set 135 | if [ -z "$(getPref "TranscoderTempDirectory")" ]; then 136 | setPref "TranscoderTempDirectory" "/transcode" 137 | fi 138 | 139 | touch /.firstRunComplete 140 | echo "Plex Media Server first run setup complete" 141 | -------------------------------------------------------------------------------- /root/etc/cont-init.d/45-plex-hw-transcode-and-connected-tuner: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | # Check to make sure the devices exists. If not, exit as there is nothing for us to do 4 | if [ ! -e /dev/dri ] && [ ! -e /dev/dvb ]; then 5 | exit 0 6 | fi 7 | 8 | FILES=$(find /dev/dri /dev/dvb -type c -print 2>/dev/null) 9 | GROUP_COUNT=1 10 | 11 | for i in $FILES 12 | do 13 | # Get the group ID for the dri or dvb device. 14 | DEVICE_GID=$(stat -c '%g' "$i") 15 | # Get the group name (if it exists) 16 | CURRENT_GROUP=$(getent group "${DEVICE_GID}" | awk -F: '{print $1}') 17 | 18 | # If it doesn't exist, create a new group name and assign it to the device GID 19 | if [ -z "${CURRENT_GROUP}" ]; then 20 | CURRENT_GROUP=video${GROUP_COUNT} 21 | groupadd -g "${DEVICE_GID}" "${CURRENT_GROUP}" 22 | fi 23 | 24 | # If plex user isn't part of this group, add them 25 | if [ ! $(getent group "${CURRENT_GROUP}" | grep &>/dev/null plex) ]; then 26 | usermod -a -G "${CURRENT_GROUP}" plex 27 | fi 28 | 29 | GROUP_COUNT=$(($GROUP_COUNT + 1)) 30 | done 31 | 32 | -------------------------------------------------------------------------------- /root/etc/cont-init.d/50-plex-update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | # If we are debugging, enable trace 4 | if [ "${DEBUG,,}" = "true" ]; then 5 | set -x 6 | fi 7 | 8 | . /plex-common.sh 9 | 10 | function getPref { 11 | local key="$1" 12 | 13 | xmlstarlet sel -T -t -m "/Preferences" -v "@${key}" -n "${prefFile}" 14 | } 15 | 16 | # Get token 17 | [ -f /etc/default/plexmediaserver ] && . /etc/default/plexmediaserver 18 | pmsApplicationSupportDir="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-${HOME}/Library/Application Support}" 19 | prefFile="${pmsApplicationSupportDir}/Plex Media Server/Preferences.xml" 20 | token="$(getPref "PlexOnlineToken")" 21 | 22 | # Determine current version 23 | if (dpkg --get-selections plexmediaserver 2> /dev/null | grep -wq "install"); then 24 | installedVersion=$(dpkg-query -W -f='${Version}' plexmediaserver 2> /dev/null) 25 | else 26 | installedVersion="none" 27 | fi 28 | 29 | # Read set version 30 | readVarFromConf "version" versionToInstall 31 | if [ -z "${versionToInstall}" ]; then 32 | echo "No version specified in install. Broken image" 33 | exit 1 34 | fi 35 | 36 | # Short-circuit test of version before remote check to see if it's already installed. 37 | if [ "${versionToInstall}" = "${installedVersion}" ]; then 38 | exit 0 39 | fi 40 | 41 | # Get updated version number 42 | getVersionInfo "${versionToInstall}" "${token}" remoteVersion remoteFile 43 | 44 | if [ -z "${remoteVersion}" ] || [ -z "${remoteFile}" ]; then 45 | echo "Could not get update version" 46 | exit 0 47 | fi 48 | 49 | # Check if there's no update required 50 | if [ "${remoteVersion}" = "${installedVersion}" ]; then 51 | exit 0 52 | fi 53 | 54 | # Do update process 55 | echo "Attempting to upgrade to: ${remoteVersion}" 56 | installFromUrl "${remoteFile}" 57 | -------------------------------------------------------------------------------- /root/etc/services.d/plex/finish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | # Copied from the init.d stop method from non-Dockerized Plex. 3 | 4 | echo "Stopping Plex Media Server." 5 | 6 | # Ask nicely 7 | pids="$(ps -ef | grep 'Plex Media Server' | grep -v grep | awk '{print $2}')" 8 | kill -15 $pids 9 | 10 | sleep 5 11 | 12 | # Stuck 13 | pids="$(ps -ef | grep /usr/lib/plexmediaserver | grep -v grep | awk '{print $2}')" 14 | 15 | if [ "$pids" != "" ]; then 16 | kill -9 $pids 17 | sleep 2 18 | fi 19 | -------------------------------------------------------------------------------- /root/etc/services.d/plex/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bash 2 | 3 | echo "Starting Plex Media Server." 4 | home="$(echo ~plex)" 5 | export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-${home}/Library/Application Support}" 6 | export PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver 7 | export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6 8 | export PLEX_MEDIA_SERVER_INFO_VENDOR=Docker 9 | export PLEX_MEDIA_SERVER_INFO_DEVICE="Docker Container" 10 | export PLEX_MEDIA_SERVER_INFO_MODEL=$(uname -m) 11 | export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(uname -r) 12 | 13 | if [ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]; then 14 | /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" 15 | chown plex:plex "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" 16 | fi 17 | 18 | exec s6-setuidgid plex /usr/lib/plexmediaserver/Plex\ Media\ Server 19 | -------------------------------------------------------------------------------- /root/etc/services.d/plex/timeout-finish: -------------------------------------------------------------------------------- 1 | 8000 2 | -------------------------------------------------------------------------------- /root/healthcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | TARGET=localhost 4 | CURL_OPTS="--connect-timeout 15 --max-time 100 --silent --show-error --fail" 5 | 6 | curl ${CURL_OPTS} "http://${TARGET}:32400/identity" >/dev/null 7 | 8 | -------------------------------------------------------------------------------- /root/installBinary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /plex-common.sh 4 | 5 | PLEX_BUILD='' 6 | if [ "${TARGETPLATFORM}" = 'linux/arm/v7' ]; then 7 | PLEX_BUILD='linux-armv7hf_neon' 8 | elif [ "${TARGETARCH}" = 'amd64' ]; then 9 | PLEX_BUILD='linux-x86_64'; 10 | elif [ "${TARGETARCH}" = 'arm64' ]; then 11 | PLEX_BUILD='linux-aarch64' ; 12 | fi 13 | 14 | addVarToConf "version" "${TAG}" 15 | addVarToConf "plex_build" "${PLEX_BUILD}" 16 | addVarToConf "plex_distro" "${PLEX_DISTRO}" 17 | 18 | if [ ! -z "${URL}" ]; then 19 | echo "Attempting to install from URL: ${URL}" 20 | installFromRawUrl "${URL}" 21 | elif [ "${TAG}" != "beta" ] && [ "${TAG}" != "public" ]; then 22 | getVersionInfo "${TAG}" "" remoteVersion remoteFile 23 | 24 | if [ -z "${remoteVersion}" ] || [ -z "${remoteFile}" ]; then 25 | echo "Could not get install version" 26 | exit 1 27 | fi 28 | 29 | echo "Attempting to install: ${remoteVersion}" 30 | installFromUrl "${remoteFile}" 31 | fi 32 | -------------------------------------------------------------------------------- /root/plex-common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONT_CONF_FILE="/version.txt" 4 | 5 | function addVarToConf { 6 | local variable="$1" 7 | local value="$2" 8 | if [ ! -z "${variable}" ]; then 9 | echo ${variable}=${value} >> ${CONT_CONF_FILE} 10 | fi 11 | } 12 | 13 | function readVarFromConf { 14 | local variable="$1" 15 | local -n readVarFromConf_value=$2 16 | if [ ! -z "${variable}" ]; then 17 | readVarFromConf_value="$(grep -w ${variable} ${CONT_CONF_FILE} | cut -d'=' -f2 | tail -n 1)" 18 | else 19 | readVarFromConf_value=NULL 20 | fi 21 | } 22 | 23 | function getVersionInfo { 24 | local version="$1" 25 | local token="$2" 26 | local -n getVersionInfo_remoteVersion=$3 27 | local -n getVersionInfo_remoteFile=$4 28 | 29 | local channel 30 | local tokenNeeded=1 31 | if [ ! -z "${PLEX_UPDATE_CHANNEL}" ] && [ "${PLEX_UPDATE_CHANNEL}" > 0 ]; then 32 | channel="${PLEX_UPDATE_CHANNEL}" 33 | elif [ "${version,,}" = "beta" ]; then 34 | channel=8 35 | elif [ "${version,,}" = "public" ]; then 36 | channel=16 37 | tokenNeeded=0 38 | else 39 | channel=8 40 | fi 41 | 42 | # Read container architecture info from file created when building Docker image 43 | readVarFromConf "plex_build" plexBuild 44 | readVarFromConf "plex_distro" plexDistro 45 | 46 | local url="https://plex.tv/downloads/details/5?build=${plexBuild}&channel=${channel}&distro=${plexDistro}" 47 | if [ ${tokenNeeded} -gt 0 ]; then 48 | url="${url}&X-Plex-Token=${token}" 49 | fi 50 | 51 | local versionInfo="$(curl -s "${url}")" 52 | 53 | # Get update info from the XML. Note: This could countain multiple updates when user specifies an exact version with the lowest first, so we'll use first always. 54 | getVersionInfo_remoteVersion=$(echo "${versionInfo}" | sed -n 's/.*Release.*version="\([^"]*\)".*/\1/p') 55 | getVersionInfo_remoteFile=$(echo "${versionInfo}" | sed -n 's/.*file="\([^"]*\)".*/\1/p') 56 | } 57 | 58 | 59 | function installFromUrl { 60 | installFromRawUrl "https://plex.tv/${1}" 61 | } 62 | 63 | function installFromRawUrl { 64 | local remoteFile="$1" 65 | curl -J -L -o /tmp/plexmediaserver.deb "${remoteFile}" 66 | local last=$? 67 | 68 | # test if deb file size is ok, or if download failed 69 | if [[ "$last" -gt "0" ]] || [[ $(stat -c %s /tmp/plexmediaserver.deb) -lt 10000 ]]; then 70 | echo "Failed to fetch update" 71 | exit 1 72 | fi 73 | 74 | dpkg -i --force-confold --force-architecture /tmp/plexmediaserver.deb 75 | rm -f /tmp/plexmediaserver.deb 76 | } 77 | -------------------------------------------------------------------------------- /root/plex_service.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -eq 1 ]; then 4 | s6-svc "$1" /var/run/s6/services/plex 5 | else 6 | echo "No argument supplied; must be -u, -d, or -r." 7 | fi 8 | --------------------------------------------------------------------------------