commit 3faa49b7efcae5d63b0015a7eb1e62f26cfcbfdc Author: atusa-bw Date: Sat Sep 24 12:30:14 2022 -0600 Added initial commit files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa9c40f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +temp*.yaml +base/plex*.yaml \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b43fa73 --- /dev/null +++ b/README.md @@ -0,0 +1,122 @@ +![test](https://github.com/fabito/htk8s/workflows/test/badge.svg) + +# HTPC powered by k3s + +![htk8s diagrams](https://docs.google.com/drawings/d/e/2PACX-1vSsQfsfgHiHi0l-1w6pZhCYX-xz2xJNVwMrnKclkqYdEd6dIGJY9soY2lgtm1gyOnNSTYRbYkqvYCWU/pub?w=1373&h=612) + +This is my current [HTPC](https://en.wikipedia.org/wiki/Home_theater_PC) setup. It runs on [k3s](https://k3s.io/) - a lightweight and easy to install Kubernetes distribution. +It includes the following applications: + +* [Sonarr](https://sonarr.tv/) for tv shows +* [Radarr](https://radarr.video/) for movies +* [Bazarr](https://github.com/morpheus65535/bazarr) for subtitles +* Transmission for torrents +* [Jackett](https://github.com/Jackett/Jackett) +* [Emby](https://emby.media/) + +Applications state (settings / db) and media files are stored in a shared volume of type `hostPath`. It does not use PVC and currently only works if the whole `htpc` namespace is deployed in the same node. + +## Getting Started + +### Quickstart + +```bash +# for x86_64 +kubectl apply -f https://raw.githubusercontent.com/fabito/htk8s/v0.1/install_x86_64.yaml + +# for raspberry pi (ARM) +kubectl apply -f https://raw.githubusercontent.com/fabito/htk8s/v0.1/install_armhf.yaml +``` + +### The Gitops way + +![argocd htpc application](https://drive.google.com/uc?id=1KI_7GVcP7QFWhQEiqS9Q4azE7-gpso2M) + + +```bash +# x86_64 only +kubectl apply -f https://raw.githubusercontent.com/fabito/htk8s/v0.1/install_argocd.yaml +``` + +This alternate manifest will install [Argo CD](https://github.com/argoproj/argo-cd) along with the [htpc application](argocd/application.yaml). Then it will monitor this repo for changes and apply them to the cluster accordingly (more specifically the `overlays/x86`overlay). + +You can access the Argo CD ui at: https://localhost/argocd. + +### Verifying the installation + +All resources are created in the `htpc` namespace. So if you run: + +```bash +k3s kubectl get all -n htpc +``` + +You should get something similar to: + +```bash +NAME READY STATUS RESTARTS AGE +pod/bazarr-795f88c5c9-w75l7 1/1 Running 0 24h +pod/emby-6f457df664-fqbmc 1/1 Running 0 24h +pod/jackett-6bcf6cd8d6-lrh6j 1/1 Running 0 24h +pod/radarr-5c965c7678-zt8sq 1/1 Running 0 24h +pod/sonarr-b65c8956-mxng4 1/1 Running 0 24h +pod/transmission-5f7fdc6cb5-nrtbb 1/1 Running 0 24h + +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +service/bazarr ClusterIP 10.43.43.224 6767/TCP 24h +service/emby ClusterIP 10.43.212.198 8096/TCP 24h +service/jackett ClusterIP 10.43.104.233 9117/TCP 24h +service/radarr ClusterIP 10.43.141.101 7878/TCP 24h +service/sonarr ClusterIP 10.43.35.98 8989/TCP 24h +service/transmission ClusterIP 10.43.184.198 9091/TCP 24h + +NAME READY UP-TO-DATE AVAILABLE AGE +deployment.apps/bazarr 1/1 1 1 24h +deployment.apps/emby 1/1 1 1 24h +deployment.apps/jackett 1/1 1 1 24h +deployment.apps/radarr 1/1 1 1 24h +deployment.apps/sonarr 1/1 1 1 24h +deployment.apps/transmission 1/1 1 1 24h + +NAME DESIRED CURRENT READY AGE +replicaset.apps/bazarr-795f88c5c9 1 1 1 24h +replicaset.apps/emby-6f457df664 1 1 1 24h +replicaset.apps/jackett-6bcf6cd8d6 1 1 1 24h +replicaset.apps/radarr-5c965c7678 1 1 1 24h +replicaset.apps/sonarr-b65c8956 1 1 1 24h +replicaset.apps/transmission-5f7fdc6cb5 1 1 1 24h +``` + +You should also be able to reach each component's ui using the links below. Don't forget to replace `localhost` by the IP or the server name running k3s. + +|App|URI +|---|--- +|radarr|http://localhost/radarr +|sonarr|http://localhost/sonarr +|bazarr|http://localhost/bazarr +|jacket|http://localhost/jackett +|transmission|http://localhost/transmission +|emby|http://localhost/ + +Check the [ingress.yaml](base/ingress.yaml) for more details. + +Each module except for Emby is configured to respond on a custom basepath (check the init containers logic for more details). + +## How it works (WIP) + +It uses [LinuxServers](https://www.linuxserver.io/our-images/) images. + +It uses a `hostPath` volume to store configuration and media files. It defaults to the `/opt/htpc` directory + +```bash +/opt/htpc +├── bazarr +├── downloads +├── emby +├── jackett +├── media +│   ├── movies +│   └── tv +├── radarr +├── sonarr +└── transmission +``` diff --git a/base/bazarr.yaml b/base/bazarr.yaml new file mode 100644 index 0000000..ae5a363 --- /dev/null +++ b/base/bazarr.yaml @@ -0,0 +1,131 @@ +apiVersion: v1 +kind: Service +metadata: + name: bazarr +spec: + ports: + - port: 6767 + protocol: TCP + targetPort: 6767 + name: webui + selector: + run: bazarr +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + run: bazarr + name: bazarr +spec: + replicas: 1 + selector: + matchLabels: + run: bazarr + template: + metadata: + labels: + run: bazarr + spec: + securityContext: + # runAsUser: 1000 + # runAsGroup: 1000 + fsGroup: 1000 + initContainers: + - name: wait-for-sonarr-and-radarr + image: busybox + command: ['sh', '-c', 'until wget -qO- sonarr:8989/sonarr &> /dev/null && wget -qO- radarr:7878/radarr &> /dev/null; do echo waiting for sonarr and radarr; sleep 2; done;'] + - name: config + image: busybox + command: + - "sh" + - "-c" + - | + mkdir -p /htpc/bazarr/config + export RADARR_API_KEY=$(cat /htpc/radarr/config.xml | sed -ne "/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}") + export SONARR_API_KEY=$(cat /htpc/sonarr/config.xml | sed -ne "/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}") + cat << EOF > /htpc/bazarr/config/config.ini + [sonarr] + apikey = ${SONARR_API_KEY} + full_update = Daily + ip = $(SONARR) + only_monitored = False + base_url = /$(SONARR) + ssl = False + port = 8989 + + [radarr] + apikey = ${RADARR_API_KEY} + full_update = Daily + ip = $(RADARR) + only_monitored = False + base_url = /$(RADARR) + ssl = False + port = 7878 + + [general] + movie_default_hi = False + movie_default_language = [] + ip = 0.0.0.0 + use_scenename = True + use_postprocessing = False + enabled_providers = subscene,tvsubtitles + auto_update = True + port = 6767 + use_radarr = True + base_url = /bazarr/ + page_size = 25 + minimum_score_movie = 70 + branch = master + single_language = False + use_sonarr = True + serie_default_hi = False + path_mappings_movie = [['/movies', '/movies'], ['', ''], ['', ''], ['', ''], ['', '']] + serie_default_enabled = False + movie_default_enabled = False + serie_default_language = [] + path_mappings = [['/tv', '/tv'], ['', ''], ['', ''], ['', ''], ['', '']] + postprocessing_cmd = + minimum_score = 90 + debug = False + use_embedded_subs = True + adaptive_searching = False + EOF + volumeMounts: + - mountPath: /htpc + name: htpc-home + containers: + - env: + - name: TZ + value: America/Denver + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/bazarr + name: bazarr + # livenessProbe: + # httpGet: + # path: /bazarr + # port: webui + # initialDelaySeconds: 200 + # periodSeconds: 15 + # readinessProbe: + # httpGet: + # path: /bazarr + # port: webui + # initialDelaySeconds: 200 + # periodSeconds: 15 + ports: + - containerPort: 6767 + name: webui + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: bazarr + - mountPath: /movies + name: htpc-home + subPath: media/movies + - mountPath: /tv + name: htpc-home + subPath: media/tv diff --git a/base/emby.yaml b/base/emby.yaml new file mode 100644 index 0000000..6e1e9f6 --- /dev/null +++ b/base/emby.yaml @@ -0,0 +1,58 @@ +apiVersion: v1 +kind: Service +metadata: + name: emby +spec: + ports: + - port: 8096 + protocol: TCP + targetPort: 8096 + name: webui + selector: + run: emby +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + run: emby + name: emby +spec: + replicas: 1 + selector: + matchLabels: + run: emby + template: + metadata: + labels: + run: emby + spec: + securityContext: + fsGroup: 1000 + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: UID + value: "1000" + - name: GID + value: "1000" + image: emby/embyserver + name: emby + ports: + - containerPort: 8096 + name: webui + protocol: TCP + - containerPort: 8920 + name: webui-ssl + protocol: TCP + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: emby + - mountPath: /tv + name: htpc-home + subPath: media/tv + - mountPath: /movies + name: htpc-home + subPath: media/movies diff --git a/base/env.yaml b/base/env.yaml new file mode 100644 index 0000000..15cabd1 --- /dev/null +++ b/base/env.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Deployment +metadata: + name: transmission +spec: + template: + spec: + containers: + - name: transmission + env: + - name: TZ + value: America/Denver + - name: PUID + value: "1000" + - name: PGID + value: "1000" diff --git a/base/env_variables_patch.yaml b/base/env_variables_patch.yaml new file mode 100644 index 0000000..602d9ee --- /dev/null +++ b/base/env_variables_patch.yaml @@ -0,0 +1,12 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: transmission +spec: + template: + spec: + containers: + - name: transmission + env: + - name: TZ + value: America/Denver diff --git a/base/ingress.yaml b/base/ingress.yaml new file mode 100644 index 0000000..a936200 --- /dev/null +++ b/base/ingress.yaml @@ -0,0 +1,64 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: htpc +spec: + rules: + - http: + paths: + - path: / + pathType: Exact + backend: + service: + name: emby + port: + number: 8096 + - path: /jackett + pathType: Exact + backend: + service: + name: jackett + port: + number: 9117 + - path: /sonarr + pathType: Exact + backend: + service: + name: sonarr + port: + number: 8989 + - path: /radarr + pathType: Exact + backend: + service: + name: radarr + port: + number: 7878 + - path: /bazarr + pathType: Exact + backend: + service: + name: bazarr + port: + number: 6767 + - path: /transmission + pathType: Exact + backend: + service: + name: transmission + port: + number: 9091 + - path: /plex + pathType: Exact + backend: + service: + name: plex + port: + number: 32400 + - path: /prowlarr + pathType: Exact + backend: + service: + name: prowlarr + port: + number: 9696 diff --git a/base/jackett.yaml b/base/jackett.yaml new file mode 100644 index 0000000..5b61d00 --- /dev/null +++ b/base/jackett.yaml @@ -0,0 +1,66 @@ +apiVersion: v1 +kind: Service +metadata: + name: jackett +spec: + ports: + - port: 9117 + protocol: TCP + targetPort: 9117 + name: webui + selector: + run: jackett +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + run: jackett + name: jackett +spec: + replicas: 1 + selector: + matchLabels: + run: jackett + template: + metadata: + labels: + run: jackett + spec: + securityContext: + # runAsUser: 1000 + # runAsGroup: 1000 + fsGroup: 1000 + initContainers: + - name: config + image: busybox + command: ["sh", "-c"] + args: + - "echo start; + [[ ! -f /config/Jackett/ServerConfig.json ]] && mkdir -p /config/Jackett/ && echo '{ \"BasePathOverride\": \"/jackett\"}' > /config/Jackett/ServerConfig.json; + echo end;" + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: jackett + containers: + - env: + - name: TZ + value: America/Denver + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/jackett + name: jackett + ports: + - containerPort: 9117 + name: webui + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: jackett + - mountPath: /downloads + name: htpc-home + subPath: downloads + diff --git a/base/kustomization.yaml b/base/kustomization.yaml new file mode 100644 index 0000000..10fb1d9 --- /dev/null +++ b/base/kustomization.yaml @@ -0,0 +1,35 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: htpc + +commonLabels: + app: htpc + +resources: +- namespace.yaml +- jackett.yaml +- radarr.yaml +- sonarr.yaml +- bazarr.yaml +- transmission.yaml +- emby.yaml +- plex.yml +- prowlarr.yml +- ingress.yaml + +patchesStrategicMerge: +- volumes_patch.yaml +- env_variables_patch.yaml + +vars: + - name: SONARR + objref: + kind: Service + name: sonarr + apiVersion: v1 + - name: RADARR + objref: + kind: Service + name: radarr + apiVersion: v1 diff --git a/base/namespace.yaml b/base/namespace.yaml new file mode 100644 index 0000000..15520fc --- /dev/null +++ b/base/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: htpc \ No newline at end of file diff --git a/base/plex.yml b/base/plex.yml new file mode 100644 index 0000000..960308a --- /dev/null +++ b/base/plex.yml @@ -0,0 +1,56 @@ +apiVersion: v1 +kind: Service +metadata: + name: plex +spec: + ports: + - port: 32400 + protocol: TCP + targetPort: 32400 + name: webui + selector: + run: plex +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + run: plex + name: plex +spec: + replicas: 1 + selector: + matchLabels: + run: plex + template: + metadata: + labels: + run: plex + spec: + securityContext: + fsGroup: 1000 + containers: + - env: + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/plex + name: plex + ports: + - containerPort: 32400 + name: webui + protocol: TCP + - containerPort: 32400 + name: webui-ssl + protocol: TCP + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: plex + - mountPath: /tv + name: htpc-home + subPath: media/tv + - mountPath: /movies + name: htpc-home + subPath: media/movies diff --git a/base/prowlarr.yml b/base/prowlarr.yml new file mode 100644 index 0000000..75942f4 --- /dev/null +++ b/base/prowlarr.yml @@ -0,0 +1,63 @@ +apiVersion: v1 +kind: Service +metadata: + name: prowlarr +spec: + ports: + - port: 9696 + protocol: TCP + targetPort: 9696 + name: webui + selector: + run: prowlarr +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + run: prowlarr + name: prowlarr +spec: + replicas: 1 + selector: + matchLabels: + run: prowlarr + template: + metadata: + labels: + run: prowlarr + spec: + containers: + - env: + - name: TZ + value: America/Denver + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/prowlarr + name: prowlarr + ports: + - containerPort: 9696 + name: webui + # livenessProbe: + # exec: + # command: + # - /bin/sh + # - -c + # - curl "http://localhost:7878/radarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' \(.*\)<\/ApiKey>.*/\1/p;q;}' /$(RADARR)'> /config/config.xml;echo end;" + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: radarr + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/radarr + name: radarr + ports: + - containerPort: 7878 + name: webui + # livenessProbe: + # exec: + # command: + # - /bin/sh + # - -c + # - curl "http://localhost:7878/radarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' \(.*\)<\/ApiKey>.*/\1/p;q;}' /$(SONARR)'> /config/config.xml;echo end;" + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: sonarr + containers: + - env: + - name: TZ + value: America/Denver + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/sonarr + name: sonarr + ports: + - containerPort: 8989 + name: webui + # livenessProbe: + # exec: + # command: + # - /bin/sh + # - -c + # - curl "http://localhost:8989/sonarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' \(.*\)<\/ApiKey>.*/\1/p;q;}' /config/settings.json; + # echo settings.json successfully saved + # volumeMounts: + # - mountPath: /config + # name: htpc-home + # subPath: transmission + containers: + - name: transmission + image: linuxserver/transmission + env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: WHITELIST + value: "" + - name: HOST_WHITELIST + value: "" + ports: + - containerPort: 9091 + name: webui + protocol: TCP + - containerPort: 51413 + name: torrent-tcp + protocol: TCP + - containerPort: 51413 + name: torrent-udp + protocol: UDP + resources: {} + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: transmission + - mountPath: /downloads + name: htpc-home + subPath: downloads + - mountPath: /watch + name: htpc-home + subPath: watch + diff --git a/base/volumes_patch.yaml b/base/volumes_patch.yaml new file mode 100644 index 0000000..5b05b39 --- /dev/null +++ b/base/volumes_patch.yaml @@ -0,0 +1,106 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: transmission +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: radarr +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sonarr +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jackett +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: emby +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bazarr +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home + # persistentVolumeClaim: + # claimName: local-path-pvc +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: plex +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: prowlarr +spec: + template: + spec: + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- diff --git a/install_armhf.yaml b/install_armhf.yaml new file mode 100644 index 0000000..bbc808f --- /dev/null +++ b/install_armhf.yaml @@ -0,0 +1,640 @@ +# This is an auto-generated file. DO NOT EDIT +apiVersion: v1 +kind: Namespace +metadata: + labels: + app: htpc + name: htpc +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: bazarr + namespace: htpc +spec: + ports: + - name: webui + port: 6767 + protocol: TCP + targetPort: 6767 + selector: + app: htpc + run: bazarr +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: emby + namespace: htpc +spec: + ports: + - name: webui + port: 8096 + protocol: TCP + targetPort: 8096 + selector: + app: htpc + run: emby +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: jackett + namespace: htpc +spec: + ports: + - name: webui + port: 9117 + protocol: TCP + targetPort: 9117 + selector: + app: htpc + run: jackett +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: radarr + namespace: htpc +spec: + ports: + - name: webui + port: 7878 + protocol: TCP + targetPort: 7878 + selector: + app: htpc + run: radarr +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: sonarr + namespace: htpc +spec: + ports: + - name: webui + port: 8989 + protocol: TCP + targetPort: 8989 + selector: + app: htpc + run: sonarr +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: transmission + namespace: htpc +spec: + ports: + - name: webui + port: 9091 + protocol: TCP + targetPort: 9091 + selector: + app: htpc + run: transmission +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: bazarr + name: bazarr + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: bazarr + template: + metadata: + labels: + app: htpc + run: bazarr + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/bazarr:arm32v6-latest + name: bazarr + ports: + - containerPort: 6767 + name: webui + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: bazarr + - mountPath: /movies + name: htpc-home + subPath: media/movies + - mountPath: /tv + name: htpc-home + subPath: media/tv + initContainers: + - command: + - sh + - -c + - until wget -qO- sonarr:8989/sonarr &> /dev/null && wget -qO- radarr:7878/radarr + &> /dev/null; do echo waiting for sonarr and radarr; sleep 2; done; + image: busybox + name: wait-for-sonarr-and-radarr + - command: + - sh + - -c + - "mkdir -p /htpc/bazarr/config\nexport RADARR_API_KEY=$(cat /htpc/radarr/config.xml + | sed -ne \"/ApiKey/{s/.*\\(.*\\)<\\/ApiKey>.*/\\1/p;q;}\")\nexport + SONARR_API_KEY=$(cat /htpc/sonarr/config.xml | sed -ne \"/ApiKey/{s/.*\\(.*\\)<\\/ApiKey>.*/\\1/p;q;}\")\ncat + << EOF > /htpc/bazarr/config/config.ini\n[sonarr]\napikey = ${SONARR_API_KEY}\nfull_update + = Daily\nip = sonarr\nonly_monitored = False\nbase_url = /sonarr\nssl = + False\nport = 8989\n\n[radarr]\napikey = ${RADARR_API_KEY}\nfull_update + = Daily\nip = radarr\nonly_monitored = False\nbase_url = /radarr\nssl = + False\nport = 7878\n\n[general]\nmovie_default_hi = False\nmovie_default_language + = []\nip = 0.0.0.0\nuse_scenename = True\nuse_postprocessing = False\nenabled_providers + = subscene,tvsubtitles\nauto_update = True\nport = 6767\nuse_radarr = True\nbase_url + = /bazarr/\npage_size = 25\nminimum_score_movie = 70\nbranch = master\nsingle_language + = False\nuse_sonarr = True\nserie_default_hi = False\npath_mappings_movie + = [['/movies', '/movies'], ['', ''], ['', ''], ['', ''], ['', '']]\nserie_default_enabled + = False\nmovie_default_enabled = False\nserie_default_language = []\npath_mappings + = [['/tv', '/tv'], ['', ''], ['', ''], ['', ''], ['', '']]\npostprocessing_cmd + = \nminimum_score = 90\ndebug = False\nuse_embedded_subs = True\nadaptive_searching + = False\nEOF\n" + image: busybox + name: config + volumeMounts: + - mountPath: /htpc + name: htpc-home + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: emby + name: emby + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: emby + template: + metadata: + labels: + app: htpc + run: emby + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: UID + value: "1000" + - name: GID + value: "1000" + image: emby/embyserver_arm32v7:latest + name: emby + ports: + - containerPort: 8096 + name: webui + protocol: TCP + - containerPort: 8920 + name: webui-ssl + protocol: TCP + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: emby + - mountPath: /tv + name: htpc-home + subPath: media/tv + - mountPath: /movies + name: htpc-home + subPath: media/movies + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: jackett + name: jackett + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: jackett + template: + metadata: + labels: + app: htpc + run: jackett + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/jackett:arm32v6-latest + name: jackett + ports: + - containerPort: 9117 + name: webui + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: jackett + - mountPath: /downloads + name: htpc-home + subPath: downloads + initContainers: + - args: + - 'echo start; [[ ! -f /config/Jackett/ServerConfig.json ]] && mkdir -p /config/Jackett/ + && echo ''{ "BasePathOverride": "/jackett"}'' > /config/Jackett/ServerConfig.json; + echo end;' + command: + - sh + - -c + image: busybox + name: config + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: jackett + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: radarr + name: radarr + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: radarr + template: + metadata: + labels: + app: htpc + run: radarr + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/radarr:arm32v6-latest + livenessProbe: + exec: + command: + - /bin/sh + - -c + - curl "http://localhost:7878/radarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' + \(.*\)<\/ApiKey>.*/\1/p;q;}' /radarr'> + /config/config.xml;echo end; + command: + - sh + - -c + image: busybox + name: config + securityContext: + runAsGroup: 1000 + runAsUser: 1000 + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: radarr + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: sonarr + name: sonarr + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: sonarr + template: + metadata: + labels: + app: htpc + run: sonarr + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/sonarr:arm32v6-latest + livenessProbe: + exec: + command: + - /bin/sh + - -c + - curl "http://localhost:8989/sonarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' + \(.*\)<\/ApiKey>.*/\1/p;q;}' /sonarr'> + /config/config.xml;echo end; + command: + - sh + - -c + image: busybox + name: config + securityContext: + runAsGroup: 1000 + runAsUser: 1000 + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: sonarr + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: transmission + name: transmission + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: transmission + template: + metadata: + labels: + app: htpc + run: transmission + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: WHITELIST + value: "" + - name: HOST_WHITELIST + value: "" + image: linuxserver/transmission:arm32v6-latest + name: transmission + ports: + - containerPort: 9091 + name: webui + protocol: TCP + - containerPort: 51413 + name: torrent-tcp + protocol: TCP + - containerPort: 51413 + name: torrent-udp + protocol: UDP + resources: {} + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: transmission + - mountPath: /downloads + name: htpc-home + subPath: downloads + - mountPath: /watch + name: htpc-home + subPath: watch + initContainers: + - command: + - sh + - -c + - chown -R 1000:1000 /config + image: busybox + name: chown + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: transmission + - mountPath: /downloads + name: htpc-home + subPath: downloads + - mountPath: /watch + name: htpc-home + subPath: watch + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + labels: + app: htpc + name: htpc + namespace: htpc +spec: + rules: + - http: + paths: + - backend: + service: + name: emby + port: + number: 8096 + path: / + pathType: Exact + - backend: + service: + name: jackett + port: + number: 9117 + path: /jackett + pathType: Exact + - backend: + service: + name: sonarr + port: + number: 8989 + path: /sonarr + pathType: Exact + - backend: + service: + name: radarr + port: + number: 7878 + path: /radarr + pathType: Exact + - backend: + service: + name: bazarr + port: + number: 6767 + path: /bazarr + pathType: Exact + - backend: + service: + name: transmission + port: + number: 9091 + path: /transmission + pathType: Exact diff --git a/install_x86_64.yaml b/install_x86_64.yaml new file mode 100644 index 0000000..dd11b66 --- /dev/null +++ b/install_x86_64.yaml @@ -0,0 +1,640 @@ +# This is an auto-generated file. DO NOT EDIT +apiVersion: v1 +kind: Namespace +metadata: + labels: + app: htpc + name: htpc +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: bazarr + namespace: htpc +spec: + ports: + - name: webui + port: 6767 + protocol: TCP + targetPort: 6767 + selector: + app: htpc + run: bazarr +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: emby + namespace: htpc +spec: + ports: + - name: webui + port: 8096 + protocol: TCP + targetPort: 8096 + selector: + app: htpc + run: emby +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: jackett + namespace: htpc +spec: + ports: + - name: webui + port: 9117 + protocol: TCP + targetPort: 9117 + selector: + app: htpc + run: jackett +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: radarr + namespace: htpc +spec: + ports: + - name: webui + port: 7878 + protocol: TCP + targetPort: 7878 + selector: + app: htpc + run: radarr +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: sonarr + namespace: htpc +spec: + ports: + - name: webui + port: 8989 + protocol: TCP + targetPort: 8989 + selector: + app: htpc + run: sonarr +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: htpc + name: transmission + namespace: htpc +spec: + ports: + - name: webui + port: 9091 + protocol: TCP + targetPort: 9091 + selector: + app: htpc + run: transmission +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: bazarr + name: bazarr + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: bazarr + template: + metadata: + labels: + app: htpc + run: bazarr + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/bazarr:1.1.0 + name: bazarr + ports: + - containerPort: 6767 + name: webui + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: bazarr + - mountPath: /movies + name: htpc-home + subPath: media/movies + - mountPath: /tv + name: htpc-home + subPath: media/tv + initContainers: + - command: + - sh + - -c + - until wget -qO- sonarr:8989/sonarr &> /dev/null && wget -qO- radarr:7878/radarr + &> /dev/null; do echo waiting for sonarr and radarr; sleep 2; done; + image: busybox + name: wait-for-sonarr-and-radarr + - command: + - sh + - -c + - "mkdir -p /htpc/bazarr/config\nexport RADARR_API_KEY=$(cat /htpc/radarr/config.xml + | sed -ne \"/ApiKey/{s/.*\\(.*\\)<\\/ApiKey>.*/\\1/p;q;}\")\nexport + SONARR_API_KEY=$(cat /htpc/sonarr/config.xml | sed -ne \"/ApiKey/{s/.*\\(.*\\)<\\/ApiKey>.*/\\1/p;q;}\")\ncat + << EOF > /htpc/bazarr/config/config.ini\n[sonarr]\napikey = ${SONARR_API_KEY}\nfull_update + = Daily\nip = sonarr\nonly_monitored = False\nbase_url = /sonarr\nssl = + False\nport = 8989\n\n[radarr]\napikey = ${RADARR_API_KEY}\nfull_update + = Daily\nip = radarr\nonly_monitored = False\nbase_url = /radarr\nssl = + False\nport = 7878\n\n[general]\nmovie_default_hi = False\nmovie_default_language + = []\nip = 0.0.0.0\nuse_scenename = True\nuse_postprocessing = False\nenabled_providers + = subscene,tvsubtitles\nauto_update = True\nport = 6767\nuse_radarr = True\nbase_url + = /bazarr/\npage_size = 25\nminimum_score_movie = 70\nbranch = master\nsingle_language + = False\nuse_sonarr = True\nserie_default_hi = False\npath_mappings_movie + = [['/movies', '/movies'], ['', ''], ['', ''], ['', ''], ['', '']]\nserie_default_enabled + = False\nmovie_default_enabled = False\nserie_default_language = []\npath_mappings + = [['/tv', '/tv'], ['', ''], ['', ''], ['', ''], ['', '']]\npostprocessing_cmd + = \nminimum_score = 90\ndebug = False\nuse_embedded_subs = True\nadaptive_searching + = False\nEOF\n" + image: busybox + name: config + volumeMounts: + - mountPath: /htpc + name: htpc-home + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: emby + name: emby + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: emby + template: + metadata: + labels: + app: htpc + run: emby + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: UID + value: "1000" + - name: GID + value: "1000" + image: emby/embyserver:4.8.0.5 + name: emby + ports: + - containerPort: 8096 + name: webui + protocol: TCP + - containerPort: 8920 + name: webui-ssl + protocol: TCP + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: emby + - mountPath: /tv + name: htpc-home + subPath: media/tv + - mountPath: /movies + name: htpc-home + subPath: media/movies + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: jackett + name: jackett + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: jackett + template: + metadata: + labels: + app: htpc + run: jackett + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/jackett:0.20.1307 + name: jackett + ports: + - containerPort: 9117 + name: webui + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: jackett + - mountPath: /downloads + name: htpc-home + subPath: downloads + initContainers: + - args: + - 'echo start; [[ ! -f /config/Jackett/ServerConfig.json ]] && mkdir -p /config/Jackett/ + && echo ''{ "BasePathOverride": "/jackett"}'' > /config/Jackett/ServerConfig.json; + echo end;' + command: + - sh + - -c + image: busybox + name: config + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: jackett + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: radarr + name: radarr + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: radarr + template: + metadata: + labels: + app: htpc + run: radarr + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/radarr:4.1.0 + livenessProbe: + exec: + command: + - /bin/sh + - -c + - curl "http://localhost:7878/radarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' + \(.*\)<\/ApiKey>.*/\1/p;q;}' /radarr'> + /config/config.xml;echo end; + command: + - sh + - -c + image: busybox + name: config + securityContext: + runAsGroup: 1000 + runAsUser: 1000 + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: radarr + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: sonarr + name: sonarr + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: sonarr + template: + metadata: + labels: + app: htpc + run: sonarr + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + image: linuxserver/sonarr:3.0.8.1507-ls149 + livenessProbe: + exec: + command: + - /bin/sh + - -c + - curl "http://localhost:8989/sonarr/api/health?ApiKey=$(sed -ne '/ApiKey/{s/.*\(.*\)<\/ApiKey>.*/\1/p;q;}' + \(.*\)<\/ApiKey>.*/\1/p;q;}' /sonarr'> + /config/config.xml;echo end; + command: + - sh + - -c + image: busybox + name: config + securityContext: + runAsGroup: 1000 + runAsUser: 1000 + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: sonarr + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: htpc + run: transmission + name: transmission + namespace: htpc +spec: + replicas: 1 + selector: + matchLabels: + app: htpc + run: transmission + template: + metadata: + labels: + app: htpc + run: transmission + spec: + containers: + - env: + - name: TZ + value: Pacific/Auckland + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: WHITELIST + value: "" + - name: HOST_WHITELIST + value: "" + image: linuxserver/transmission:3.00-r5-ls127 + name: transmission + ports: + - containerPort: 9091 + name: webui + protocol: TCP + - containerPort: 51413 + name: torrent-tcp + protocol: TCP + - containerPort: 51413 + name: torrent-udp + protocol: UDP + resources: {} + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: transmission + - mountPath: /downloads + name: htpc-home + subPath: downloads + - mountPath: /watch + name: htpc-home + subPath: watch + initContainers: + - command: + - sh + - -c + - chown -R 1000:1000 /config + image: busybox + name: chown + volumeMounts: + - mountPath: /config + name: htpc-home + subPath: transmission + - mountPath: /downloads + name: htpc-home + subPath: downloads + - mountPath: /watch + name: htpc-home + subPath: watch + securityContext: + fsGroup: 1000 + volumes: + - hostPath: + path: /opt/htpc + type: DirectoryOrCreate + name: htpc-home +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + labels: + app: htpc + name: htpc + namespace: htpc +spec: + rules: + - http: + paths: + - backend: + service: + name: emby + port: + number: 8096 + path: / + pathType: Exact + - backend: + service: + name: jackett + port: + number: 9117 + path: /jackett + pathType: Exact + - backend: + service: + name: sonarr + port: + number: 8989 + path: /sonarr + pathType: Exact + - backend: + service: + name: radarr + port: + number: 7878 + path: /radarr + pathType: Exact + - backend: + service: + name: bazarr + port: + number: 6767 + path: /bazarr + pathType: Exact + - backend: + service: + name: transmission + port: + number: 9091 + path: /transmission + pathType: Exact diff --git a/overlays/armhf/.kustomization.yaml.swp b/overlays/armhf/.kustomization.yaml.swp new file mode 100644 index 0000000..7732a1e Binary files /dev/null and b/overlays/armhf/.kustomization.yaml.swp differ diff --git a/overlays/armhf/kustomization.yaml b/overlays/armhf/kustomization.yaml new file mode 100644 index 0000000..59052cb --- /dev/null +++ b/overlays/armhf/kustomization.yaml @@ -0,0 +1,24 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +bases: +- ../../base + +images: + - name: linuxserver/jackett + newTag: arm32v7-latest + - name: linuxserver/sonarr + newTag: arm32v7-latest + - name: linuxserver/radarr + newTag: arm32v7-latest + - name: linuxserver/bazarr + newTag: arm32v7-latest + - name: linuxserver/transmission + newTag: arm32v7-latest + - name: emby/embyserver + newName: emby/embyserver_arm32v7 + newTag: latest + - name: linuxserver/plex + newTag: arm32v7-latest + - name: linuxserver/prowlarr + newTag: arm32v7-nightly diff --git a/overlays/x86/kustomization.yaml b/overlays/x86/kustomization.yaml new file mode 100644 index 0000000..cebbe4f --- /dev/null +++ b/overlays/x86/kustomization.yaml @@ -0,0 +1,19 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +bases: +- ../../base + +images: + - name: linuxserver/jackett + newTag: "0.20.1307" + - name: linuxserver/sonarr + newTag: 3.0.8.1507-ls149 + - name: linuxserver/radarr + newTag: "4.1.0" + - name: linuxserver/bazarr + newTag: "1.1.0" + - name: linuxserver/transmission + newTag: 3.00-r5-ls127 + - name: emby/embyserver + newTag: "4.8.0.5" diff --git a/overlays/x86_64-with-argocd/kustomization.yaml b/overlays/x86_64-with-argocd/kustomization.yaml new file mode 100644 index 0000000..197e530 --- /dev/null +++ b/overlays/x86_64-with-argocd/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +bases: +- ../../argocd +- ../x86 diff --git a/update-manifests.sh b/update-manifests.sh new file mode 100755 index 0000000..14b8bd5 --- /dev/null +++ b/update-manifests.sh @@ -0,0 +1,13 @@ +#!/bin/sh -x + +SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")" && pwd -P )" +AUTOGENMSG="# This is an auto-generated file. DO NOT EDIT" + +echo "${AUTOGENMSG}" > "${SRCROOT}/install_x86_64.yaml" +kustomize build "${SRCROOT}/overlays/x86" >> "${SRCROOT}/install_x86_64.yaml" + +echo "${AUTOGENMSG}" > "${SRCROOT}/install_armhf.yaml" +kustomize build "${SRCROOT}/overlays/armhf" >> "${SRCROOT}/install_armhf.yaml" + +echo "${AUTOGENMSG}" > "${SRCROOT}/install_argocd.yaml" +kustomize build "${SRCROOT}/argocd" >> "${SRCROOT}/install_argocd.yaml"