logseq-syncthing chart

This commit is contained in:
2024-10-20 22:34:08 +01:00
parent 5611661838
commit 11d0d7d616
12 changed files with 268 additions and 0 deletions

View File

@@ -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/

View File

@@ -0,0 +1,6 @@
apiVersion: v2
name: logseq-syncthing
description: A Helm chart for deploying the webapp of logseq with syncthing in the background
type: application
version: 0.1.0
appVersion: "latest"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "logseq-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 "logseq-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 "logseq-syncthing-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "logseq-syncthing-chart.labels" -}}
helm.sh/chart: {{ include "logseq-syncthing-chart.chart" . }}
{{ include "logseq-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 "logseq-syncthing-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "logseq-syncthing-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "logseq-syncthing-chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "logseq-syncthing-chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "logseq-syncthing-chart.fullname" . }}
labels:
app: {{ include "logseq-syncthing-chart.name" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "logseq-syncthing-chart.name" . }}
template:
metadata:
labels:
app: {{ include "logseq-syncthing-chart.name" . }}
spec:
containers:
- name: logseq
image: "{{ .Values.image.logseq.repository }}:{{ .Values.image.logseq.tag }}"
imagePullPolicy: {{ .Values.image.logseq.pullPolicy }}
ports:
- containerPort: 80
volumeMounts:
- name: logseq-vault
mountPath: /vault
- name: syncthing
image: "{{ .Values.image.syncthing.repository }}:{{ .Values.image.syncthing.tag }}"
imagePullPolicy: {{ .Values.image.syncthing.pullPolicy }}
ports:
- containerPort: 8384
volumeMounts:
- name: logseq-vault
mountPath: /vault
- name: syncthing-config
mountPath: /config
volumes:
- name: logseq-vault
persistentVolumeClaim:
claimName: logseq-vault-pvc
- name: syncthing-config
persistentVolumeClaim:
claimName: syncthing-config-pvc

View File

@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: logseq-ingress
spec:
defaultBackend:
service:
name: {{ include "logseq-syncthing-chart.fullname" . }}-logseq
port:
number: 80
ingressClassName: tailscale
tls:
- hosts:
- notes

View File

@@ -0,0 +1,14 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: syncthing-ingress
spec:
defaultBackend:
service:
name: {{ include "logseq-syncthing-chart.fullname" . }}-syncthing
port:
number: 8384
ingressClassName: tailscale
tls:
- hosts:
- syncthing-notes

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: logseq-vault-pvc
labels:
app: logseq-syncthing
spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistentVolume.size }}

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: syncthing-config-pvc
labels:
app: logseq-syncthing
spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "100Mi"

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "logseq-syncthing-chart.fullname" . }}-logseq
labels:
app: {{ include "logseq-syncthing-chart.name" . }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.logseq.port }}
targetPort: 80
protocol: TCP
name: http
selector:
app: {{ include "logseq-syncthing-chart.name" . }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "logseq-syncthing-chart.fullname" . }}-syncthing
labels:
app: {{ include "logseq-syncthing-chart.name" . }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.syncthing.port }}
targetPort: 8384
protocol: TCP
name: syncthing
selector:
app: {{ include "logseq-syncthing-chart.name" . }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "logseq-syncthing-chart.fullname" . }}-test-connection"
labels:
{{- include "logseq-syncthing-chart.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "logseq-syncthing-chart.fullname" . }}:{{ .Values.service.logseq.port }}']
restartPolicy: Never

View File

@@ -0,0 +1,34 @@
replicaCount: 1
image:
logseq:
repository: ghcr.io/logseq/logseq-webapp
tag: "latest"
pullPolicy: IfNotPresent
syncthing:
repository: linuxserver/syncthing
tag: "1.27.11"
pullPolicy: IfNotPresent
service:
logseq:
type: ClusterIP
port: 80
syncthing:
type: ClusterIP
port: 8384
persistentVolume:
storageClass: "longhorn"
size: "5Gi"
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000