init
This commit is contained in:
23
helm/nextcloud/.helmignore
Executable file
23
helm/nextcloud/.helmignore
Executable 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/
|
||||
23
helm/nextcloud/Chart.yaml
Executable file
23
helm/nextcloud/Chart.yaml
Executable file
@@ -0,0 +1,23 @@
|
||||
apiVersion: v2
|
||||
name: Nextcloud
|
||||
description: A Simple Nextcloud Chart
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
appVersion: 1.16.0
|
||||
399
helm/nextcloud/templates/nextcloud.yaml
Normal file
399
helm/nextcloud/templates/nextcloud.yaml
Normal file
@@ -0,0 +1,399 @@
|
||||
{{ define "helm_keep_annotation" }}
|
||||
"helm.sh/resource-policy": keep
|
||||
{{ end }}
|
||||
|
||||
{{/* Generated Postgres Config */}}
|
||||
{{ define "POSTGRES_NAME" }}{{ printf "%s-postgres" .Release.Name | lower }}{{ end }}
|
||||
{{ define "POSTGRES_DB" }}nextcloud{{ end }}
|
||||
{{ define "DATABASE_HOST" }}{{ .Release.Name }}-postgres{{ end }}
|
||||
{{ define "POSTGRES_USER" }}postgres{{ end }}
|
||||
{{ $POSTGRES_SECRETS := (lookup "v1" "Secret" .Release.Namespace ( include "POSTGRES_NAME" . )).data }}
|
||||
{{ $POSTGRES_PASSWORD := (ternary (dict "POSTGRES_PASSWORD" (randAlphaNum 64 | b64enc)) $POSTGRES_SECRETS (not $POSTGRES_SECRETS)).POSTGRES_PASSWORD }}
|
||||
|
||||
{{/* Generated Nextcloud Config */}}
|
||||
{{ define "NEXTCLOUD_NAME" }}{{ printf "%s-nextcloud" .Release.Name | lower }}{{ end }}
|
||||
{{ define "ADMIN_USER" }}admin{{ end }}
|
||||
{{ $NEXTCLOUD_SECRETS := (lookup "v1" "Secret" .Release.Namespace ( include "NEXTCLOUD_NAME" . )).data }}
|
||||
{{/* ternary (create a dict with random NEXTCLOUD_ADMIN_PASSWORD) (actual dictionary) (test whether NEXTCLOUD_SECRETS exists) */}}
|
||||
{{ $NEXTCLOUD_ADMIN_PASSWORD := (ternary (dict "NEXTCLOUD_ADMIN_PASSWORD" (randAlphaNum 64 | b64enc)) $NEXTCLOUD_SECRETS (not $NEXTCLOUD_SECRETS)).NEXTCLOUD_ADMIN_PASSWORD }}
|
||||
|
||||
{{/* Generated Redis Config */}}
|
||||
{{ define "REDIS_NAME" }}{{ printf "%s-redis" .Release.Name | lower }}{{ end }}
|
||||
{{ define "REDIS_HOST" }}{{ .Release.Name }}-redis{{ end }}
|
||||
{{ $REDIS_SECRETS := (lookup "v1" "Secret" .Release.Namespace ( include "REDIS_NAME" . )).data }}
|
||||
{{ $REDIS_PASSWORD := (ternary (dict "REDIS_PASSWORD" (randAlphaNum 64 | b64enc)) $REDIS_SECRETS (not $REDIS_SECRETS)).REDIS_PASSWORD }}
|
||||
|
||||
{{/* Uncomment this and run with --debug to verify secrets are working
|
||||
# NEXTCLOUD_ADMIN_PASSWORD: {{ $NEXTCLOUD_ADMIN_PASSWORD | quote }}
|
||||
# POSTGRES_PASSWORD: {{ $POSTGRES_PASSWORD | quote }}
|
||||
# REDIS_HOST_PASSWORD: {{ $REDIS_PASSWORD | quote }}
|
||||
*/}}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-postgres
|
||||
annotations:
|
||||
{{ include "helm_keep_annotation" . | nindent 4 }}
|
||||
data:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: nextcloud
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-postgres
|
||||
annotations:
|
||||
{{ include "helm_keep_annotation" . | nindent 4 }}
|
||||
type: generic
|
||||
data:
|
||||
POSTGRES_PASSWORD: {{ $POSTGRES_PASSWORD | quote }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-postgres-init
|
||||
annotations:
|
||||
{{ include "helm_keep_annotation" . | nindent 4 }}
|
||||
stringData:
|
||||
init-user-db.sh: |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
CREATE USER nextcloud PASSWORD '{{ $POSTGRES_PASSWORD | b64dec }}';
|
||||
GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
|
||||
GRANT USAGE, CREATE ON SCHEMA public TO nextcloud;
|
||||
EOSQL
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-redis
|
||||
annotations:
|
||||
{{ include "helm_keep_annotation" . | nindent 4 }}
|
||||
type: generic
|
||||
data:
|
||||
REDIS_PASSWORD: {{ $REDIS_PASSWORD | quote }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-nextcloud
|
||||
annotations:
|
||||
{{ include "helm_keep_annotation" . | nindent 4 }}
|
||||
data:
|
||||
NEXTCLOUD_TRUSTED_DOMAINS: {{ .Values.nextcloud.domain }}
|
||||
OVERWRITEPROTOCOL: https
|
||||
OVERWRITECLIURL: {{ .Values.nextcloud.domain }}
|
||||
NEXTCLOUD_ADMIN_USER: admin
|
||||
POSTGRES_USER: nextcloud
|
||||
POSTGRES_HOST: {{ .Release.Name }}
|
||||
POSTGRES_DB: nextcloud
|
||||
REDIS_HOST: {{ .Release.Name }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-nextcloud
|
||||
annotations:
|
||||
{{ include "helm_keep_annotation" . | nindent 4 }}
|
||||
type: generic
|
||||
data:
|
||||
NEXTCLOUD_ADMIN_PASSWORD: {{ $NEXTCLOUD_ADMIN_PASSWORD | quote }}
|
||||
POSTGRES_PASSWORD: {{ $POSTGRES_PASSWORD | quote }}
|
||||
REDIS_HOST_PASSWORD: {{ $REDIS_PASSWORD | quote }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: nextcloud
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: nextcloud
|
||||
spec:
|
||||
containers:
|
||||
- name: nextcloud
|
||||
image: {{ .Values.nextcloud.image }}
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ .Release.Name }}-nextcloud
|
||||
- secretRef:
|
||||
name: {{ .Release.Name }}-nextcloud
|
||||
volumeMounts:
|
||||
- mountPath: /var/www/html
|
||||
name: html
|
||||
- mountPath: /var/www/html/data
|
||||
name: data
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Gi"
|
||||
cpu: "1m"
|
||||
limits:
|
||||
memory: "4Gi"
|
||||
cpu: "4"
|
||||
- name: postgres
|
||||
image: postgres:15
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ .Release.Name }}-postgres
|
||||
- secretRef:
|
||||
name: {{ .Release.Name }}-postgres
|
||||
volumeMounts:
|
||||
- name: postgres
|
||||
mountPath: /var/lib/postgresql/data
|
||||
- name: postgres-init
|
||||
mountPath: /docker-entrypoint-initdb.d/init-user-db.sh
|
||||
subPath: init-user-db.sh
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
name: postgres
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Gi"
|
||||
cpu: "1m"
|
||||
limits:
|
||||
memory: "4Gi"
|
||||
cpu: "4"
|
||||
- name: redis
|
||||
image: redis:7
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
name: redis
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: redis
|
||||
command:
|
||||
- redis-server
|
||||
- --save
|
||||
- "60"
|
||||
- "1"
|
||||
- --loglevel
|
||||
- warning
|
||||
- --requirepass
|
||||
- {{ $REDIS_PASSWORD | b64dec | quote }}
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Gi"
|
||||
cpu: "1m"
|
||||
limits:
|
||||
memory: "4Gi"
|
||||
cpu: "4"
|
||||
volumes:
|
||||
- name: html
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-html
|
||||
# emptyDir:
|
||||
# sizeLimit: 1Gi
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-data
|
||||
# emptyDir:
|
||||
# sizeLimit: 1Gi
|
||||
- name: postgres
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-postgres
|
||||
# emptyDir:
|
||||
# sizeLimit: 1Gi
|
||||
- name: redis
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-redis
|
||||
# emptyDir:
|
||||
# sizeLimit: 1Gi
|
||||
- name: postgres-init
|
||||
secret:
|
||||
secretName: {{ .Release.Name }}-postgres-init
|
||||
|
||||
---
|
||||
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-cron
|
||||
spec:
|
||||
schedule: "*/5 * * * *"
|
||||
failedJobsHistoryLimit: 1
|
||||
successfulJobsHistoryLimit: 0
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: 33
|
||||
runAsGroup: 33
|
||||
containers:
|
||||
- name: nextcloud
|
||||
image: {{ .Values.nextcloud.image }}
|
||||
command:
|
||||
- php
|
||||
- -f
|
||||
- cron.php
|
||||
volumeMounts:
|
||||
- mountPath: /var/www/html
|
||||
name: html
|
||||
- mountPath: /var/www/html/data
|
||||
name: data
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ .Release.Name }}-nextcloud
|
||||
- secretRef:
|
||||
name: {{ .Release.Name }}-nextcloud
|
||||
resources:
|
||||
requests:
|
||||
memory: "1Gi"
|
||||
cpu: "1m"
|
||||
limits:
|
||||
memory: "4Gi"
|
||||
cpu: "4"
|
||||
volumes:
|
||||
- name: html
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-html
|
||||
# emptyDir:
|
||||
# sizeLimit: 1Gi
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-data
|
||||
# emptyDir:
|
||||
# sizeLimit: 1Gi
|
||||
restartPolicy: OnFailure
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-html
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
spec:
|
||||
storageClassName: zfs-iscsi-enc0
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 16Gi
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-data
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
spec:
|
||||
storageClassName: zfs-iscsi-enc0
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 512Gi
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-postgres
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
spec:
|
||||
storageClassName: zfs-iscsi-enc0
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-redis
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
spec:
|
||||
storageClassName: zfs-iscsi-enc0
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app.kubernetes.io/name: nextcloud
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: http
|
||||
- name: postgres
|
||||
protocol: TCP
|
||||
port: 5432
|
||||
targetPort: postgres
|
||||
- name: redis
|
||||
protocol: TCP
|
||||
port: 6379
|
||||
targetPort: redis
|
||||
|
||||
---
|
||||
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt
|
||||
kubernetes.io/ingress.class: nginx
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "0"
|
||||
nginx.org/client-max-body-size: "0"
|
||||
spec:
|
||||
rules:
|
||||
- host: {{ .Values.nextcloud.domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: nextcloud
|
||||
port:
|
||||
name: http
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ .Values.nextcloud.domain }}
|
||||
secretName: nextcloud-tls-cert
|
||||
3
helm/nextcloud/values.yaml
Executable file
3
helm/nextcloud/values.yaml
Executable file
@@ -0,0 +1,3 @@
|
||||
nextcloud:
|
||||
image: nextcloud:26
|
||||
domain: nextcloud.reeseapps.com
|
||||
Reference in New Issue
Block a user