From 88cd90b41bffa5043cad87ea3bb3299394477249 Mon Sep 17 00:00:00 2001 From: Cluster Backup Engine Date: Thu, 29 Oct 2026 23:29:54 +0000 Subject: [PATCH] apprise/gotify/nodered/mosquitto/zigbee2mgtt BIG AUTOMATION INSTALL /w ollama 8k tweaks (no success in cutting openwebui to ollama delays) --- automation/automation-stack.yaml | 267 +++++++++++++++++++++++++ notifications/notifications-stack.yaml | 146 ++++++++++++++ open-webui/ollama-fallback.yaml | 5 + 3 files changed, 418 insertions(+) create mode 100644 automation/automation-stack.yaml create mode 100644 notifications/notifications-stack.yaml diff --git a/automation/automation-stack.yaml b/automation/automation-stack.yaml new file mode 100644 index 0000000..5fca6d5 --- /dev/null +++ b/automation/automation-stack.yaml @@ -0,0 +1,267 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: automation +--- +# 1. LONGHORN STORAGE FOR NODE-RED FLOWS & USER PALETTE NODES +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nodered-data-pvc + namespace: automation +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 5Gi +--- +# 2. LONGHORN STORAGE FOR ZIGBEE2MQTT PAIRING DATA AND DEVICE CONFIGS +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: zigbee2mqtt-data-pvc + namespace: automation +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 2Gi +--- +# 3a. MOSQUITTO LOCAL NETWORK LISTENER CONFIGURATION +apiVersion: v1 +kind: ConfigMap +metadata: + name: mosquitto-config + namespace: automation +data: + mosquitto.conf: | + listener 1883 0.0.0.0 + allow_anonymous true +--- +# 3b. LIGHTWEIGHT ECLIPSE MOSQUITTO MQTT BROKER +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mosquitto + namespace: automation +spec: + replicas: 1 + selector: + matchLabels: + app: mosquitto + template: + metadata: + labels: + app: mosquitto + spec: + containers: + - name: mosquitto + image: docker.io/library/eclipse-mosquitto:2.0.18 + ports: + - containerPort: 1883 + resources: + requests: + memory: "16Mi" + cpu: "10m" + limits: + memory: "64Mi" + cpu: "100m" + volumeMounts: + - name: config + mountPath: /mosquitto/config/mosquitto.conf + subPath: mosquitto.conf + volumes: + - name: config + configMap: + name: mosquitto-config +--- +# 4. NODE-RED RUNTIME CORE DEPLOYMENT +apiVersion: apps/v1 +kind: Deployment +metadata: + name: node-red + namespace: automation +spec: + replicas: 1 + selector: + matchLabels: + app: node-red + template: + metadata: + labels: + app: node-red + spec: + securityContext: + fsGroup: 1000 + runAsUser: 1000 + containers: + - name: node-red + image: docker.io/nodered/node-red:4.0.2 + ports: + - containerPort: 1880 + env: + - name: TZ + value: "Europe/London" + - name: NODE_RED_ENABLE_PROJECTS + value: "false" + resources: + requests: + memory: "125Mi" + cpu: "50m" + limits: + memory: "512Mi" + cpu: "500m" + volumeMounts: + - name: nodered-storage + mountPath: /data + volumes: + - name: nodered-storage + persistentVolumeClaim: + claimName: nodered-data-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: node-red-svc + namespace: automation +spec: + ports: + - port: 1880 + targetPort: 1880 + selector: + app: node-red +--- +# 5. NODE-RED INGRESS ROUTING WITH WEBSOCKET UPGRADES FOR THE CANVAS +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: nodered-ingress + namespace: automation + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-production" + nginx.ingress.kubernetes.io/backend-protocol: "HTTP" + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" + nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" +spec: + ingressClassName: nginx + tls: + - secretName: nodered-tls-secret + hosts: + - nodered.needlestack.boo + rules: + - host: nodered.needlestack.boo + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: node-red-svc + port: + number: 1880 +--- +# 6. ZIGBEE2MQTT TRANSLATION CORE DEPLOYMENT +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zigbee2mqtt + namespace: automation +spec: + replicas: 1 + selector: + matchLabels: + app: zigbee2mqtt + template: + metadata: + labels: + app: zigbee2mqtt + spec: + # 👇 ADD THIS SECLAYER BLOCK TO REFIX VOLUME OWNERSHIP 👇 + securityContext: + fsGroup: 1000 + runAsUser: 1000 + containers: + - name: zigbee2mqtt + image: docker.io/koenkk/zigbee2mqtt:1.41.0 + # 👇 ADD THIS PORTS BLOCK UNDER THE IMAGE 👇 + ports: + - containerPort: 8080 + name: frontend + env: + - name: TZ + value: "Europe/London" + - name: ZIGBEE2MQTT_CONFIG_MQTT_SERVER + value: "mqtt://mosquitto-svc:1883" + # 🌐 NETWORKING LINKAGE FOR YOUR ENET DONGLE-M + - name: ZIGBEE2MQTT_CONFIG_SERIAL_PORT + value: "tcp://192.168.1.145:6638" # 👈 FIXED: Uses the local hostname + - name: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER + value: "ember" # 👈 FIXED: Matches the recommended driver + - name: ZIGBEE2MQTT_CONFIG_ADVANCED_HOMEASSISTANT + value: "true" + # 👇 ADD THIS LINE TO TURN ON THE WEB ENGINE 👇 + - name: ZIGBEE2MQTT_CONFIG_FRONTEND + value: "true" + resources: + requests: + memory: "50Mi" + cpu: "10m" + limits: + memory: "256Mi" + cpu: "300m" + volumeMounts: + - name: zigbee2mqtt-storage + mountPath: /app/data + volumes: + - name: zigbee2mqtt-storage + persistentVolumeClaim: + claimName: zigbee2mqtt-data-pvc +--- +# 7. ZIGBEE2MQTT DASHBOARD NETWORK SERVICE +apiVersion: v1 +kind: Service +metadata: + name: zigbee2mqtt-frontend-svc + namespace: automation +spec: + ports: + - port: 8080 + targetPort: 8080 + selector: + app: zigbee2mqtt +--- +# 8. ZIGBEE2MQTT SECURE INGRESS ROUTING +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: zigbee2mqtt-ingress + namespace: automation + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-production" + nginx.ingress.kubernetes.io/backend-protocol: "HTTP" + nginx.ingress.kubernetes.io/ssl-redirect: "true" + # Mandatory for real-time log streaming and pairing maps to stay open + nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" + nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" +spec: + ingressClassName: nginx + tls: + - secretName: zigbee-tls-secret + hosts: + - zigbee.needlestack.boo + rules: + - host: zigbee.needlestack.boo + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: zigbee2mqtt-frontend-svc + port: + number: 8080 diff --git a/notifications/notifications-stack.yaml b/notifications/notifications-stack.yaml new file mode 100644 index 0000000..84454ee --- /dev/null +++ b/notifications/notifications-stack.yaml @@ -0,0 +1,146 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: notifications +--- +# 1. GOTIFY STORAGE PERFORMANCE LAYER +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: gotify-data-pvc + namespace: notifications +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 5Gi +--- +# 2. GOTIFY CORE SERVICE DEPLOYMENT +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gotify + namespace: notifications +spec: + replicas: 1 + selector: + matchLabels: + app: gotify + template: + metadata: + labels: + app: gotify + spec: + containers: + - name: gotify + image: docker.io/gotify/server:2.5.0 + ports: + - containerPort: 80 + env: + - name: GOTIFY_SERVER_PORT + value: "80" + - name: GOTIFY_SERVER_KEEPALIVEPERIODSECONDS + value: "30" + # Optional: Enforce default admin timezone + - name: TZ + value: "Europe/London" + resources: + requests: + memory: "50Mi" + cpu: "10m" + limits: + memory: "256Mi" + cpu: "200m" + volumeMounts: + - name: gotify-storage + mountPath: /app/data + volumes: + - name: gotify-storage + persistentVolumeClaim: + claimName: gotify-data-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: gotify-svc + namespace: notifications +spec: + ports: + - port: 80 + targetPort: 80 + selector: + app: gotify +--- +# 3. APPRISE API MICROSERVICE DEPLOYMENT +apiVersion: apps/v1 +kind: Deployment +metadata: + name: apprise-api + namespace: notifications +spec: + replicas: 1 + selector: + matchLabels: + app: apprise-api + template: + metadata: + labels: + app: apprise-api + spec: + containers: + - name: apprise + image: docker.io/caronc/apprise:latest + ports: + - containerPort: 8000 + resources: + requests: + memory: "256Mi" # Higher floor for initialization + cpu: "50m" + limits: + memory: "1Gi" # Extra head room so it doesn't get OOMKilled + cpu: "500m" +--- +apiVersion: v1 +kind: Service +metadata: + name: apprise-svc + namespace: notifications +spec: + ports: + - port: 8000 + targetPort: 8000 + selector: + app: apprise-api +--- +# 4. INGRESS ROUTING FOR GOTIFY WEB UI & MOBILE APP +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gotify-ingress + namespace: notifications + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-production" + nginx.ingress.kubernetes.io/backend-protocol: "HTTP" + nginx.ingress.kubernetes.io/ssl-redirect: "true" + # Mandatory for Gotify dynamic long-polling/websockets to keep mobile alerts instant + nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" + nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" +spec: + ingressClassName: nginx + tls: + - secretName: gotify-tls-secret + hosts: + - gotify.needlestack.boo + rules: + - host: gotify.needlestack.boo + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: gotify-svc + port: + number: 80 diff --git a/open-webui/ollama-fallback.yaml b/open-webui/ollama-fallback.yaml index 8066691..31f90e4 100644 --- a/open-webui/ollama-fallback.yaml +++ b/open-webui/ollama-fallback.yaml @@ -31,6 +31,11 @@ spec: # THE SPEED FIX: Forces the calculations to fit perfectly onto your hardware threads - name: OLLAMA_NUM_THREADS value: "4" + # Add this to your ollama-fallback container env definition + - name: OLLAMA_NUM_PARALLEL + value: "1" + - name: OLLAMA_CONTEXT_LENGTH + value: "8192" # 👈 This stops the truncation loop instantly! ports: - containerPort: 11434 name: ollama-http