diff --git a/.gitea/workflows/casa-services-deploy.yaml b/.gitea/workflows/casa-services-deploy.yaml index 1a11bcb..743780e 100644 --- a/.gitea/workflows/casa-services-deploy.yaml +++ b/.gitea/workflows/casa-services-deploy.yaml @@ -11,8 +11,8 @@ on: - '.gitea/workflows/casa-services**' pull_request: paths: - - 'monitoring/**' - - '.gitea/workflows/monitoring**' + - 'services/**' + - '.gitea/workflows/casa-services**' schedule: - cron: '0 15 * * 0' # every sunday 3 pm @@ -49,4 +49,9 @@ jobs: - name: Deploy wyoming shell: bash run: | - kubectl apply -f ./services/wyoming/deploy/wyoming-deploy.yaml \ No newline at end of file + kubectl apply -f ./services/wyoming/deploy/wyoming-deploy.yaml + + # - name: Deploy node-red + # shell: bash + # run: | + # ./services/node-red/ops-scripts/apply-app.sh \ No newline at end of file diff --git a/README.md b/README.md index dd49768..2e3201d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ For more information about k3s cluster/nodes setup check [readme](./docs/k3s-clu - [Mosquitto](#mosquitto) - [Wyoming](#wyoming) - [Zigbee2mqtt](#zigbee2mqtt) +- [node-red](#node-red) ## Home Assistant @@ -66,3 +67,17 @@ Attached SONOFF Universal Zigbee 3.0 USB Dongle Plus to the Proxmox node and con Deployments and scripts on services/Zigbee2mqtt repo folder. [Continuous deploy](./.gitea/workflows/casa-services-deploy.yaml). + +## node-red + +**Deploy app:** + +```bash +./services/node-red/ops-scripts/apply-app.sh +``` + +**Deploy Infra:** + +```bash +./services/node-red/ops-scripts/apply-infra.sh +``` diff --git a/services/node-red/deploy/app/deployment.yaml b/services/node-red/deploy/app/deployment.yaml new file mode 100644 index 0000000..5be0489 --- /dev/null +++ b/services/node-red/deploy/app/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: node-red + namespace: node-red +spec: + replicas: 1 + selector: + matchLabels: + app: node-red + template: + metadata: + labels: + app: node-red + spec: + containers: + - name: node-red + image: nodered/node-red:latest + imagePullPolicy: Always + ports: + - containerPort: 1880 + volumeMounts: + - name: node-red-data + mountPath: /data + resources: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "256Mi" + cpu: "500m" + volumes: + - name: node-red-data + persistentVolumeClaim: + claimName: node-red \ No newline at end of file diff --git a/services/node-red/deploy/app/kustomization.yaml b/services/node-red/deploy/app/kustomization.yaml new file mode 100644 index 0000000..b2aabe8 --- /dev/null +++ b/services/node-red/deploy/app/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - pvc.yaml + - deployment.yaml +generatorOptions: + disableNameSuffixHash: true \ No newline at end of file diff --git a/services/node-red/deploy/app/pvc.yaml b/services/node-red/deploy/app/pvc.yaml new file mode 100644 index 0000000..921b873 --- /dev/null +++ b/services/node-red/deploy/app/pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: node-red + namespace: node-red +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: local-path \ No newline at end of file diff --git a/services/node-red/deploy/infra/kustomization.yaml b/services/node-red/deploy/infra/kustomization.yaml new file mode 100644 index 0000000..aedc582 --- /dev/null +++ b/services/node-red/deploy/infra/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - namespace.yaml +generatorOptions: + disableNameSuffixHash: true \ No newline at end of file diff --git a/services/node-red/deploy/infra/namespace.yaml b/services/node-red/deploy/infra/namespace.yaml new file mode 100644 index 0000000..e5e3549 --- /dev/null +++ b/services/node-red/deploy/infra/namespace.yaml @@ -0,0 +1,7 @@ + +apiVersion: v1 +kind: Namespace +metadata: + name: node-red + labels: + name: node-red \ No newline at end of file diff --git a/services/node-red/ops-scripts/apply-app.sh b/services/node-red/ops-scripts/apply-app.sh new file mode 100755 index 0000000..b296bed --- /dev/null +++ b/services/node-red/ops-scripts/apply-app.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +echo "Executing app deploy." + +kubectl kustomize ./services/node-red/deploy/app | kubectl apply -f - \ No newline at end of file diff --git a/services/node-red/ops-scripts/apply-infra.sh b/services/node-red/ops-scripts/apply-infra.sh new file mode 100755 index 0000000..2ddc0da --- /dev/null +++ b/services/node-red/ops-scripts/apply-infra.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +echo "Executing infra deploy." + +kubectl kustomize ./services/node-red/deploy/infra | kubectl apply -f - \ No newline at end of file