From 1809baabd67eb0ee98f4d74f5cbc8cd24f69f0cf Mon Sep 17 00:00:00 2001 From: perf3ct Date: Fri, 13 Jun 2025 23:01:05 +0000 Subject: [PATCH] feat(helm): set up bones for helm chart --- charts/readur/.helmignore | 30 ++++++++++ charts/readur/Chart.yaml | 46 ++++++++++++++ charts/readur/templates/checks.yaml | 1 + charts/readur/templates/config.yaml | 42 +++++++++++++ charts/readur/templates/release.yaml | 90 ++++++++++++++++++++++++++++ charts/readur/values.yaml | 49 +++++++++++++++ 6 files changed, 258 insertions(+) create mode 100644 charts/readur/.helmignore create mode 100644 charts/readur/Chart.yaml create mode 100644 charts/readur/templates/checks.yaml create mode 100644 charts/readur/templates/config.yaml create mode 100644 charts/readur/templates/release.yaml create mode 100644 charts/readur/values.yaml diff --git a/charts/readur/.helmignore b/charts/readur/.helmignore new file mode 100644 index 0000000..0ea946b --- /dev/null +++ b/charts/readur/.helmignore @@ -0,0 +1,30 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# OWNERS file for Kubernetes +OWNERS + +# helm-docs templates +*.gotmpl + +# helm unit tests +tests/ \ No newline at end of file diff --git a/charts/readur/Chart.yaml b/charts/readur/Chart.yaml new file mode 100644 index 0000000..6716a88 --- /dev/null +++ b/charts/readur/Chart.yaml @@ -0,0 +1,46 @@ +apiVersion: v2 +type: application +name: readur +home: https://github.com/readur/helm-charts +icon: https://github.com/readur/helm-charts/commit/icon.png +deprecated: false +description: |- + Build your personal knowledge base with readur Notes. A hierarchical note taking application with focus on building large personal knowledge bases. +annotations: + category: Notes +version: 1.3.0 +appVersion: 0.92.4 +kubeVersion: ">= 1.19" +dependencies: + - name: common + repository: https://bjw-s.github.io/helm-charts + version: 3.3.2 +keywords: + - electron + - wiki + - notebook + - notes + - self-hosted + - knowledge-graph + - electron-app + - note-taking + - self-hosting + - knowledge-base + - personal-knowledge-base + - knowledge-management + - personal-wiki + - notes-app + - scriptable + - knowledge-management-graph + - note-managment + - note-taker + - local-first +maintainers: + - name: readur + url: https://github.com/readur/Notes + - name: perfectra1n + email: jon@jonfuller.io + url: https://perf3ct.tech +sources: + - https://github.com/readur/helm-charts + - hhttps://github.com/readur/Notes diff --git a/charts/readur/templates/checks.yaml b/charts/readur/templates/checks.yaml new file mode 100644 index 0000000..354be04 --- /dev/null +++ b/charts/readur/templates/checks.yaml @@ -0,0 +1 @@ +{{- $name := .Values.persistence.data.existingClaim | required "You need to specify an existing PVC in your values, at the path persistence.data.existingClaim" -}} \ No newline at end of file diff --git a/charts/readur/templates/config.yaml b/charts/readur/templates/config.yaml new file mode 100644 index 0000000..c472afb --- /dev/null +++ b/charts/readur/templates/config.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-config + labels: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} +data: + config.ini: | + [General] + # Instance name can be used to distinguish between different instances using backend api.getInstanceName() + instanceName={{ .Values.configini.general.instanceName }} + + # set to true to allow using readur without authentication (makes sense for server build only, desktop build doesn't need password) + noAuthentication={{ .Values.configini.general.noAuthentication }} + + # set to true to disable backups (e.g. because of limited space on server) + noBackup={{ .Values.configini.general.noBackup }} + + # Disable automatically generating desktop icon + # noDesktopIcon=true + + [Network] + # host setting is relevant only for web deployments - set the host on which the server will listen + host={{ .Values.configini.network.host }} + # port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with readur_PORT environment variable) + port={{ .Values.configini.network.port }} + # true for TLS/SSL/HTTPS (secure), false for HTTP (unsecure). + https={{ .Values.configini.network.https }} + # path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true + certPath={{ .Values.configini.network.certPath }} + keyPath={{ .Values.configini.network.keyPath }} + # setting to give trust to reverse proxies, a comma-separated list of trusted rev. proxy IPs can be specified (CIDR notation is permitted), + # alternatively 'true' will make use of the leftmost IP in X-Forwarded-For, ultimately an integer can be used to tell about the number of hops between + # readur (which is hop 0) and the first trusted rev. proxy. + # once set, expressjs will use the X-Forwarded-For header set by the rev. proxy to determinate the real IPs of clients. + # expressjs shortcuts are supported: loopback(127.0.0.1/8, ::1/128), linklocal(169.254.0.0/16, fe80::/10), uniquelocal(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7) + trustedReverseProxy={{ .Values.configini.network.trustedReverseProxy }} + diff --git a/charts/readur/templates/release.yaml b/charts/readur/templates/release.yaml new file mode 100644 index 0000000..225b772 --- /dev/null +++ b/charts/readur/templates/release.yaml @@ -0,0 +1,90 @@ +{{- define "readur.hardcodedValues" -}} +controllers: + main: + initContainers: + fixperms: + image: + repository: busybox + tag: latest + args: ["sh", "-c", "chown -R 1000:1000 /home/node/readur-data"] + securityContext: + runAsUser: 0 + runAsGroup: 0 + containers: + readur: + image: + repository: readur/notes + tag: v0.90.8 + pullPolicy: IfNotPresent + + probes: + startup: + enabled: true + custom: true + type: TCP + spec: + initialDelaySeconds: 45 # Time to wait before starting the probe + periodSeconds: 10 # How often to perform the probe + timeoutSeconds: 5 # Number of seconds after which the probe times out + failureThreshold: 10 # Number of times to try the probe before giving up + httpGet: &probesPath + path: /login + port: 8080 + readiness: &probes + enabled: true + custom: true + spec: + initialDelaySeconds: 5 # Time to wait before starting the probe after startup probe succeeds + periodSeconds: 10 # How often to perform the probe + timeoutSeconds: 10 # Number of seconds after which the probe times out + failureThreshold: 3 # Number of times to try the probe before considering the container not ready + httpGet: *probesPath + + liveness: *probes + + + +persistence: + data: + enabled: true + type: persistentVolumeClaim + size: 20Gi + retain: true + # Since it's SQLite, the PVC should only be RWO + accessMode: ReadWriteOnce + globalMounts: + - path: /home/node/readur-data + readOnly: false + config: + enabled: true + type: configMap + name: {{ .Release.Name }}-config + readOnly: true + advancedMounts: + main: + readur: + - path: /home/node/readur-data/config.ini + subPath: config.ini + + + +service: + main: + controller: main + enabled: true + ports: + http: + # What port the cluster is listening on + port: 8080 + # What port the container is listening on + targetPort: 8080 + +{{ end }} + + + +{{- $ctx := deepCopy . -}} +# Merge with ALL the values in `values.yaml` +{{- $_ := mergeOverwrite .Values $ctx.Values -}} +{{- $_ = include "readur.hardcodedValues" . | fromYaml | merge $ctx.Values -}} +{{- include "bjw-s.common.loader.all" $ctx }} diff --git a/charts/readur/values.yaml b/charts/readur/values.yaml new file mode 100644 index 0000000..9ac364a --- /dev/null +++ b/charts/readur/values.yaml @@ -0,0 +1,49 @@ +## This chart relies on the common library chart from bjw-s +## You can find it and the values you can provide and modify, at https://github.com/bjw-s/helm-charts/blob/common-3.3.2/charts/library/common/values.yaml +## Refer there for more detail about the supported values. +## Any values that you find in the above `values.yaml` can be provided to this chart and are then rendered. + +controllers: + main: + containers: + readur: + image: + repository: readur/notes + tag: v0.92.4 + pullPolicy: IfNotPresent + env: + key: "value" + +persistence: + data: + enabled: true + type: persistentVolumeClaim + existingClaim: + +# This is used to modify the config.ini of the readur instance +configini: + general: + instanceName: "" + # Disable authentication to readur? (if you're running it on a private network, or have authentication handled by another component) + noAuthentication: false + # Disable backups of the database? + noBackup: false + network: + host: "0.0.0.0" + port: 8080 + https: false + certPath: "" + keyPath: "" + trustedReverseProxy: true +#ingress: +# main: +# enabled: true +# annotations: +# # proxy-body-size is set to 0 to remove the body limit on file uploads +# nginx.ingress.kubernetes.io/proxy-body-size: "0" +# hosts: +# - host: readur.local +# paths: +# - path: "/api/v1" +# tls: [] +