diff --git a/Enphase/creaprueba.sql b/Enphase/creaprueba.sql new file mode 100644 index 00000000..40059c0e --- /dev/null +++ b/Enphase/creaprueba.sql @@ -0,0 +1,56 @@ +-- MariaDB dump 10.19 Distrib 10.10.2-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: enphase +-- ------------------------------------------------------ +-- Server version 10.10.2-MariaDB-1:10.10.2+maria~ubu2204 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `production_eim` +-- + +DROP TABLE IF EXISTS `production_eim_test`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `production_eim_test` ( + `type` text NOT NULL, + `activeCount` int(11) NOT NULL, + `measurementType` text NOT NULL, + `readingTime` datetime NOT NULL, + `wNow` float NOT NULL, + `whLifetime` float NOT NULL, + `varhLeadLifetime` float NOT NULL, + `varhLagLifetime` float NOT NULL, + `vahLifetime` float NOT NULL, + `rmsCurrent` float NOT NULL, + `rmsVoltage` float NOT NULL, + `reactPwr` float NOT NULL, + `apprntPwr` float NOT NULL, + `pwrFactor` float NOT NULL, + `whToday` float NOT NULL, + `whLastSevenDays` float NOT NULL, + `vahToday` float NOT NULL, + `varhLeadToday` float NOT NULL, + `varhLagToday` float NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `production_eim` +-- + +LOCK TABLES `production_eim_test` WRITE; +/*!40000 ALTER TABLE `production_eim` DISABLE KEYS */; +/*!40000 ALTER TABLE `production_eim` ENABLE KEYS */; +UNLOCK TABLES; + diff --git a/HelmCharts/enphase-chart/templates/nodered-deployment.yaml b/HelmCharts/enphase-chart/templates/nodered-deployment.yaml index fdd57228..3131fb09 100644 --- a/HelmCharts/enphase-chart/templates/nodered-deployment.yaml +++ b/HelmCharts/enphase-chart/templates/nodered-deployment.yaml @@ -51,7 +51,7 @@ spec: tier: frontend spec: containers: - - image: nodered/node-red-docker:v8 + - image: nodered/node-red:latest name: nodered ports: - containerPort: 1880 diff --git a/HelmCharts/homeassistant-chart/.helmignore b/HelmCharts/homeassistant-chart/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/HelmCharts/homeassistant-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/HelmCharts/homeassistant-chart/Chart.yaml b/HelmCharts/homeassistant-chart/Chart.yaml new file mode 100644 index 00000000..7b42e0cd --- /dev/null +++ b/HelmCharts/homeassistant-chart/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: homeassistant-chart +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/HelmCharts/homeassistant-chart/templates/homeassistant-deployment.yaml b/HelmCharts/homeassistant-chart/templates/homeassistant-deployment.yaml new file mode 100644 index 00000000..686cddaf --- /dev/null +++ b/HelmCharts/homeassistant-chart/templates/homeassistant-deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: v1 +kind: Service +metadata: + name: homeassistant + namespace: homeassistant + labels: + app: homeassistant +spec: + type: NodePort + ports: + - port: 8123 + nodePort: 30097 + targetPort: homeassistant + selector: + app: homeassistant + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: ha-pv-claim + namespace: homeassistant + labels: + app: homeassistant +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 1Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: homeassistant + namespace: homeassistant + labels: + app: homeassistant +spec: + selector: + matchLabels: + app: homeassistant + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: homeassistant + tier: frontend + spec: + containers: + - image: ghcr.io/home-assistant/home-assistant:stable + name: homeassistant + ports: + - containerPort: 8123 + name: homeassistant + volumeMounts: + - name: homeassistant-persistent-storage + mountPath: /data + imagePullSecrets: + - name: reg-cred-secret + volumes: + - name: homeassistant-persistent-storage + persistentVolumeClaim: + claimName: ha-pv-claim diff --git a/HelmCharts/homeassistant-chart/templates/pv-local-homeassistant.yaml b/HelmCharts/homeassistant-chart/templates/pv-local-homeassistant.yaml new file mode 100644 index 00000000..1cff546d --- /dev/null +++ b/HelmCharts/homeassistant-chart/templates/pv-local-homeassistant.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: homeassistant-folder +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/homeassistant" + diff --git a/HelmCharts/homeassistant-chart/values.yaml b/HelmCharts/homeassistant-chart/values.yaml new file mode 100644 index 00000000..280a17b2 --- /dev/null +++ b/HelmCharts/homeassistant-chart/values.yaml @@ -0,0 +1,82 @@ +# Default values for homeassistant-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/HelmCharts/nodered-chart-1.0.tgz b/HelmCharts/nodered-chart-1.0.tgz new file mode 100644 index 00000000..352e9f83 Binary files /dev/null and b/HelmCharts/nodered-chart-1.0.tgz differ diff --git a/HelmCharts/nodered-chart/.helmignore b/HelmCharts/nodered-chart/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/HelmCharts/nodered-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/HelmCharts/nodered-chart/Chart.yaml b/HelmCharts/nodered-chart/Chart.yaml new file mode 100644 index 00000000..e4c38f8a --- /dev/null +++ b/HelmCharts/nodered-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +appVersion: 1.16.0 +description: A Helm chart for Kubernetes +name: nodered-chart +type: application +version: "1.0" diff --git a/HelmCharts/nodered-chart/templates/grafana-deployment.yaml b/HelmCharts/nodered-chart/templates/grafana-deployment.yaml new file mode 100644 index 00000000..5d8236cc --- /dev/null +++ b/HelmCharts/nodered-chart/templates/grafana-deployment.yaml @@ -0,0 +1,87 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-pvc + namespace: nodered +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: grafana + name: grafana + namespace: nodered +spec: + selector: + matchLabels: + app: grafana + template: + metadata: + labels: + app: grafana + spec: + securityContext: + fsGroup: 472 + supplementalGroups: + - 0 + containers: + - name: grafana + image: grafana/grafana:9.1.0 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 3000 + name: http-grafana + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /robots.txt + port: 3000 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 2 + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + tcpSocket: + port: 3000 + timeoutSeconds: 1 + resources: + requests: + cpu: 250m + memory: 750Mi + volumeMounts: + - mountPath: /var/lib/grafana + name: grafana-pv + volumes: + - name: grafana-pv + persistentVolumeClaim: + claimName: grafana-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: grafana + namespace: nodered +spec: + type: NodePort + ports: + - port: 3000 + protocol: TCP + nodePort: 30002 + targetPort: http-grafana + selector: + app: grafana + sessionAffinity: None + type: NodePort diff --git a/HelmCharts/nodered-chart/templates/mysql-deployment.yaml b/HelmCharts/nodered-chart/templates/mysql-deployment.yaml new file mode 100644 index 00000000..4388daaf --- /dev/null +++ b/HelmCharts/nodered-chart/templates/mysql-deployment.yaml @@ -0,0 +1,73 @@ +apiVersion: v1 +kind: Service +metadata: + name: nodered-mysql + namespace: nodered + labels: + app: nodered +spec: + type: NodePort + ports: + - name: mysql + port: 3306 + nodePort: 30385 + targetPort: mysql + selector: + app: nodered + tier: mysql +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim + namespace: nodered + labels: + app: nodered +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nodered-mysql + namespace: nodered + labels: + app: nodered +spec: + selector: + matchLabels: + app: nodered + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: nodered + tier: mysql + spec: + containers: + - image: mariadb:latest + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + imagePullSecrets: + - name: reg-cred-secret + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-pv-claim diff --git a/HelmCharts/nodered-chart/templates/nodered-deployment.yaml b/HelmCharts/nodered-chart/templates/nodered-deployment.yaml new file mode 100644 index 00000000..0bfaf41d --- /dev/null +++ b/HelmCharts/nodered-chart/templates/nodered-deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: v1 +kind: Service +metadata: + name: nodered + namespace: nodered + labels: + app: nodered +spec: + type: NodePort + ports: + - port: 1880 + nodePort: 30096 + targetPort: nodered + selector: + app: nodered + tier: frontend +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nr-pv-claim + namespace: nodered + labels: + app: nodered +spec: + accessModes: + - ReadWriteOnce + storageClassName: "" + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nodered + namespace: nodered + labels: + app: nodered +spec: + selector: + matchLabels: + app: nodered + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: nodered + tier: frontend + spec: + containers: + - image: nodered/node-red:latest + name: nodered + ports: + - containerPort: 1880 + name: nodered + volumeMounts: + - name: nodered-persistent-storage + mountPath: /data + imagePullSecrets: + - name: reg-cred-secret + volumes: + - name: nodered-persistent-storage + persistentVolumeClaim: + claimName: nr-pv-claim diff --git a/HelmCharts/nodered-chart/templates/nodered-secrets.yaml b/HelmCharts/nodered-chart/templates/nodered-secrets.yaml new file mode 100644 index 00000000..76fb23fb --- /dev/null +++ b/HelmCharts/nodered-chart/templates/nodered-secrets.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mysql-pass + namespace: nodered +type: Opaque +stringData: + db_password: Dsa-0213 + password: Dsa-0213 + db_user: root diff --git a/HelmCharts/nodered-chart/templates/php-myadmin-deployment.yaml b/HelmCharts/nodered-chart/templates/php-myadmin-deployment.yaml new file mode 100644 index 00000000..83a0ea42 --- /dev/null +++ b/HelmCharts/nodered-chart/templates/php-myadmin-deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: Service +metadata: + name: phpmyadmin-nodered + namespace: nodered + labels: + app: nodered +spec: + selector: + app: nodered + tier: phpmyadmin + type: NodePort + ports: + - name: phpadmin + port: 80 + nodePort: 30386 + targetPort: phpmyadm +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: phpmyadmin-nodered + namespace: nodered + labels: + app: nodered +spec: + selector: + matchLabels: + app: nodered + tier: phpmyadmin + strategy: + type: Recreate + template: + metadata: + labels: + app: nodered + tier: phpmyadmin + spec: + containers: + - name: phpmyadmin + image: phpmyadmin + ports: + - containerPort: 80 + name: phpmyadm + env: + - name: PMA_HOST + value: nodered-mysql + - name: PMA_PORT + value: "3306" + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + imagePullSecrets: + - name: reg-cred-secret + diff --git a/HelmCharts/nodered-chart/templates/pv-local-grafana.yaml b/HelmCharts/nodered-chart/templates/pv-local-grafana.yaml new file mode 100644 index 00000000..caaa904c --- /dev/null +++ b/HelmCharts/nodered-chart/templates/pv-local-grafana.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: nodered-grafana-folder +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/nodered/grafana" + diff --git a/HelmCharts/nodered-chart/templates/pv-local-mysql.yaml b/HelmCharts/nodered-chart/templates/pv-local-mysql.yaml new file mode 100644 index 00000000..67401f52 --- /dev/null +++ b/HelmCharts/nodered-chart/templates/pv-local-mysql.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: nodered-data +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/nodered/nodered-db" diff --git a/HelmCharts/nodered-chart/templates/pv-local-nodered.yaml b/HelmCharts/nodered-chart/templates/pv-local-nodered.yaml new file mode 100644 index 00000000..2f640a03 --- /dev/null +++ b/HelmCharts/nodered-chart/templates/pv-local-nodered.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: nodered-app-folder +spec: + capacity: + storage: 2Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/nodered/nodered-app" + diff --git a/HelmCharts/nodered-chart/values.yaml b/HelmCharts/nodered-chart/values.yaml new file mode 100644 index 00000000..837430b3 --- /dev/null +++ b/HelmCharts/nodered-chart/values.yaml @@ -0,0 +1,82 @@ +# Default values for nodered-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}