From aab7dda59c1a72713c50a675652c0cf0add76db5 Mon Sep 17 00:00:00 2001 From: Tommy Skaug <104122981+tommy-skaug@users.noreply.github.com> Date: Sat, 6 Apr 2024 11:28:44 +0000 Subject: [PATCH] feat: add Helm Chart for nfty.sh --- README.org | 2 + charts/nfty-sh/Chart.yaml | 20 ++++++++ charts/nfty-sh/templates/_helpers.tpl | 30 +++++++++++ .../nfty-sh/templates/deployment-server.yaml | 51 +++++++++++++++++++ charts/nfty-sh/templates/service-server.yaml | 14 +++++ charts/nfty-sh/values.yaml | 9 ++++ 6 files changed, 126 insertions(+) create mode 100644 charts/nfty-sh/Chart.yaml create mode 100644 charts/nfty-sh/templates/_helpers.tpl create mode 100644 charts/nfty-sh/templates/deployment-server.yaml create mode 100644 charts/nfty-sh/templates/service-server.yaml create mode 100644 charts/nfty-sh/values.yaml diff --git a/README.org b/README.org index b6022c5..33acfca 100644 --- a/README.org +++ b/README.org @@ -50,6 +50,8 @@ Below you'll find an overview of the charts and an intro to get you started. 🚧 [[charts/attic][Attic]]: Nix Binary Cache server that reduces the time to compile and distribute builds ([[https://discourse.nixos.org/t/introducing-attic-a-self-hostable-nix-binary-cache-server/24343][intro post]]) +🚧 [[charts/nfty-sh][nfty.sh]]: A push notification server for clients and phones. + 🚧 [[charts/ollama-web][OLLAMA Web]]: User-friendly WebUI for LLMs (Formerly Ollama WebUI). A simplified chart of the original and wip, but it works. 🚧 [[charts/element-call][Element Call]]: WebRTC server for calls and video using Matrix for signalling. Not functional atm. diff --git a/charts/nfty-sh/Chart.yaml b/charts/nfty-sh/Chart.yaml new file mode 100644 index 0000000..d253986 --- /dev/null +++ b/charts/nfty-sh/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: ntfy-sh +description: | + ntfy lets you send push notifications to your phone or desktop via scripts from any computer +appVersion: v2.10.0 +type: application +version: 0.1.0 +maintainers: +- name: Tommy Skaug + email: tommy@skaug.me +icon: https://avatars.githubusercontent.com/u/664597?s=48&v=4 +keywords: +- kubernetes +- ntfy +- push +- notifications +- server +sources: +- https://docs.ntfy.sh/ +- https://github.com/binwiederhier/ntfy/ diff --git a/charts/nfty-sh/templates/_helpers.tpl b/charts/nfty-sh/templates/_helpers.tpl new file mode 100644 index 0000000..71739f8 --- /dev/null +++ b/charts/nfty-sh/templates/_helpers.tpl @@ -0,0 +1,30 @@ +# Define a template for the chart's full name. +{{/* +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). +*/}} +{{- define "nfty-sh.fullname" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end }} + +# Define a template for standard labels. +{{/* +Common labels +*/}} +{{- define "nfty-sh.labels" -}} +helm.sh/chart: {{ include "nfty-sh.chart" . }} +app.kubernetes.io/name: {{ include "nfty-sh.fullname" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/version: {{ .Chart.Version | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +# Define a template for the chart name and version. +{{/* +Generate basic labels +*/}} +{{- define "nfty-sh.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" -}} +{{- end }} + +# Optionally, add more helper templates as needed. diff --git a/charts/nfty-sh/templates/deployment-server.yaml b/charts/nfty-sh/templates/deployment-server.yaml new file mode 100644 index 0000000..ef8f888 --- /dev/null +++ b/charts/nfty-sh/templates/deployment-server.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nfty-sh.fullname" . }} + labels: + {{- include "ntfy-sh.labels" . | nindent 4 }} + app.kubernetes.io/component: {{ include "nfty-sh.fullname" . }}-server + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/component: {{ include "nfty-sh.fullname" . }}-server + template: + metadata: + labels: + app.kubernetes.io/component: {{ include "nfty-sh.fullname" . }}-server + spec: + serviceAccountName: {{ include "nfty-sh.fullname" . }} + containers: + - name: {{ include "nfty-sh.fullname" . }}-server + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + args: ["serve"] + env: &dispatchEnv + - name: NTFY_BASE_URL + value: {{ .Values.config.baseUrl }} + - name: NTFY_CACHE_FILE + value: /var/lib/ntfy/cache.db + - name: NTFY_AUTH_FILE + value: /var/lib/ntfy/auth.db + - name: NTFY_AUTH_DEFAULT_ACCESS + value: deny-all + - name: NTFY_BEHIND_PROXY + value: true + - name: NTFY_ATTACHMENT_CACHE_DIR + value: /var/lib/ntfy/attachments + - name: NTFY_ENABLE_LOGIN + value: true + resources: + limits: + memory: "128Mi" + cpu: "500m" + ports: + - containerPort: 80 + name: http + volumeMounts: + - name: {{ include "nfty-sh.fullname" . }}-server + mountPath: "/var/lib/nfty" + readOnly: false + volumes: + - name: {{ include "nfty-sh.fullname" . }}-server + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim }} \ No newline at end of file diff --git a/charts/nfty-sh/templates/service-server.yaml b/charts/nfty-sh/templates/service-server.yaml new file mode 100644 index 0000000..c91d844 --- /dev/null +++ b/charts/nfty-sh/templates/service-server.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nfty-sh.fullname" . }}-server + labels: + {{- include "ntfy-sh.labels" . | nindent 4 }} + app.kubernetes.io/component: {{ include "nfty-sh.fullname" . }}-server +spec: + selector: + app: {{ include "nfty-sh.fullname" . }}-server + ports: + - port: 80 + targetPort: 80 \ No newline at end of file diff --git a/charts/nfty-sh/values.yaml b/charts/nfty-sh/values.yaml new file mode 100644 index 0000000..27e4799 --- /dev/null +++ b/charts/nfty-sh/values.yaml @@ -0,0 +1,9 @@ +config: + baseUrl: https://ntfy.sh + +persistence: + existingClaim: nfty-sh-server + +image: + repository: binwiederhier/ntfy + tag: v2.10.0 \ No newline at end of file