diff --git a/_deploy/k8s/00_initial.sh b/_deploy/k8s/00_initial.sh index 2d32ee7..53ab140 100755 --- a/_deploy/k8s/00_initial.sh +++ b/_deploy/k8s/00_initial.sh @@ -57,6 +57,16 @@ kubectl create secret generic wtelegram-client \ --namespace nocr +# 05. installing persistant rdbs engine + +helm repo add bitnami https://charts.bitnami.com/bitnami +helm repo update +# +# note that you should create a values.yaml file with db credentials at least. +# +helm install -f values.yaml nocr-mariadb bitnami/mariadb --namespace nocr + + # 05. Main deployment # # Make the main deployment. diff --git a/_deploy/k8s/_rabbit_bak/rabbit_full_cluster_default.yaml b/_deploy/k8s/_rabbit_bak/rabbit_full_cluster_default.yaml deleted file mode 100644 index 58500ef..0000000 --- a/_deploy/k8s/_rabbit_bak/rabbit_full_cluster_default.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: rabbitmq.com/v1beta1 -kind: RabbitmqCluster -metadata: - annotations: - kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"rabbitmq.com/v1beta1","kind":"RabbitmqCluster","metadata":{"annotations":{},"name":"rmqc","namespace":"nocr"}} - creationTimestamp: "2024-03-28T17:36:44Z" - finalizers: - - deletion.finalizers.rabbitmqclusters.rabbitmq.com - generation: 3 - name: rmqc - namespace: nocr - resourceVersion: "1932864" - uid: 435cb6a7-423e-4cac-8013-83aff7e165d9 -spec: - delayStartSeconds: 30 - image: rabbitmq:3.12.2-management - override: {} - persistence: - storage: 10Gi - rabbitmq: {} - replicas: 1 - resources: - limits: - cpu: "2" - memory: 2Gi - requests: - cpu: "1" - memory: 2Gi - secretBackend: - externalSecret: {} - service: - type: ClusterIP - terminationGracePeriodSeconds: 604800 - tls: {} -status: - binding: - name: rmqc-default-user - conditions: - - lastTransitionTime: "2024-03-28T17:37:28Z" - reason: AllPodsAreReady - status: "True" - type: AllReplicasReady - - lastTransitionTime: "2024-03-28T17:37:28Z" - reason: AtLeastOneEndpointAvailable - status: "True" - type: ClusterAvailable - - lastTransitionTime: "2024-03-28T17:36:44Z" - reason: NoWarnings - status: "True" - type: NoWarnings - - lastTransitionTime: "2024-03-28T17:37:28Z" - message: Finish reconciling - reason: Success - status: "True" - type: ReconcileSuccess - defaultUser: - secretReference: - keys: - password: password - username: username - name: rmqc-default-user - namespace: nocr - serviceReference: - name: rmqc - namespace: nocr - observedGeneration: 3 diff --git a/_deploy/k8s/_rabbit_bak/rabbitmq.yaml b/_deploy/k8s/_rabbit_bak/rabbitmq.yaml deleted file mode 100644 index 1817986..0000000 --- a/_deploy/k8s/_rabbit_bak/rabbitmq.yaml +++ /dev/null @@ -1,96 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: rabbitmq -spec: - serviceName: rabbitmq - # Three nodes is the recommended minimum. Some features may require a majority of nodes - # to be available. - replicas: 3 - volumeClaimTemplates: [] - selector: - matchLabels: - app: rabbitmq - template: - spec: - # serviceAccountName: rabbitmq - terminationGracePeriodSeconds: 10 - nodeSelector: - # Use Linux nodes in a mixed OS kubernetes cluster. - # Learn more at https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#kubernetes-io-os - kubernetes.io/os: linux - containers: - - name: rabbitmq-k8s - image: rabbitmq:3.8 - volumeMounts: - - name: config-volume - mountPath: /etc/rabbitmq - # Learn more about what ports various protocols use - # at https://www.rabbitmq.com/networking.html#ports - ports: - - name: http - protocol: TCP - containerPort: 15672 - - name: amqp - protocol: TCP - containerPort: 5672 - livenessProbe: - exec: - # This is just an example. There is no "one true health check" but rather - # several rabbitmq-diagnostics commands that can be combined to form increasingly comprehensive - # and intrusive health checks. - # Learn more at https://www.rabbitmq.com/monitoring.html#health-checks. - # - # Stage 2 check: - command: ["rabbitmq-diagnostics", "status"] - initialDelaySeconds: 60 - # See https://www.rabbitmq.com/monitoring.html for monitoring frequency recommendations. - periodSeconds: 60 - timeoutSeconds: 15 - readinessProbe: - exec: - # This is just an example. There is no "one true health check" but rather - # several rabbitmq-diagnostics commands that can be combined to form increasingly comprehensive - # and intrusive health checks. - # Learn more at https://www.rabbitmq.com/monitoring.html#health-checks. - # - # Stage 1 check: - command: ["rabbitmq-diagnostics", "ping"] - initialDelaySeconds: 20 - periodSeconds: 60 - timeoutSeconds: 10 - imagePullPolicy: Always - env: - - name: MY_POD_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: MY_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: RABBITMQ_USE_LONGNAME - value: "true" - # See a note on cluster_formation.k8s.address_type in the config file section - - name: K8S_SERVICE_NAME - value: rabbitmq - - name: RABBITMQ_NODENAME - value: rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local - - name: K8S_HOSTNAME_SUFFIX - value: .$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local - - name: RABBITMQ_ERLANG_COOKIE - value: "mycookie" - - name: RABBITMQ_DEFAULT_USER - value: admin - - name: RABBITMQ_DEFAULT_PASS - value: admin - volumes: - - name: config-volume - configMap: - name: rabbitmq-config - items: - - key: rabbitmq.conf - path: rabbitmq.conf - - key: enabled_plugins - path: enabled_plugins diff --git a/_deploy/k8s/deployment.yaml b/_deploy/k8s/deployment.yaml index 911dcb3..11d7fdc 100644 --- a/_deploy/k8s/deployment.yaml +++ b/_deploy/k8s/deployment.yaml @@ -85,4 +85,62 @@ spec: secretName: secretfiles - name: rw-files emptyDir: {} - +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: text-matcher + namespace: nocr +spec: + replicas: 1 + selector: + matchLabels: + app: text-matcher + template: + metadata: + labels: + app: text-matcher + spec: + imagePullSecrets: + - name: hubcred + containers: + - name: text-matcher + image: hub.musk.fun/k8s/nocr/text_matcher:latest + env: + - name: "ASPNETCORE_ENVIRONMENT" + value: "k8s" + - name: rmqc_host + valueFrom: + secretKeyRef: + name: rmqc-default-user + key: host + - name: rmqc_username + valueFrom: + secretKeyRef: + name: rmqc-default-user + key: username + - name: rmqc_password + valueFrom: + secretKeyRef: + name: rmqc-default-user + key: password + - name: rmqc_port + valueFrom: + secretKeyRef: + name: rmqc-default-user + key: port + - name: RebusRabbitMqOptions__ConnectionString + value: "amqp://$(rmqc_username):$(rmqc_password)@$(rmqc_host):$(rmqc_port)/" + - name: mariadb_host + value: nocr-mariadb.nocr.svc + - name: mariadb_database + value: nocr_text_matcher + - name: mariadb_user + value: root + - name: mariadb_password + valueFrom: + secretKeyRef: + name: nocr-mariadb + key: mariadb-root-password + - name: ConnectionStrings__TextMatcherContext + value: "server=$(mariadb_host);port=3306;database=$(mariadb_database);uid=$(mariadb_user);pwd=$(mariadb_password)" diff --git a/_deploy/k8s/sample.yaml b/_deploy/k8s/sample.yaml deleted file mode 100644 index 50d3c99..0000000 --- a/_deploy/k8s/sample.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: example-nginx-deployment - namespace: nocr - labels: - app: nginx -spec: - replicas: 1 - selector: - matchLabels: - app: nginx - template: - metadata: - labels: - app: nginx - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 - env: - - name: ASPNETCORE_rmqc_host - valueFrom: - secretKeyRef: - name: rmqc-default-user - key: host - - name: ASPNETCORE_rmqc_username - valueFrom: - secretKeyRef: - name: rmqc-default-user - key: username - - name: ASPNETCORE_rmqc_password - valueFrom: - secretKeyRef: - name: rmqc-default-user - key: password - - name: ASPNETCORE_rmqc_port - valueFrom: - secretKeyRef: - name: rmqc-default-user - key: port - - name: ASPNETCORE__RebusRabbitMqOptions__ConnectionString - value: "amqp://$(ASPNETCORE_rmqc_username):$(ASPNETCORE_rmqc_password)@$(ASPNETCORE_rmqc_host):$(ASPNETCORE_rmqc_port)/" diff --git a/_deploy/k8s/service.yaml b/_deploy/k8s/service.yaml deleted file mode 100644 index e04e464..0000000 --- a/_deploy/k8s/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: rabbitmq-np - namespace: nocr -spec: - type: NodePort - selector: - app: hello-world-server-0 - ports: - - name: hello-world-server-0 - protocol: TCP - port: 15672 - targetPort: 15672 - nodePort: 30001 diff --git a/text-matcher b/text-matcher index b36ea8e..2466953 160000 --- a/text-matcher +++ b/text-matcher @@ -1 +1 @@ -Subproject commit b36ea8e9d6b57878d031534425cf58592a0dadf7 +Subproject commit 246695350f46b7054681a305b41bc2dc3ad8ce2a