Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions .helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
name: cattr-server
description: A Helm Chart for Cattr Server
version: 0.0.1
apiVersion: v2
name: cattr-server
description: Cattr is an open-source time-tracking solution for teams
type: application
version: 0.1.0
appVersion: "latest"
keywords:
- cattr
- time-tracking
- productivity
- management
- time-tracker
- efficiency
- laravel
- vue
home: https://cattr.app
sources:
- https://github.com/cattr-app/server-application
- https://git.amazingcat.net/cattr/core/app
home: https://cattr.app/
dependencies:
- name: mysql
version: 11.1.9
repository: https://charts.bitnami.com/bitnami
condition: mysql.asChart,global.mysql.asChart
131 changes: 131 additions & 0 deletions .helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cattr.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "cattr.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 "cattr.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels.
*/}}
{{- define "cattr.labels" -}}
helm.sh/chart: {{ include "cattr.chart" . }}
{{ include "cattr.selectorLabels" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.commonLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
Selector labels.
*/}}
{{- define "cattr.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cattr.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: app
{{- end }}

{{/*
MySQL fully qualified name.
*/}}
{{- define "cattr.mysql.fullname" -}}
{{- printf "%s-mysql" (include "cattr.fullname" .) }}
{{- end }}

{{/*
MySQL host.
*/}}
{{- define "cattr.mysql.host" -}}
{{- if .Values.database.host }}
{{- .Values.database.host }}
{{- else }}
{{- include "cattr.mysql.fullname" . }}
{{- end }}
{{- end }}

{{/*
MySQL labels.
*/}}
{{- define "cattr.mysql.labels" -}}
helm.sh/chart: {{ include "cattr.chart" . }}
{{ include "cattr.mysql.selectorLabels" . }}
app.kubernetes.io/version: {{ .Values.mysql.image.tag | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.commonLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
MySQL selector labels.
*/}}
{{- define "cattr.mysql.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cattr.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: mysql
{{- end }}

{{/*
Secret name.
*/}}
{{- define "cattr.secretName" -}}
{{- include "cattr.fullname" . }}
{{- end }}

{{/*
Cattr image.
*/}}
{{- define "cattr.image" -}}
{{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) }}
{{- end }}

{{/*
MySQL image.
*/}}
{{- define "cattr.mysql.image" -}}
{{- printf "%s/%s:%s" .Values.mysql.image.registry .Values.mysql.image.repository .Values.mysql.image.tag }}
{{- end }}

{{/*
Common annotations.
*/}}
{{- define "cattr.annotations" -}}
{{- with .Values.commonAnnotations }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
Render the storageClass for a given persistence block.
*/}}
{{- define "cattr.storageClass" -}}
{{- $storageClass := .persistence.storageClass | default .global.storageClass -}}
{{- if $storageClass }}
storageClassName: {{ $storageClass | quote }}
{{- end }}
{{- end }}
23 changes: 17 additions & 6 deletions .helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
LOG_CHANNEL: "stderr"
LOG_LEVEL: "debug"
{{- range $key, $val := .Values.app.env }}
"{{ $key }}": "{{ $val }}"
name: {{ include "cattr.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "cattr.labels" . | nindent 4 }}
{{- with (include "cattr.annotations" .) }}
annotations:
{{- . | nindent 4 }}
{{- end }}
data:
APP_ENV: {{ .Values.cattr.appEnv | quote }}
APP_DEBUG: {{ .Values.cattr.appDebug | quote }}
APP_URL: {{ .Values.cattr.appUrl | quote }}
LOG_CHANNEL: {{ .Values.cattr.logChannel | quote }}
DB_CONNECTION: "mysql"
DB_HOST: {{ include "cattr.mysql.host" . | quote }}
DB_PORT: {{ .Values.database.port | quote }}
DB_DATABASE: {{ .Values.database.name | quote }}
S6_CMD_WAIT_FOR_SERVICES_MAXTIME: "300000"
Loading