From aca076e8641ae37e7cbde1be5d15f9496c99ed05 Mon Sep 17 00:00:00 2001 From: Ava Affine Date: Fri, 18 Jul 2025 11:27:07 -0700 Subject: [PATCH] initial commit Signed-off-by: Ava Affine --- .gitignore | 3 + .helmignore | 23 ++ Chart.lock | 6 + Chart.yaml | 6 + README.md | 14 ++ templates/NOTES.txt | 8 + templates/_helpers.tpl | 62 ++++++ templates/echo.yaml | 39 ++++ templates/forge.yaml | 314 +++++++++++++++++++++++++++ templates/frigate.yaml | 176 +++++++++++++++ templates/homeassistant.yaml | 78 +++++++ templates/hpa.yaml | 28 +++ templates/monitoring.yaml | 0 templates/mqtt.yaml | 96 ++++++++ templates/nextcloud.yaml | 101 +++++++++ templates/postgres.yaml | 87 ++++++++ templates/redis.yaml | 36 +++ templates/routing.yaml | 224 +++++++++++++++++++ templates/tests/test-connection.yaml | 15 ++ templates/wordpress.yaml | 172 +++++++++++++++ values.yaml | 70 ++++++ 21 files changed, 1558 insertions(+) create mode 100644 .gitignore create mode 100644 .helmignore create mode 100644 Chart.lock create mode 100644 Chart.yaml create mode 100644 README.md create mode 100644 templates/NOTES.txt create mode 100644 templates/_helpers.tpl create mode 100644 templates/echo.yaml create mode 100644 templates/forge.yaml create mode 100644 templates/frigate.yaml create mode 100644 templates/homeassistant.yaml create mode 100644 templates/hpa.yaml create mode 100644 templates/monitoring.yaml create mode 100644 templates/mqtt.yaml create mode 100644 templates/nextcloud.yaml create mode 100644 templates/postgres.yaml create mode 100644 templates/redis.yaml create mode 100644 templates/routing.yaml create mode 100644 templates/tests/test-connection.yaml create mode 100644 templates/wordpress.yaml create mode 100644 values.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..12ff8cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build.sh +collabora-customizations.yaml +configs/* diff --git a/.helmignore b/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/.helmignore @@ -0,0 +1,23 @@ +# 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/ diff --git a/Chart.lock b/Chart.lock new file mode 100644 index 0000000..7aaf140 --- /dev/null +++ b/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: ingress-nginx + repository: https://kubernetes.github.io/ingress-nginx + version: 4.1.0 +digest: sha256:8b7073d6a936bbabe553db735ea45d0f50517dcbaafd96f1cbb6b97f1e93023d +generated: "2022-04-27T13:06:29.739620475-07:00" diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000..4a4b0ef --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: "666" +description: sunnypup.io kubernetes configuration +name: sunnypup.io +type: application +version: 1.0.12 diff --git a/README.md b/README.md new file mode 100644 index 0000000..7935087 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Sunnypup.io Services Helm Chart +This remains publicly accessible as there are many small and efficient manifests / templates here +that other self hosters can make good use of. Feel free to peruse. + + +## Dependencies +The following additional helm charts are installed separately. +- NGINX Ingress Controller (the one by the actual NGINX team not nginx-ingress) +- Cert Manager +- Collabora Office + +## Configs +Expected in the configs dir are configuration files for Frigate and for Apache Mosquitto. +Both are omitted in this repository. diff --git a/templates/NOTES.txt b/templates/NOTES.txt new file mode 100644 index 0000000..44ae68a --- /dev/null +++ b/templates/NOTES.txt @@ -0,0 +1,8 @@ +1. Now you must set up /var/lib/sunnypup/ + - /var/lib/sunnypup/synapse + - /var/lib/sunnypup/nextcloud + - /var/lib/sunnypup/matrix-discord + - /var/lib/sunnypup/matrix-telegram + - /var/lib/sunnypup/pg +2. Port forward +3. Pray diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000..3eebe1e --- /dev/null +++ b/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "sunnypupio.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "sunnypupio.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "sunnypupio.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "sunnypupio.labels" -}} +helm.sh/chart: {{ include "sunnypupio.chart" . }} +{{ include "sunnypupio.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "sunnypupio.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sunnypupio.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "sunnypupio.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "sunnypupio.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/templates/echo.yaml b/templates/echo.yaml new file mode 100644 index 0000000..cc1f9c0 --- /dev/null +++ b/templates/echo.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: echo +spec: + replicas: 1 + selector: + matchLabels: + app: echo + template: + metadata: + labels: + app: echo + spec: + containers: + - name: echo-server + image: jmalloc/echo-server + ports: + - name: http-port + containerPort: 8080 + env: + - name: LOG_HTTP_BODY + value: "true" + - name: LOG_HTTP_HEADERS + value: "true" +--- +apiVersion: v1 +kind: Service +metadata: + name: echo +spec: + clusterIP: None + ports: + - name: http-port + port: 8080 + targetPort: http-port + protocol: TCP + selector: + app: echo diff --git a/templates/forge.yaml b/templates/forge.yaml new file mode 100644 index 0000000..be9ff89 --- /dev/null +++ b/templates/forge.yaml @@ -0,0 +1,314 @@ +apiVersion: v1 +stringData: + token: {{ .Values.forge.secret }} +kind: Secret +metadata: + name: runner-secret +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: forge + labels: + app: forge +spec: + replicas: 1 + selector: + matchLabels: + app: forge + template: + metadata: + labels: + app: forge + spec: + containers: + - name: forgejo + image: codeberg.org/forgejo/forgejo:11 + ports: + - name: http-port + containerPort: 3000 + - name: ssh-port + containerPort: 22222 + volumeMounts: + - name: local-tz + mountPath: /etc/timezone + readOnly: true + - name: local-lt + mountPath: /etc/localtime + readOnly: true + - name: persistence + mountPath: /data + env: + - name: USER_UID + value: "1000" + - name: USER_GID + value: "1000" + - name: FORGEJO__database__DB_TYPE + value: "postgres" + - name: FORGEJO__database__HOST + value: "postgres:5432" + - name: FORGEJO__database__NAME + value: "forgejo" + - name: FORGEJO__database__USER + value: {{ .Values.pg.user }} + - name: FORGEJO__database__PASSWD + value: {{ .Values.pg.pass }} + volumes: + - name: local-tz + persistentVolumeClaim: + claimName: forge-tz-pvc + - name: local-lt + persistentVolumeClaim: + claimName: forge-lt-pvc + - name: persistence + persistentVolumeClaim: + claimName: forge-persistence-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: forge + labels: + app: forge +spec: + clusterIP: None + ports: + - name: http-port + port: 3000 + targetPort: http-port + protocol: TCP + - name: ssh-port + port: 22222 + targetPort: 22222 + selector: + app: forge +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: forge-tz + labels: + pvc_type: forge-tz +spec: + capacity: + storage: 10Mi + accessModes: + - ReadOnlyMany + persistentVolumeReclaimPolicy: Retain + hostPath: + path: /etc/timezone +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: forge-lt + labels: + pvc_type: forge-lt +spec: + capacity: + storage: 10Mi + accessModes: + - ReadOnlyMany + persistentVolumeReclaimPolicy: Retain + hostPath: + path: /etc/localtime +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: forge-tz-pvc +spec: + accessModes: + - ReadOnlyMany + volumeMode: Filesystem + storageClassName: "" + volumeName: forge-tz + resources: + requests: + storage: 10Mi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: forge-lt-pvc +spec: + accessModes: + - ReadOnlyMany + volumeMode: Filesystem + storageClassName: "" + volumeName: forge-lt + resources: + requests: + storage: 10Mi +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: forge-persistence-pv + labels: + pvc_type: forge-persistence-pv +spec: + capacity: + storage: 1000Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + hostPath: + path: {{ .Values.forge.path }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: forge-persistence-pvc +spec: + accessModes: + - ReadWriteOnce + volumeMode: Filesystem + storageClassName: "" + volumeName: forge-persistence-pv + resources: + requests: + storage: 1000Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: forgejo-runner + labels: + app: forgejo-runner +spec: + replicas: 2 + selector: + matchLabels: + app: forgejo-runner + template: + metadata: + name: forgejo-runner + labels: + app: forgejo-runner + spec: + automountServiceAccountToken: false + restartPolicy: Always + initContainers: + - name: runner-register + image: code.forgejo.org/forgejo/runner:6.4.0 + command: + - /bin/bash + - -c + args: + - | + while : ; do + forgejo-runner register --no-interactive --token $(RUNNER_SECRET) --name $(RUNNER_NAME) --instance $(FORGEJO_INSTANCE_URL) && break ; + sleep 1 ; + done ; + forgejo-runner generate-config > /data/config.yml ; + sed -i -e "s|network: .*|network: host|" config.yml ; + sed -i -e "s|^ envs:$$| envs:\n DOCKER_HOST: tcp://localhost:2376\n DOCKER_TLS_VERIFY: 1\n DOCKER_CERT_PATH: /certs/client|" config.yml ; + sed -i -e "s|^ options:| options: -v /certs/client:/certs/client|" config.yml ; + sed -i -e "s| valid_volumes: \[\]$$| valid_volumes:\n - /certs/client|" config.yml + env: + - name: RUNNER_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: RUNNER_SECRET + valueFrom: + secretKeyRef: + name: runner-secret + key: token + - name: FORGEJO_INSTANCE_URL + value: http://forge:3000 + resources: + limits: + cpu: '0.5' + ephemeral-storage: 100Mi + memory: 64Mi + requests: + cpu: 100m + ephemeral-storage: '0' + memory: 64Mi + volumeMounts: + - name: runner-data + mountPath: /data + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + privileged: false + readOnlyRootFilesystem: true + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + containers: + - name: runner + image: code.forgejo.org/forgejo/runner:6.4.0 + command: + - /bin/bash + - -c + args: + - | + while ! nc -z localhost 2376