deploy dolibarr
This commit is contained in:
22
chart/templates/NOTES.txt
Normal file
22
chart/templates/NOTES.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "erp.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "erp.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "erp.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "erp.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
62
chart/templates/_helpers.tpl
Normal file
62
chart/templates/_helpers.tpl
Normal file
@@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "erp.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 "erp.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 "erp.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "erp.labels" -}}
|
||||
helm.sh/chart: {{ include "erp.chart" . }}
|
||||
{{ include "erp.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "erp.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "erp.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "erp.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "erp.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
23
chart/templates/config.yaml
Normal file
23
chart/templates/config.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "erp.name" . }}-config
|
||||
namespace: {{ .Release.Namespace }}
|
||||
# Doc: https://hub.docker.com/r/dolibarr/dolibarr https://github.com/Dolibarr/dolibarr-docker
|
||||
data:
|
||||
DOLI_DB_TYPE: pgsql
|
||||
DOLI_DB_HOST: pgbouncer.tools
|
||||
DOLI_DB_HOST_PORT: !!str 5432
|
||||
# DOLI_DB_USER: root
|
||||
# DOLI_DB_PASSWORD: root
|
||||
DOLI_DB_NAME: erp
|
||||
DOLI_URL_ROOT: 'https://erp.arcodange.duckdns.org'
|
||||
# DOLI_ADMIN_LOGIN: 'admin'
|
||||
# DOLI_ADMIN_PASSWORD: 'admininitialpassword'
|
||||
DOLI_ENABLE_MODULES: Societe,Facture
|
||||
DOLI_COMPANY_NAME: Arcodange
|
||||
DOLI_COMPANY_COUNTRYCODE: FR
|
||||
PHP_INI_DATE_TIMEZONE: Europe/Paris
|
||||
DOLI_AUTH: dolibarr
|
||||
DOLI_CRON: !!str 0
|
||||
# DOLI_INSTANCE_UNIQUE_ID: <random salt for encryption>
|
||||
111
chart/templates/deployment.yaml
Normal file
111
chart/templates/deployment.yaml
Normal file
@@ -0,0 +1,111 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "erp.fullname" . }}
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
configmap-hash: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
|
||||
configmap2-hash: {{ include (print .Template.BasePath "/scripts-config.yaml") . | sha256sum }}
|
||||
configmap3-hash: {{ include (print .Template.BasePath "/script-entrypoint-config.yaml") . | sha256sum }}
|
||||
spec:
|
||||
revisionHistoryLimit: 5
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "erp.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "erp.serviceAccountName" . }}
|
||||
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 }}"
|
||||
command: ["/bin/bash", "/usr/local/bin/custom-entrypoint.sh", "apache2-foreground"]
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "erp.name" . }}-config
|
||||
- secretRef:
|
||||
name: secretkv
|
||||
env:
|
||||
- name: DOLI_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: vso-db-credentials
|
||||
key: username
|
||||
- name: DOLI_DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: vso-db-credentials
|
||||
key: password
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
{{- with .Values.livenessProbe }}
|
||||
livenessProbe:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.livenessProbe }}
|
||||
readinessProbe:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: dolibarr
|
||||
mountPath: /var/www/documents
|
||||
subPath: documents
|
||||
- name: dolibarr
|
||||
mountPath: /var/www/html/custom
|
||||
subPath: custom
|
||||
- name: dolibarr
|
||||
mountPath: /var/backups
|
||||
subPath: backups
|
||||
- name: before-start-scripts
|
||||
mountPath: /var/www/scripts/before-starting.d
|
||||
- name: custom-entrypoint-script
|
||||
mountPath: /usr/local/bin/custom-entrypoint.sh
|
||||
subPath: custom-entrypoint.sh
|
||||
volumes:
|
||||
- name: dolibarr
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "erp.fullname" . }}
|
||||
- name: before-start-scripts
|
||||
configMap:
|
||||
name: dolibarr-before-start-scripts
|
||||
- name: custom-entrypoint-script
|
||||
configMap:
|
||||
name: dolibarr-custom-entrypoint-script
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
32
chart/templates/hpa.yaml
Normal file
32
chart/templates/hpa.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "erp.fullname" . }}
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "erp.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
61
chart/templates/ingress.yaml
Normal file
61
chart/templates/ingress.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "erp.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
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 and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
16
chart/templates/pvc.yaml
Normal file
16
chart/templates/pvc.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ template "erp.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
helm.sh/resource-policy: keep
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 50Gi
|
||||
storageClassName: nfs-client
|
||||
7
chart/templates/script-entrypoint-config.yaml
Normal file
7
chart/templates/script-entrypoint-config.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: dolibarr-custom-entrypoint-script
|
||||
data:
|
||||
custom-entrypoint.sh: |
|
||||
{{- .Files.Get "scripts/custom_entrypoint.sh" | nindent 4 }}
|
||||
10
chart/templates/scripts-config.yaml
Normal file
10
chart/templates/scripts-config.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: dolibarr-before-start-scripts
|
||||
data:
|
||||
update_conf_db_credentials.sh: |
|
||||
{{- .Files.Get "scripts/update_conf_db_credentials.sh" | nindent 4 }}
|
||||
|
||||
update_table_ownership.sql: |
|
||||
{{- .Files.Get "scripts/update_ownership.sql" | nindent 4 }}
|
||||
15
chart/templates/service.yaml
Normal file
15
chart/templates/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "erp.fullname" . }}
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "erp.selectorLabels" . | nindent 4 }}
|
||||
13
chart/templates/serviceaccount.yaml
Normal file
13
chart/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "erp.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||
{{- end }}
|
||||
15
chart/templates/tests/test-connection.yaml
Normal file
15
chart/templates/tests/test-connection.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "erp.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "erp.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command: ['wget']
|
||||
args: ['{{ include "erp.fullname" . }}:{{ .Values.service.port }}']
|
||||
restartPolicy: Never
|
||||
13
chart/templates/vaultauth.yaml
Normal file
13
chart/templates/vaultauth.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: secrets.hashicorp.com/v1beta1
|
||||
kind: VaultAuth
|
||||
metadata:
|
||||
name: auth
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
method: kubernetes
|
||||
mount: kubernetes
|
||||
kubernetes:
|
||||
role: erp
|
||||
serviceAccount: {{ include "erp.serviceAccountName" . }}
|
||||
audiences:
|
||||
- vault
|
||||
25
chart/templates/vaultdynamicsecret.yaml
Normal file
25
chart/templates/vaultdynamicsecret.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: secrets.hashicorp.com/v1beta1
|
||||
kind: VaultDynamicSecret
|
||||
metadata:
|
||||
name: vso-db
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
|
||||
# Mount path of the secrets backend
|
||||
mount: postgres
|
||||
|
||||
# Path to the secret
|
||||
path: creds/erp
|
||||
|
||||
# Where to store the secrets, VSO will create the secret
|
||||
destination:
|
||||
create: true
|
||||
name: vso-db-credentials
|
||||
|
||||
# Restart these pods when secrets rotated
|
||||
rolloutRestartTargets:
|
||||
- kind: Deployment
|
||||
name: {{ include "erp.fullname" . }}
|
||||
|
||||
# Name of the CRD to authenticate to Vault
|
||||
vaultAuthRef: auth
|
||||
24
chart/templates/vaultsecret.yaml
Normal file
24
chart/templates/vaultsecret.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: secrets.hashicorp.com/v1beta1
|
||||
kind: VaultStaticSecret
|
||||
metadata:
|
||||
name: vault-kv-app
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
type: kv-v2
|
||||
|
||||
# mount path
|
||||
mount: kvv2
|
||||
|
||||
# path of the secret
|
||||
path: erp/config
|
||||
|
||||
# dest k8s secret
|
||||
destination:
|
||||
name: secretkv
|
||||
create: true
|
||||
|
||||
# static secret refresh interval
|
||||
refreshAfter: 24h
|
||||
|
||||
# Name of the CRD to authenticate to Vault
|
||||
vaultAuthRef: auth
|
||||
Reference in New Issue
Block a user