diff --git a/argocd-apps/omegabasms.yaml b/argocd-apps/omegabasms.yaml new file mode 100644 index 0000000..70d104f --- /dev/null +++ b/argocd-apps/omegabasms.yaml @@ -0,0 +1,21 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: omegabasms + namespace: argocd +spec: + project: my-apps + source: + repoURL: ssh://git@gitea-ssh.dev-tools.svc.cluster.local:2222/dvirlabs/my-apps.git + targetRevision: HEAD + path: charts/omegabasms-chart + helm: + valueFiles: + - ../../manifests/omegabasms/values.yaml + destination: + server: https://kubernetes.default.svc + namespace: my-apps + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/charts/omegabasms-chart/Chart.yaml b/charts/omegabasms-chart/Chart.yaml new file mode 100644 index 0000000..a04599f --- /dev/null +++ b/charts/omegabasms-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: omegabasms +description: A Helm chart for OmegaBaSMS - WhatsApp to SMS relay with dashboard +type: application +version: 1.0.0 +appVersion: "1.0.0" diff --git a/charts/omegabasms-chart/templates/_helpers.tpl b/charts/omegabasms-chart/templates/_helpers.tpl new file mode 100644 index 0000000..e1e0055 --- /dev/null +++ b/charts/omegabasms-chart/templates/_helpers.tpl @@ -0,0 +1,47 @@ +{{- define "omegabasms.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "omegabasms.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 }} + +{{- define "omegabasms.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "omegabasms.labels" -}} +helm.sh/chart: {{ include "omegabasms.chart" . }} +{{ include "omegabasms.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- with .Values.commonLabels }} +{{ toYaml . }} +{{- end }} +{{- end }} + +{{- define "omegabasms.selectorLabels" -}} +app.kubernetes.io/name: {{ include "omegabasms.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "omegabasms.backend.labels" -}} +{{ include "omegabasms.labels" . }} +app.kubernetes.io/component: backend +{{- end }} + +{{- define "omegabasms.backend.selectorLabels" -}} +{{ include "omegabasms.selectorLabels" . }} +app.kubernetes.io/component: backend +{{- end }} diff --git a/charts/omegabasms-chart/templates/deployment.yaml b/charts/omegabasms-chart/templates/deployment.yaml new file mode 100644 index 0000000..444fc25 --- /dev/null +++ b/charts/omegabasms-chart/templates/deployment.yaml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "omegabasms.fullname" . }}-backend + labels: + {{- include "omegabasms.backend.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.backend.replicas }} + selector: + matchLabels: + {{- include "omegabasms.backend.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "omegabasms.backend.selectorLabels" . | nindent 8 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: omegabasms + image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}" + imagePullPolicy: {{ .Values.backend.image.pullPolicy }} + command: ["sh", "-c", "find /app/.wwebjs_auth -name 'Singleton*' -delete 2>/dev/null; node index.js"] + ports: + - name: http + containerPort: {{ .Values.backend.service.port }} + protocol: TCP + env: + - name: GROUP_NAMES + value: {{ .Values.backend.env.groupNames | quote }} + - name: TEXTBEE_DEVICE_ID + value: {{ .Values.backend.env.textbeeDeviceId | quote }} + - name: TEXTBEE_API_KEY + value: {{ .Values.backend.env.textbeeApiKey | quote }} + - name: SMS_RECIPIENT + value: {{ .Values.backend.env.smsRecipient | quote }} + - name: TELEGRAM_BOT_TOKEN + value: {{ .Values.backend.env.telegramBotToken | quote }} + - name: TELEGRAM_CHAT_ID + value: {{ .Values.backend.env.telegramChatId | quote }} + - name: APPS_SCRIPT_URL + value: {{ .Values.backend.env.appsScriptUrl | quote }} + - name: SMS_WEBHOOK_TOKEN + value: {{ .Values.backend.env.smsWebhookToken | quote }} + - name: TEST_GROUP_NAMES + value: {{ .Values.backend.env.testGroupNames | quote }} + - name: TEST_SMS_RECIPIENT + value: {{ .Values.backend.env.testSmsRecipient | quote }} + - name: TEST_SMS_FROM + value: {{ .Values.backend.env.testSmsFrom | quote }} + - name: BATCH_INTERVAL_MS + value: {{ .Values.backend.env.batchIntervalMs | quote }} + - name: BATCH_MAX_CHARS + value: {{ .Values.backend.env.batchMaxChars | quote }} + - name: INCLUDE_OWN_MESSAGES + value: {{ .Values.backend.env.includeOwnMessages | quote }} + - name: OWN_NAME + value: {{ .Values.backend.env.ownName | quote }} + - name: OWN_LAST_NAME + value: {{ .Values.backend.env.ownLastName | quote }} + - name: KEEP_ALIVE_URL + value: {{ .Values.backend.env.keepAliveUrl | quote }} + - name: KEEP_ALIVE_INTERVAL_MS + value: {{ .Values.backend.env.keepAliveIntervalMs | quote }} + - name: PORT + value: {{ .Values.backend.service.port | quote }} + volumeMounts: + - name: wwebjs-auth + mountPath: /app/.wwebjs_auth + - name: wwebjs-cache + mountPath: /app/.wwebjs_cache + resources: + {{- toYaml .Values.backend.resources | nindent 12 }} + volumes: + - name: wwebjs-auth + persistentVolumeClaim: + claimName: {{ include "omegabasms.fullname" . }}-backend-auth + - name: wwebjs-cache + emptyDir: {} diff --git a/charts/omegabasms-chart/templates/ingress.yaml b/charts/omegabasms-chart/templates/ingress.yaml new file mode 100644 index 0000000..f6e5667 --- /dev/null +++ b/charts/omegabasms-chart/templates/ingress.yaml @@ -0,0 +1,45 @@ +{{- if .Values.backend.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "omegabasms.fullname" . }}-backend + labels: + {{- include "omegabasms.labels" . | nindent 4 }} + component: backend + {{- with .Values.backend.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.backend.ingress.className }} + ingressClassName: {{ .Values.backend.ingress.className }} + {{- end }} + rules: + {{- range .Values.backend.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ include "omegabasms.fullname" $ }}-backend + port: + number: {{ $.Values.backend.service.port }} + {{- end }} + {{- end }} + {{- if .Values.backend.ingress.tls }} + tls: + {{- range .Values.backend.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/omegabasms-chart/templates/pvc.yaml b/charts/omegabasms-chart/templates/pvc.yaml new file mode 100644 index 0000000..09ab883 --- /dev/null +++ b/charts/omegabasms-chart/templates/pvc.yaml @@ -0,0 +1,23 @@ +{{- if .Values.backend.persistence.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "omegabasms.fullname" . }}-backend-auth + labels: + {{- include "omegabasms.backend.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + accessModes: + {{- range .Values.backend.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + {{- if .Values.backend.persistence.storageClass }} + storageClassName: {{ .Values.backend.persistence.storageClass }} + {{- end }} + resources: + requests: + storage: {{ .Values.backend.persistence.size }} +{{- end }} diff --git a/charts/omegabasms-chart/templates/service.yaml b/charts/omegabasms-chart/templates/service.yaml new file mode 100644 index 0000000..6db3455 --- /dev/null +++ b/charts/omegabasms-chart/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "omegabasms.fullname" . }}-backend + labels: + {{- include "omegabasms.backend.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.backend.service.type }} + ports: + - port: {{ .Values.backend.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "omegabasms.backend.selectorLabels" . | nindent 4 }} diff --git a/charts/omegabasms-chart/values.yaml b/charts/omegabasms-chart/values.yaml new file mode 100644 index 0000000..b39c54a --- /dev/null +++ b/charts/omegabasms-chart/values.yaml @@ -0,0 +1,70 @@ +nameOverride: "" +fullnameOverride: "" + +imagePullSecrets: [] + +commonLabels: {} +commonAnnotations: {} + +backend: + image: + repository: omegabasms + tag: latest + pullPolicy: IfNotPresent + + replicas: 0 + + resources: + limits: + cpu: 1000m + memory: 1Gi + requests: + cpu: 500m + memory: 512Mi + + env: + groupNames: "Group1,Group2" + textbeeDeviceId: "" + textbeeApiKey: "" + smsRecipient: "" + telegramBotToken: "" + telegramChatId: "" + batchIntervalMs: "900000" + batchMaxChars: "700" + includeOwnMessages: "true" + ownName: "" + ownLastName: "" + keepAliveUrl: "" + keepAliveIntervalMs: "300000" + appsScriptUrl: "" + smsWebhookToken: "" + testGroupNames: "" + testSmsRecipient: "" + testSmsFrom: "" + + persistence: + enabled: true + accessModes: + - ReadWriteOnce + storageClass: "" + size: 1Gi + + service: + type: ClusterIP + port: 3000 + + healthCheck: + path: /liveness + initialDelaySeconds: 10 + periodSeconds: 30 + + ingress: + enabled: false + className: "" + annotations: {} + hosts: + - host: omegabasms.example.com + paths: + - path: / + pathType: Prefix + tls: [] diff --git a/manifests/brand-master/values.yaml b/manifests/brand-master/values.yaml index 05c1a38..b86b470 100644 --- a/manifests/brand-master/values.yaml +++ b/manifests/brand-master/values.yaml @@ -9,7 +9,7 @@ backend: image: repository: harbor.dvirlabs.com/my-apps/brand-master-backend pullPolicy: IfNotPresent - tag: "master-f02f810" + tag: "master-dac10f2" service: type: ClusterIP port: 8000 @@ -70,7 +70,7 @@ frontend: image: repository: harbor.dvirlabs.com/my-apps/brand-master-frontend pullPolicy: IfNotPresent - tag: "master-f02f810" + tag: "master-61d5832" service: type: ClusterIP port: 80 diff --git a/manifests/omegabasms/cname.yaml b/manifests/omegabasms/cname.yaml new file mode 100644 index 0000000..17ff2a5 --- /dev/null +++ b/manifests/omegabasms/cname.yaml @@ -0,0 +1,2 @@ +enabled: true +hostname: omegabasms.dvirlabs.com diff --git a/manifests/omegabasms/values.yaml b/manifests/omegabasms/values.yaml new file mode 100644 index 0000000..7422b87 --- /dev/null +++ b/manifests/omegabasms/values.yaml @@ -0,0 +1,76 @@ +nameOverride: "" +fullnameOverride: "" + +commonLabels: {} +commonAnnotations: {} + +imagePullSecrets: + - name: omegabasms-dockerhub + +backend: + image: + repository: elisha852/omegabasms + tag: latest + pullPolicy: Always + + replicas: 1 + + resources: + limits: + cpu: 1000m + memory: 1Gi + requests: + cpu: 500m + memory: 512Mi + + env: + groupNames: 'אומגה בשו"ב' + textbeeDeviceId: "6a159ba75ccc2dc46eac318a" + textbeeApiKey: "a0728b4d-858f-4bab-ab9c-ddb390fc0a69" + smsRecipient: "+972509215656" + telegramBotToken: "8143716130:AAFw5ZPLG9SHp45m8bfICcA9A00sa-n3utQ" + telegramChatId: "283184115" + batchIntervalMs: "900000" + batchMaxChars: "700" + includeOwnMessages: "true" + ownName: "אלישע דוידי" + keepAliveUrl: "" + keepAliveIntervalMs: "300000" + smsWebhookToken: "798a3bb5-98b7-4e70-9783-550af4779964" + testGroupNames: "בדיקה בלי איילת" + testSmsRecipient: "+972509915261" + testSmsFrom: "+972585909815" + appsScriptUrl: https://script.google.com/macros/s/AKfycbznoWH7h0yAh7oPqyQNZXUzq-CiqRqyf5cQ0f-SWNNz863SrSQ9MPdA-nVhXVqyMv5aAw/exec + + persistence: + enabled: true + accessModes: + - ReadWriteOnce + storageClass: "nfs-client" + size: 1Gi + + service: + type: ClusterIP + port: 3000 + + healthCheck: + path: /liveness + initialDelaySeconds: 10 + periodSeconds: 30 + + ingress: + enabled: true + className: "traefik" + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + cert-manager.io/cluster-issuer: "letsencrypt-prod" + hosts: + - host: omegabasms.dvirlabs.com + paths: + - path: / + pathType: Prefix + tls: + - secretName: omegabasms-tls + hosts: + - omegabasms.dvirlabs.com