From c7c75b1c959654f16f6205e449069a57922a60a7 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Tue, 4 Apr 2023 23:25:14 -0500 Subject: [PATCH] :sparkles: (plex): Initial Plex chart release --- README.md | 1 + charts/plex/.helmignore | 25 ++++++ charts/plex/Chart.lock | 6 ++ charts/plex/Chart.yaml | 29 +++++++ charts/plex/README.md | 121 ++++++++++++++++++++++++++++ charts/plex/README_CONFIG.md.gotmpl | 35 ++++++++ charts/plex/icon.svg | 1 + charts/plex/templates/NOTES.txt | 16 ++++ charts/plex/templates/common.yaml | 85 +++++++++++++++++++ charts/plex/values.yaml | 52 ++++++++++++ 10 files changed, 371 insertions(+) create mode 100644 charts/plex/.helmignore create mode 100644 charts/plex/Chart.lock create mode 100644 charts/plex/Chart.yaml create mode 100644 charts/plex/README.md create mode 100644 charts/plex/README_CONFIG.md.gotmpl create mode 100644 charts/plex/icon.svg create mode 100644 charts/plex/templates/NOTES.txt create mode 100644 charts/plex/templates/common.yaml create mode 100644 charts/plex/values.yaml diff --git a/README.md b/README.md index 2db1dadb3..b6b05dfbc 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ helm delete my- | [obico obico icon](charts/obico/) | Obico is a community-built, open-source smart 3D printing platform used by makers, enthusiasts, and tinkerers around the world. | | [paperless-ngx paperless-ngx icon](charts/paperless-ngx/) | A community-supported supercharged version of paperless: scan, index and archive all your physical documents | | [pictshare pictshare icon](charts/pictshare/) | PictShare is an open source image, mp4, pastebin hosting service with a simple resizing and upload API that you can host yourself. | +| [plex plex icon](charts/plex/) | Plex organizes all of your personal media so you can enjoy it no matter where you are. | | [podgrab ](charts/podgrab/) | A self-hosted podcast manager to download episodes as soon as they become live. | | [portfolio portfolio icon](charts/portfolio/) | My personal portfolio website | | [qbittorrent qbittorrent icon](charts/qbittorrent/) | The qBittorrent project aims to provide an open-source software alternative to µTorrent. | diff --git a/charts/plex/.helmignore b/charts/plex/.helmignore new file mode 100644 index 000000000..f56cea6b7 --- /dev/null +++ b/charts/plex/.helmignore @@ -0,0 +1,25 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# helm-docs templates +*.gotmpl diff --git a/charts/plex/Chart.lock b/charts/plex/Chart.lock new file mode 100644 index 000000000..3ae8d71df --- /dev/null +++ b/charts/plex/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://bjw-s.github.io/helm-charts + version: 1.3.2 +digest: sha256:9bb4816882dfc02904f9f347a7995bf7acefd55bd60f925c3a8d80938a2b1ec0 +generated: "2023-04-04T23:04:20.101626-05:00" diff --git a/charts/plex/Chart.yaml b/charts/plex/Chart.yaml new file mode 100644 index 000000000..9471fb88b --- /dev/null +++ b/charts/plex/Chart.yaml @@ -0,0 +1,29 @@ +apiVersion: v2 +name: plex +description: Plex organizes all of your personal media so you can enjoy it no matter where you are. +home: https://charts.gabe565.com/charts/plex/ +icon: https://raw.githubusercontent.com/gabe565/charts/main/charts/plex/icon.svg +type: application +version: 0.0.1 +# renovate datasource=docker depName=ghcr.io/linuxserver/plex +appVersion: version-1.31.3.6868-28fc46b27 +kubeVersion: ">=1.22.0-0" +keywords: + - media +dependencies: + - name: common + repository: https://bjw-s.github.io/helm-charts + version: 1.3.2 +sources: + - https://plex.tv +annotations: + artifacthub.io/changes: |- + - kind: added + description: Initial release + artifacthub.io/links: |- + - name: App homepage + url: https://plex.tv + - name: Container Source + url: https://github.com/linuxserver/docker-plex + - name: Chart Source + url: https://github.com/gabe565/charts/tree/main/charts/plex diff --git a/charts/plex/README.md b/charts/plex/README.md new file mode 100644 index 000000000..e147c315d --- /dev/null +++ b/charts/plex/README.md @@ -0,0 +1,121 @@ +# plex + +plex logo + +![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat) +![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat) +![AppVersion: version-1.31.3.6868-28fc46b27](https://img.shields.io/badge/AppVersion-version--1.31.3.6868--28fc46b27-informational?style=flat) + +Plex organizes all of your personal media so you can enjoy it no matter where you are. + +**Homepage:** + +**This chart is not maintained by the upstream project and any issues with the chart should be raised +[here](https://github.com/gabe565/charts/issues/new?assignees=gabe565&labels=bug&template=bug_report.yaml&name=plex&version=0.0.1)** + +## Source Code + +* + +## Requirements + +Kubernetes: `>=1.22.0-0` + +## Dependencies + +| Repository | Name | Version | +|------------|------|---------| +| | common | 1.3.2 | + +## TL;DR + +```console +helm repo add gabe565 https://charts.gabe565.com +helm repo update +helm install plex gabe565/plex +``` + +## Installing the Chart + +To install the chart with the release name `plex` + +```console +helm install plex gabe565/plex +``` + +## Uninstalling the Chart + +To uninstall the `plex` deployment + +```console +helm uninstall plex +``` + +The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release. + +## Configuration + +Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values. +Other values may be used from the [values.yaml](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common/values.yaml) from the [bjw-s common library](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common). + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +```console +helm install plex \ + --set env.TZ="America/New York" \ + gabe565/plex +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. + +```console +helm install plex gabe565/plex -f values.yaml +``` + +## Custom configuration + +### Hardware Acceleration + +#### Intel QuickSync + +Hardware acceleration using an Intel iGPU with QuickSync requires the GPU plugin in +[intel-device-plugins-for-kubernetes](https://github.com/intel/intel-device-plugins-for-kubernetes). + +1. Install [intel/gpu-device-plugin](https://github.com/intel/helm-charts/tree/main/charts/gpu-device-plugin) + +2. Get the group IDs from your host: + ```sh + $ cat /etc/group | grep 'video\|render' + video:x:44: + render:x:109: + ``` + +3. Add the following to your `values.yaml`, replacing the `supplementalGroups` with your group IDs: + ```yaml + podSecurityContext: + supplementalGroups: [44, 109] + + resources: + requests: + gpu.intel.com/i915: 1 + limits: + gpu.intel.com/i915: 1 + ``` + +## Values + +**Important**: When deploying an application Helm chart you can add more values from the bjw-s common library chart [here](https://github.com/bjw-s/helm-charts/tree/main/charts/library/common) + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| env | object | See [values.yaml](./values.yaml) | Environment variables. [[ref]](https://github.com/linuxserver/docker-plex#parameters) | +| env.TZ | string | `"UTC"` | Set the container timezone | +| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| image.repository | string | `"ghcr.io/linuxserver/plex"` | image repository | +| image.tag | string | `"version-1.31.3.6868-28fc46b27"` | image tag | +| ingress.main | object | See [values.yaml](./values.yaml) | Enable and configure ingress settings for the chart under this key. | +| persistence.config | object | See [values.yaml](./values.yaml) | Configure persistence settings for the chart under this key. | +| service.main | object | See [values.yaml](./values.yaml) | Configures HTTP service settings for the chart. | + +--- +Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs) diff --git a/charts/plex/README_CONFIG.md.gotmpl b/charts/plex/README_CONFIG.md.gotmpl new file mode 100644 index 000000000..b4d331309 --- /dev/null +++ b/charts/plex/README_CONFIG.md.gotmpl @@ -0,0 +1,35 @@ +{{- define "custom.custom.configuration.header" -}} +## Custom configuration +{{- end -}} + +{{- define "custom.custom.configuration" -}} +{{ template "custom.custom.configuration.header" . }} + +### Hardware Acceleration + +#### Intel QuickSync + +Hardware acceleration using an Intel iGPU with QuickSync requires the GPU plugin in +[intel-device-plugins-for-kubernetes](https://github.com/intel/intel-device-plugins-for-kubernetes). + +1. Install [intel/gpu-device-plugin](https://github.com/intel/helm-charts/tree/main/charts/gpu-device-plugin) + +2. Get the group IDs from your host: + ```sh + $ cat /etc/group | grep 'video\|render' + video:x:44: + render:x:109: + ``` + +3. Add the following to your `values.yaml`, replacing the `supplementalGroups` with your group IDs: + ```yaml + podSecurityContext: + supplementalGroups: [44, 109] + + resources: + requests: + gpu.intel.com/i915: 1 + limits: + gpu.intel.com/i915: 1 + ``` +{{- end -}} diff --git a/charts/plex/icon.svg b/charts/plex/icon.svg new file mode 100644 index 000000000..e44e9bf6e --- /dev/null +++ b/charts/plex/icon.svg @@ -0,0 +1 @@ + diff --git a/charts/plex/templates/NOTES.txt b/charts/plex/templates/NOTES.txt new file mode 100644 index 000000000..590f993c0 --- /dev/null +++ b/charts/plex/templates/NOTES.txt @@ -0,0 +1,16 @@ +{{- include "bjw-s.common.lib.chart.notes" . -}} + +{{- $deploymentName := printf "deployments/%s" (include "bjw-s.common.lib.chart.names.fullname" .) }} + +2. Create a Namespace: + + kubectl rollout status {{ $deploymentName }} + kubectl exec -i {{ $deploymentName }} -- headscale users create myfirstnamespace + +3. Connect a Node: + + When you connect a node for the first time, a webpage will open with a + command to add the machine to your network. Run this command in the container. + For example: + + kubectl exec -i {{ $deploymentName }} -- headscale -n NAMESPACE nodes register --key KEY diff --git a/charts/plex/templates/common.yaml b/charts/plex/templates/common.yaml new file mode 100644 index 000000000..236a0fc6e --- /dev/null +++ b/charts/plex/templates/common.yaml @@ -0,0 +1,85 @@ +{{/* Append the hardcoded settings */}} +{{- define "headscale.harcodedValues" -}} +args: ["headscale", "serve"] + +initContainers: + config: + image: alpine + env: + - name: CONFIG_DIR + value: {{ .Values.persistence.config.mountPath }} + volumeMounts: + {{- if .Values.persistence.config.enabled }} + - name: config + mountPath: {{ .Values.persistence.config.mountPath }} + {{- end }} + command: + - sh + - -c + - | + if [[ -f "$CONFIG_DIR/config.yaml" ]]; then + echo 'Config already exists' >&2 + else + echo 'Writing empty config' >&2 + cat <<- 'EOF' >"$CONFIG_DIR/config.yaml" + # It's suggested to use environment variables to configure Headscale. + # For config reference, see https://github.com/juanfont/headscale/blob/main/config-example.yaml + # To configure any of these as an env: + # 1. Flatten object keys using "_" + # 2. Prefix with "HEADSCALE_" + # + # For example: + # - "listen_addr" becomes "HEADSCALE_LISTEN_ADDR" + # - "log.level" becomes "HEADSCALE_LOG_LEVEL" + EOF + fi + +env: + {{- with .Values.ingress.main }} + {{- if and .enabled .hosts }} + HEADSCALE_SERVER_URL: http{{ if .tls }}s{{ end }}://{{ (first .hosts).host }} + {{- end }} + {{- end }} + + {{- with .Values.service.main.ports }} + HEADSCALE_LISTEN_ADDR: "0.0.0.0:{{ .http.port }}" + HEADSCALE_METRICS_LISTEN_ADDR: "0.0.0.0:{{ .metrics.port }}" + {{- end }} + + HEADSCALE_PRIVATE_KEY_PATH: "{{ .Values.persistence.config.mountPath }}/private.key" + HEADSCALE_NOISE: "{}" + HEADSCALE_NOISE_PRIVATE_KEY_PATH: "{{ .Values.persistence.config.mountPath }}/noise_private.key" + + HEADSCALE_IP_PREFIXES: "fd7a:115c:a1e0::/48 100.64.0.0/10" + + HEADSCALE_DERP_URLS: "https://controlplane.tailscale.com/derpmap/default" + HEADSCALE_DERP_AUTO_UPDATE_ENABLED: "true" + HEADSCALE_DERP_UPDATE_FREQUENCY: "24h" + + HEADSCALE_EPHEMERAL_NODE_INACTIVITY_TIMEOUT: "30m" + + HEADSCALE_DNS_CONFIG_NAMESERVERS: "1.1.1.1 1.0.0.1" + HEADSCALE_DNS_CONFIG_MAGIC_DNS: "true" + + {{- with .Values.postgresql }} + {{- if .enabled }} + HEADSCALE_DB_TYPE: postgres + HEADSCALE_DB_HOST: {{ $.Release.Name }}-postgresql + HEADSCALE_DB_PORT: "5432" + HEADSCALE_DB_SSL: "false" + HEADSCALE_DB_NAME: {{ .auth.database }} + HEADSCALE_DB_USER: {{ default "postgres" .auth.username }} + HEADSCALE_DB_PASS: + secretKeyRef: + name: {{ $.Release.Name }}-postgresql + key: {{ if not .auth.password }}postgres-{{ end }}password + {{- else }} + HEADSCALE_DB_TYPE: "sqlite3" + HEADSCALE_DB_PATH: "{{ $.Values.persistence.config.mountPath }}/db.sqlite" + {{- end }} + {{- end }} +{{- end -}} +{{- $_ := merge .Values (include "headscale.harcodedValues" . | fromYaml) -}} + +{{/* Render the templates */}} +{{ include "bjw-s.common.loader.all" . }} diff --git a/charts/plex/values.yaml b/charts/plex/values.yaml new file mode 100644 index 000000000..052f98b43 --- /dev/null +++ b/charts/plex/values.yaml @@ -0,0 +1,52 @@ +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/values.yaml +# + +image: + # -- image repository + repository: ghcr.io/linuxserver/plex + # -- image pull policy + pullPolicy: IfNotPresent + # -- image tag + tag: version-1.31.3.6868-28fc46b27 + +# -- Environment variables. [[ref]](https://github.com/linuxserver/docker-plex#parameters) +# @default -- See [values.yaml](./values.yaml) +env: + # -- Set the container timezone + TZ: UTC + +service: + # -- Configures HTTP service settings for the chart. + # @default -- See [values.yaml](./values.yaml) + main: + ports: + http: + port: 32400 + +ingress: + # -- Enable and configure ingress settings for the chart under this key. + # @default -- See [values.yaml](./values.yaml) + main: + enabled: false + # hosts: + # - host: chart-example.local + # paths: + # - path: / + # tls: + # - secretName: chart-example.local-tls + # hosts: + # - chart-example.local + +persistence: + # -- Configure persistence settings for the chart under this key. + # @default -- See [values.yaml](./values.yaml) + config: + enabled: false + retain: true + # storageClass: "" + # accessMode: ReadWriteOnce + # size: 1Gi