diff --git a/docker/dokuwiki/docker-compose.yml b/docker/dokuwiki/docker-compose.yml deleted file mode 100644 index e0b7419..0000000 --- a/docker/dokuwiki/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -services: - wiki: - image: dokuwiki/dokuwiki:2024-02-06b - restart: unless-stopped - ports: - - "44344:8080" - volumes: - - /mnt/nas1/shared/dokuwiki/dokuwiki:/storage - environment: - PHP_TIMEZONE: Europe/Madrid - PHP_MEMORYLIMIT: 512M - PHP_UPLOADLIMIT: 128M diff --git a/docker/pluton/docker-compose.yml b/docker/pluton/docker-compose.yml index 51176a6..2729d65 100644 --- a/docker/pluton/docker-compose.yml +++ b/docker/pluton/docker-compose.yml @@ -3,13 +3,13 @@ services: pluton: image: plutonhq/pluton:0.18.2 container_name: pluton-backup - restart: always + restart: unless-stopped ports: - "${SERVER_PORT:-5173}:${SERVER_PORT:-5173}" volumes: - ${PLUTON_DATA:-/mnt/nas1/shared/pluton/data}:/data - ${PLUTON_BACKUP_VOLUME_SHARED:-/mnt/nas1/shared}:/backups/shared - - ${PLUTON_BACKUP_VOLUME_DCSI:-/mnt/nas1/dcsi}:/backups/dcsi + - ${PLUTON_BACKUP_VOLUME_DCSI:-/mnt/dcsi}:/backups/dcsi environment: ENCRYPTION_KEY: ${ENCRYPTION_KEY} USER_NAME: ${USER_NAME} diff --git a/k8s/argo-apps/dokuwiki.yaml b/k8s/argo-apps/dokuwiki.yaml new file mode 100644 index 0000000..f8a54cf --- /dev/null +++ b/k8s/argo-apps/dokuwiki.yaml @@ -0,0 +1,51 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: dokuwiki + namespace: argo-cd +spec: + destination: + name: '' + namespace: apps-roboces + server: https://kubernetes.default.svc + sources: + - repoURL: git.roboces.dev/catalin/fukuops + chart: dokuwiki + targetRevision: 0.1.2 + helm: + valuesObject: + replicaCount: 1 + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: false + runAsUser: 33 + runAsGroup: 33 + capabilities: + drop: + - all + service: + type: LoadBalancer + port: 8004 + ingress: + enabled: true + className: "traefik" + hosts: + - host: wiki.roboces.dev + paths: + - path: / + pathType: Prefix + persistence: + enabled: true + storageClass: "truenas-nfs-csi" + accessMode: ReadWriteMany + size: 20Gi + env: + PHP_TIMEZONE: Europe/Madrid + PHP_MEMORYLIMIT: 512M + PHP_UPLOADLIMIT: 128M + project: roboces + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/k8s/charts/dokuwiki/Chart.yaml b/k8s/charts/dokuwiki/Chart.yaml new file mode 100644 index 0000000..fadd84f --- /dev/null +++ b/k8s/charts/dokuwiki/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: dokuwiki +description: A Helm chart for DokuWiki +type: application +version: 0.1.0 +appVersion: 2024-02-06b +annotations: + artifacthub.io/images: "- name: dokuwiki\n image: dokuwiki/dokuwiki:2024-02-06b\n" diff --git a/k8s/charts/dokuwiki/templates/_helpers.tpl b/k8s/charts/dokuwiki/templates/_helpers.tpl new file mode 100644 index 0000000..40dc045 --- /dev/null +++ b/k8s/charts/dokuwiki/templates/_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "dokuwiki.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "dokuwiki.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 "dokuwiki.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "dokuwiki.labels" -}} +helm.sh/chart: {{ include "dokuwiki.chart" . }} +{{ include "dokuwiki.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "dokuwiki.selectorLabels" -}} +app.kubernetes.io/name: {{ include "dokuwiki.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Service account name +*/}} +{{- define "dokuwiki.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "dokuwiki.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/k8s/charts/dokuwiki/templates/ingress.yaml b/k8s/charts/dokuwiki/templates/ingress.yaml new file mode 100644 index 0000000..adf8060 --- /dev/null +++ b/k8s/charts/dokuwiki/templates/ingress.yaml @@ -0,0 +1,45 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "dokuwiki.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "dokuwiki.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if .pathType }} + pathType: {{ .pathType }} + {{- end }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/k8s/charts/dokuwiki/templates/service.yaml b/k8s/charts/dokuwiki/templates/service.yaml new file mode 100644 index 0000000..146c8bb --- /dev/null +++ b/k8s/charts/dokuwiki/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "dokuwiki.fullname" . }} + labels: + {{- include "dokuwiki.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: TCP + name: http + selector: + {{- include "dokuwiki.selectorLabels" . | nindent 4 }} diff --git a/k8s/charts/dokuwiki/templates/statefulset.yaml b/k8s/charts/dokuwiki/templates/statefulset.yaml new file mode 100644 index 0000000..5400b2e --- /dev/null +++ b/k8s/charts/dokuwiki/templates/statefulset.yaml @@ -0,0 +1,91 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "dokuwiki.fullname" . }} + labels: + {{- include "dokuwiki.labels" . | nindent 4 }} +spec: + serviceName: {{ include "dokuwiki.fullname" . }}-headless + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "dokuwiki.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "dokuwiki.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: /storage + {{- if .Values.persistence.existingClaim }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + restartPolicy: Always + automountServiceAccountToken: false + {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: + - {{ .Values.persistence.accessMode }} + {{- if .Values.persistence.storageClass }} + {{- if eq "-" .Values.persistence.storageClass }} + storageClassName: "" + {{- else }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} + {{- end }} diff --git a/k8s/charts/dokuwiki/values.yaml b/k8s/charts/dokuwiki/values.yaml new file mode 100644 index 0000000..dbedf9e --- /dev/null +++ b/k8s/charts/dokuwiki/values.yaml @@ -0,0 +1,66 @@ +replicaCount: 1 + +image: + repository: dokuwiki/dokuwiki + pullpolicy: IfNotPresent + tag: "" + +imagePullSecrets: [] +podAnnotations: {} +podSecurityContext: {} +securityContext: {} + +service: + type: LoadBalancer + port: 8004 + targetPort: 8080 + +ingress: + enabled: true + className: "" + annotations: {} + hosts: + - host: wiki.roboces.dev + paths: + - path: / + pathType: Prefix + tls: [] + +persistence: + enabled: true + storageClass: "truenas-nfs-csi" + accessMode: ReadWriteMany + size: 2Gi + existingClaim: "" + +autoscaling: + enabled: false + +resources: {} + +livenessProbe: + tcpSocket: + port: 8080 + initialDelaySeconds: 30 + timeoutSeconds: 15 + successThreshold: 1 + failureThreshold: 3 + periodSeconds: 10 + +readinessProbe: + tcpSocket: + port: 8080 + initialDelaySeconds: 15 + timeoutSeconds: 2 + successThreshold: 1 + failureThreshold: 3 + periodSeconds: 10 + +nodeSelector: {} +tolerations: [] +affinity: {} + +env: + PHP_TIMEZONE: Europe/Madrid + PHP_MEMORYLIMIT: 512M + PHP_UPLOADLIMIT: 128M