diff --git a/obsidian-syncthing-chart/.helmignore b/obsidian-syncthing-chart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/obsidian-syncthing-chart/.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/obsidian-syncthing-chart/Chart.yaml b/obsidian-syncthing-chart/Chart.yaml new file mode 100644 index 0000000..296cd2d --- /dev/null +++ b/obsidian-syncthing-chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: obsidian-syncthing-chart +description: A Helm chart to deploy Obsidian with Syncthing for vault synchronization +version: 0.1.2 +appVersion: "latest" diff --git a/obsidian-syncthing-chart/templates/_helpers.tpl b/obsidian-syncthing-chart/templates/_helpers.tpl new file mode 100644 index 0000000..d72ac59 --- /dev/null +++ b/obsidian-syncthing-chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "obsidian-syncthing-chart.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 "obsidian-syncthing-chart.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 "obsidian-syncthing-chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "obsidian-syncthing-chart.labels" -}} +helm.sh/chart: {{ include "obsidian-syncthing-chart.chart" . }} +{{ include "obsidian-syncthing-chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "obsidian-syncthing-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "obsidian-syncthing-chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "obsidian-syncthing-chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "obsidian-syncthing-chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/obsidian-syncthing-chart/templates/deployment.yaml b/obsidian-syncthing-chart/templates/deployment.yaml new file mode 100644 index 0000000..ed02a8b --- /dev/null +++ b/obsidian-syncthing-chart/templates/deployment.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "obsidian-syncthing-chart.fullname" . }} + labels: + app: {{ include "obsidian-syncthing-chart.name" . }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "obsidian-syncthing-chart.name" . }} + template: + metadata: + labels: + app: {{ include "obsidian-syncthing-chart.name" . }} + spec: + containers: + - name: obsidian + image: "{{ .Values.image.obsidian.repository }}:{{ .Values.image.obsidian.tag }}" + imagePullPolicy: {{ .Values.image.obsidian.pullPolicy }} + ports: + - containerPort: 3000 + volumeMounts: + - name: obsidian-vault + mountPath: /config + - name: syncthing + image: "{{ .Values.image.syncthing.repository }}:{{ .Values.image.syncthing.tag }}" + imagePullPolicy: {{ .Values.image.syncthing.pullPolicy }} + ports: + - containerPort: 8384 + volumeMounts: + - name: obsidian-vault + mountPath: /vault + - name: syncthing-config + mountPath: /config + + volumes: + - name: obsidian-vault + persistentVolumeClaim: + claimName: obsidian-vault-pvc + - name: syncthing-config + persistentVolumeClaim: + claimName: syncthing-config-pvc + diff --git a/obsidian-syncthing-chart/templates/ingress-obsidian.yaml b/obsidian-syncthing-chart/templates/ingress-obsidian.yaml new file mode 100644 index 0000000..f27cd09 --- /dev/null +++ b/obsidian-syncthing-chart/templates/ingress-obsidian.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: obsidian-ingress +spec: + defaultBackend: + service: + name: {{ include "obsidian-syncthing-chart.fullname" . }}-obsidian + port: + number: 3000 + ingressClassName: tailscale + tls: + - hosts: + - notes \ No newline at end of file diff --git a/obsidian-syncthing-chart/templates/ingress-syncthing.yaml b/obsidian-syncthing-chart/templates/ingress-syncthing.yaml new file mode 100644 index 0000000..714699e --- /dev/null +++ b/obsidian-syncthing-chart/templates/ingress-syncthing.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: syncthing-ingress +spec: + defaultBackend: + service: + name: {{ include "obsidian-syncthing-chart.fullname" . }}-syncthing + port: + number: 8384 + ingressClassName: tailscale + tls: + - hosts: + - syncthing-notes \ No newline at end of file diff --git a/obsidian-syncthing-chart/templates/pvc-obsidian-vault.yaml b/obsidian-syncthing-chart/templates/pvc-obsidian-vault.yaml new file mode 100644 index 0000000..984e133 --- /dev/null +++ b/obsidian-syncthing-chart/templates/pvc-obsidian-vault.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: obsidian-vault-pvc + labels: + app: obsidian-syncthing +spec: + storageClassName: {{ .Values.persistentVolume.storageClass }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.persistentVolume.size }} diff --git a/obsidian-syncthing-chart/templates/pvc-syncthing-config.yaml b/obsidian-syncthing-chart/templates/pvc-syncthing-config.yaml new file mode 100644 index 0000000..4b01489 --- /dev/null +++ b/obsidian-syncthing-chart/templates/pvc-syncthing-config.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: syncthing-config-pvc + labels: + app: obsidian-syncthing +spec: + storageClassName: {{ .Values.persistentVolume.storageClass }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "100Mi" diff --git a/obsidian-syncthing-chart/templates/service-obsidian.yaml b/obsidian-syncthing-chart/templates/service-obsidian.yaml new file mode 100644 index 0000000..81ca5e0 --- /dev/null +++ b/obsidian-syncthing-chart/templates/service-obsidian.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "obsidian-syncthing-chart.fullname" . }}-obsidian + labels: + app: {{ include "obsidian-syncthing-chart.name" . }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.service.obsidian.port }} + targetPort: 3000 + protocol: TCP + name: http + selector: + app: {{ include "obsidian-syncthing-chart.name" . }} diff --git a/obsidian-syncthing-chart/templates/service-syncthing.yaml b/obsidian-syncthing-chart/templates/service-syncthing.yaml new file mode 100644 index 0000000..2d4e482 --- /dev/null +++ b/obsidian-syncthing-chart/templates/service-syncthing.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "obsidian-syncthing-chart.fullname" . }}-syncthing + labels: + app: {{ include "obsidian-syncthing-chart.name" . }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.service.syncthing.port }} + targetPort: 8384 + protocol: TCP + name: syncthing + selector: + app: {{ include "obsidian-syncthing-chart.name" . }} diff --git a/obsidian-syncthing-chart/values.yaml b/obsidian-syncthing-chart/values.yaml new file mode 100644 index 0000000..9668076 --- /dev/null +++ b/obsidian-syncthing-chart/values.yaml @@ -0,0 +1,28 @@ +replicaCount: 1 + +image: + obsidian: + repository: linuxserver/obsidian + tag: "1.6.7" + pullPolicy: IfNotPresent + syncthing: + repository: linuxserver/syncthing + tag: "1.27.11" + pullPolicy: IfNotPresent + +service: + obsidian: + type: ClusterIP + port: 3000 + syncthing: + type: ClusterIP + port: 8384 + +persistentVolume: + storageClass: "longhorn" + size: "5Gi" + +resources: {} +nodeSelector: {} +tolerations: [] +affinity: [] diff --git a/trilium-syncthing-chart/.helmignore b/trilium-syncthing-chart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/trilium-syncthing-chart/.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/trilium-syncthing-chart/Chart.yaml b/trilium-syncthing-chart/Chart.yaml new file mode 100644 index 0000000..e166ba8 --- /dev/null +++ b/trilium-syncthing-chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: trilium-syncthing-chart +description: A Helm chart to deploy Trillium with Syncthing for vault synchronization +version: 0.1.2 +appVersion: "latest" diff --git a/trilium-syncthing-chart/templates/_helpers.tpl b/trilium-syncthing-chart/templates/_helpers.tpl new file mode 100644 index 0000000..224b559 --- /dev/null +++ b/trilium-syncthing-chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "trilium-syncthing-chart.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 "trilium-syncthing-chart.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 "trilium-syncthing-chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "trilium-syncthing-chart.labels" -}} +helm.sh/chart: {{ include "trilium-syncthing-chart.chart" . }} +{{ include "trilium-syncthing-chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "trilium-syncthing-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "trilium-syncthing-chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "trilium-syncthing-chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "trilium-syncthing-chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/trilium-syncthing-chart/templates/deployment.yaml b/trilium-syncthing-chart/templates/deployment.yaml new file mode 100644 index 0000000..33db56d --- /dev/null +++ b/trilium-syncthing-chart/templates/deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "trilium-syncthing-chart.fullname" . }} + labels: + app: {{ include "trilium-syncthing-chart.name" . }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "trilium-syncthing-chart.name" . }} + template: + metadata: + labels: + app: {{ include "trilium-syncthing-chart.name" . }} + spec: + containers: + - name: trilium + image: "{{ .Values.image.trilium.repository }}:{{ .Values.image.trilium.tag }}" + imagePullPolicy: {{ .Values.image.trilium.pullPolicy }} + ports: + - containerPort: 8080 + volumeMounts: + - name: trilium-vault + mountPath: /home/node/trilium-data + securityContext: + runAsUser: 1000 + - name: syncthing + image: "{{ .Values.image.syncthing.repository }}:{{ .Values.image.syncthing.tag }}" + imagePullPolicy: {{ .Values.image.syncthing.pullPolicy }} + ports: + - containerPort: 8384 + volumeMounts: + - name: trilium-vault + mountPath: /vault + - name: syncthing-config + mountPath: /config + securityContext: + runAsUser: 1000 + + volumes: + - name: trilium-vault + persistentVolumeClaim: + claimName: trilium-vault-pvc + - name: syncthing-config + persistentVolumeClaim: + claimName: syncthing-config-pvc + diff --git a/trilium-syncthing-chart/templates/ingress-syncthing.yaml b/trilium-syncthing-chart/templates/ingress-syncthing.yaml new file mode 100644 index 0000000..2e7dc57 --- /dev/null +++ b/trilium-syncthing-chart/templates/ingress-syncthing.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: syncthing-ingress +spec: + defaultBackend: + service: + name: {{ include "trilium-syncthing-chart.fullname" . }}-syncthing + port: + number: 8384 + ingressClassName: tailscale + tls: + - hosts: + - syncthing-notes \ No newline at end of file diff --git a/trilium-syncthing-chart/templates/ingress-trilium.yaml b/trilium-syncthing-chart/templates/ingress-trilium.yaml new file mode 100644 index 0000000..a10855c --- /dev/null +++ b/trilium-syncthing-chart/templates/ingress-trilium.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: trilium-ingress +spec: + defaultBackend: + service: + name: {{ include "trilium-syncthing-chart.fullname" . }}-trilium + port: + number: 8080 + ingressClassName: tailscale + tls: + - hosts: + - notes \ No newline at end of file diff --git a/trilium-syncthing-chart/templates/pvc-syncthing-config.yaml b/trilium-syncthing-chart/templates/pvc-syncthing-config.yaml new file mode 100644 index 0000000..a56745a --- /dev/null +++ b/trilium-syncthing-chart/templates/pvc-syncthing-config.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: syncthing-config-pvc + labels: + app: trilium-syncthing +spec: + storageClassName: {{ .Values.persistentVolume.storageClass }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "100Mi" diff --git a/trilium-syncthing-chart/templates/pvc-trilium-vault.yaml b/trilium-syncthing-chart/templates/pvc-trilium-vault.yaml new file mode 100644 index 0000000..8546abd --- /dev/null +++ b/trilium-syncthing-chart/templates/pvc-trilium-vault.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: trilium-vault-pvc + labels: + app: trilium-syncthing +spec: + storageClassName: {{ .Values.persistentVolume.storageClass }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.persistentVolume.size }} diff --git a/trilium-syncthing-chart/templates/service-syncthing.yaml b/trilium-syncthing-chart/templates/service-syncthing.yaml new file mode 100644 index 0000000..18de3d2 --- /dev/null +++ b/trilium-syncthing-chart/templates/service-syncthing.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "trilium-syncthing-chart.fullname" . }}-syncthing + labels: + app: {{ include "trilium-syncthing-chart.name" . }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.service.syncthing.port }} + targetPort: 8384 + protocol: TCP + name: syncthing + selector: + app: {{ include "trilium-syncthing-chart.name" . }} diff --git a/trilium-syncthing-chart/templates/service-trilium.yaml b/trilium-syncthing-chart/templates/service-trilium.yaml new file mode 100644 index 0000000..7321380 --- /dev/null +++ b/trilium-syncthing-chart/templates/service-trilium.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "trilium-syncthing-chart.fullname" . }}-trilium + labels: + app: {{ include "trilium-syncthing-chart.name" . }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.service.trilium.port }} + targetPort: 8080 + protocol: TCP + name: http + selector: + app: {{ include "trilium-syncthing-chart.name" . }} diff --git a/trilium-syncthing-chart/values.yaml b/trilium-syncthing-chart/values.yaml new file mode 100644 index 0000000..3659b7b --- /dev/null +++ b/trilium-syncthing-chart/values.yaml @@ -0,0 +1,28 @@ +replicaCount: 1 + +image: + trilium: + repository: triliumnext/notes + tag: "v0.90.4" + pullPolicy: IfNotPresent + syncthing: + repository: linuxserver/syncthing + tag: "1.27.11" + pullPolicy: IfNotPresent + +service: + trilium: + type: ClusterIP + port: 8080 + syncthing: + type: ClusterIP + port: 8384 + +persistentVolume: + storageClass: "longhorn" + size: "5Gi" + +resources: {} +nodeSelector: {} +tolerations: [] +affinity: []