first commit

This commit is contained in:
Noor E Ilahi
2026-01-09 12:54:53 +05:30
commit 7ccf44f7da
1070 changed files with 113036 additions and 0 deletions

19
.helm/Chart.yaml Normal file
View File

@@ -0,0 +1,19 @@
name: cattr-server
description: A Helm Chart for Cattr Server
version: 0.0.1
apiVersion: v2
keywords:
- cattr
- management
- time-tracker
- efficiency
- laravel
- vue
sources:
- 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

View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
LOG_CHANNEL: "stderr"
LOG_LEVEL: "debug"
{{- range $key, $val := .Values.app.env }}
"{{ $key }}": "{{ $val }}"
{{- end }}

View File

@@ -0,0 +1,99 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-web
spec:
replicas: {{ .Values.app.replicas | default 2 }}
revisionHistoryLimit: {{ .Values.app.revisionHistoryLimit | default 2 }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}-web
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Release.Name }}-web
spec:
containers:
- name: app
imagePullPolicy: {{.Values.app.image.pullPolicy}}
image: {{- printf " %s/%s:%s" .Values.app.image.registry .Values.app.image.repository .Values.app.image.tag }}
ports:
- containerPort: 80
name: http-web-svc
protocol: TCP
env:
- name: APP_ENV
value: {{ .Values.app.environment | default "dev" | quote }}
- name: S6_CMD_WAIT_FOR_SERVICES_MAXTIME
value: "180000"
volumeMounts:
- mountPath: /app/storage/app/screenshots
name: app-screenshots
- mountPath: /app/storage/app/attachments
name: app-attachments
- mountPath: /app/bootstrap/cache
name: bootstrap-cache
- mountPath: /tmp
name: app-tmp
- mountPath: /run
name: app-run
- mountPath: /var/lib/nginx/tmp
name: nginx-tmp
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
- secretRef:
name: {{ .Release.Name }}-secret
startupProbe:
exec:
command: ["php82", "artisan", "octane:status"]
failureThreshold: 60
periodSeconds: 5
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: http-web-svc
failureThreshold: 3
periodSeconds: 5
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: http-web-svc
failureThreshold: 3
successThreshold: 1
periodSeconds: 15
volumes:
- name: bootstrap-cache
emptyDir: {}
- name: app-tmp
emptyDir: {}
- name: storage-framework
emptyDir: {}
- name: app-run
emptyDir: {}
- name: nginx-tmp
emptyDir: {}
- name: nginx-run
emptyDir: {}
- name: app-screenshots
{{- if eq .Values.app.persistence.screenshots.enabled "true" }}
persistentVolumeClaim:
{{- if not (empty .Values.app.persistence.screenshots.existingClaim) }}
claimName: {{ .Values.app.persistence.screenshots.existingClaim }}
{{- else }}
claimName: {{ .Release.Name }}-pvc-screenshots
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: app-attachments
{{- if eq .Values.app.persistence.attachments.enabled "true" }}
persistentVolumeClaim:
{{- if not (empty .Values.app.persistence.attachments.existingClaim) }}
claimName: {{ .Values.app.persistence.attachments.existingClaim }}
{{- else }}
claimName: {{ .Release.Name }}-pvc-attachments
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-ingress
spec:
ingressClassName: {{.Values.ingress.class}}
rules:
- host:
- {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}
port:
number: {{ .Values.app.service.port }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- if empty .Values.app.persistence.attachments.existingClaim }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: cattr-app
name: {{ .Release.Name }}-pvc-attachments
spec:
storageClassName: {{ .Values.app.persistence.attachments.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.app.persistence.attachments.size }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- if empty .Values.app.persistence.screenshots.existingClaim }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: cattr-app
name: {{ .Release.Name }}-pvc-screenshots
spec:
storageClassName: {{ .Values.app.persistence.screenshots.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.app.persistence.screenshots.size }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- $secret := (lookup "v1" "Secret" .Release.Namespace (printf "%s-secret" .Release.Name)) }}
{{- $appKeyValue := (printf "%s%s" "base64:" (encryptAES (randAlpha 32) "plaintext")) }}
{{- if $secret }}
{{- $appKeyValue = index $secret.data "APP_KEY" }}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-secret
type: Opaque
stringData:
DB_USERNAME: {{ .Values.mysql.auth.username | quote }}
DB_PASSWORD: {{ .Values.mysql.auth.password | quote }}
APP_KEY: {{ .Values.app.key | default $appKeyValue | quote }}

24
.helm/templates/svc.yaml Normal file
View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/component: {{ .Release.Name }}-web
spec:
type: {{ .Values.app.service.type }}
{{- if and .Values.app.service.clusterIP (eq .Values.app.service.type "ClusterIP") }}
clusterIP: {{ .Values.app.service.clusterIP }}
{{- end }}
{{- if and (eq .Values.app.service.type "LoadBalancer") (not (empty .Values.app.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.app.service.loadBalancerIP }}
{{- end }}
ports:
- name: http-web-svc
port: {{ .Values.app.service.port }}
protocol: TCP
targetPort: http-web-svc
{{- if (and (or (eq .Values.app.service.type "NodePort") (eq .Values.app.service.type "LoadBalancer")) .Values.app.service.nodePort) }}
nodePort: {{ .Values.app.service.nodePort }}
{{- end }}
selector:
app.kubernetes.io/name: {{ .Release.Name }}-web

53
.helm/values.yaml Normal file
View File

@@ -0,0 +1,53 @@
mysql:
asChart: true
auth:
database: "cattr"
username: "cattr"
password: "password"
app:
key: ""
replicas: 1
revisionHistoryLimit: 2
environment: "production"
persistence:
screenshots:
enabled: "true"
existingClaim: ""
storageClass: ""
accessModes:
- ReadWriteMany
size: 10Gi
attachments:
enabled: "true"
existingClaim: ""
storageClass: ""
accessModes:
- ReadWriteMany
size: 10Gi
env:
DB_HOST: "db"
DB_DATABASE: "cattr"
DB_USERNAME: "cattr"
DB_PASSWORD: "password"
APP_ADMIN_EMAIL: "admin@cattr.app"
APP_ADMIN_PASSWORD: "password"
APP_ADMIN_NAME: "Admin"
service:
type: ClusterIP
clusterIP: ""
loadBalancerIP: ""
externalTrafficPolicy: Cluster
nodePort: 80
port: 80
image:
registry: registry.git.amazingcat.net
repository: cattr/core/app
tag: v4.0.0-RC49
pullPolicy: IfNotPresent
ingress:
enabled: false
host: ""
class: ""