From e5c71e1bc8ae79a7d2b9bc1a8fc06f026e188658 Mon Sep 17 00:00:00 2001 From: ruberoid Date: Sun, 14 Apr 2024 15:22:41 +0400 Subject: [PATCH] added users deployment. --- _deploy/k8s/00_initial.sh | 9 ++++- _deploy/k8s/deployment.yaml | 79 ++++++++++++++++++++++++++++++++++++- users | 2 +- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/_deploy/k8s/00_initial.sh b/_deploy/k8s/00_initial.sh index 08ca1bf..5b58e82 100755 --- a/_deploy/k8s/00_initial.sh +++ b/_deploy/k8s/00_initial.sh @@ -64,8 +64,13 @@ helm repo update # # note that you should create a values.yaml file with db credentials at least. # -# helm install -f values.yaml nocr-maria-db bitnami/mariadb --namespace nocr -helm install nocr-mdb --set db.name=nocr_text_matcher,db.user=nocr_text_matcher_user stable/mariadb --namespace nocr + +helm install mdb-tm --set auth.database=nocr_text_matcher bitnami/mariadb --namespace nocr +helm install mdb-u --set auth.database=nocr_users bitnami/mariadb --namespace nocr + +# to update helm release please use +# helm upgrade my-release oci://REGISTRY_NAME/REPOSITORY_NAME/mariadb --set auth.rootPassword=[ROOT_PASSWORD] + # 05. Main deployment diff --git a/_deploy/k8s/deployment.yaml b/_deploy/k8s/deployment.yaml index 91828dd..335f89b 100644 --- a/_deploy/k8s/deployment.yaml +++ b/_deploy/k8s/deployment.yaml @@ -103,6 +103,25 @@ spec: spec: imagePullSecrets: - name: hubcred + initContainers: + - name: text-matcher-migrator + image: hub.musk.fun/k8s/nocr/text_matcher_migrator:latest + env: + - name: "DOTNET_ENVIRONMENT" + value: "k8s" + - name: mariadb_host + value: mdb-tm-mariadb.nocr.svc + - name: mariadb_database + value: nocr_text_matcher + - name: mariadb_user + value: root + - name: mariadb_password + valueFrom: + secretKeyRef: + name: mdb-tm-mariadb + key: mariadb-root-password + - name: ConnectionStrings__k8s + value: "server=$(mariadb_host);port=3306;database=$(mariadb_database);uid=$(mariadb_user);pwd=$(mariadb_password)" containers: - name: text-matcher image: hub.musk.fun/k8s/nocr/text_matcher:latest @@ -132,7 +151,7 @@ spec: - name: RebusRabbitMqOptions__ConnectionString value: "amqp://$(rmqc_username):$(rmqc_password)@$(rmqc_host):$(rmqc_port)/" - name: mariadb_host - value: nocr-mdb-mariadb.nocr.svc + value: mdb-tm-mariadb.nocr.svc - name: mariadb_database value: nocr_text_matcher - name: mariadb_user @@ -140,7 +159,63 @@ spec: - name: mariadb_password valueFrom: secretKeyRef: - name: nocr-mdb-mariadb + name: mdb-tm-mariadb key: mariadb-root-password - name: ConnectionStrings__TextMatcherContext value: "server=$(mariadb_host);port=3306;database=$(mariadb_database);uid=$(mariadb_user);pwd=$(mariadb_password)" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: users + namespace: nocr +spec: + replicas: 1 + selector: + matchLabels: + app: users + template: + metadata: + labels: + app: users + spec: + imagePullSecrets: + - name: hubcred + initContainers: + - name: users-migrator + image: hub.musk.fun/k8s/nocr/users_migrator:latest + env: + - name: "DOTNET_ENVIRONMENT" + value: "k8s" + - name: mariadb_host + value: mdb-u-mariadb.nocr.svc + - name: mariadb_database + value: nocr_users + - name: mariadb_user + value: root + - name: mariadb_password + valueFrom: + secretKeyRef: + name: mdb-u-mariadb + key: mariadb-root-password + - name: ConnectionStrings__k8s + value: "server=$(mariadb_host);port=3306;database=$(mariadb_database);uid=$(mariadb_user);pwd=$(mariadb_password)" + containers: + - name: users + image: hub.musk.fun/k8s/nocr/users:latest + env: + - name: "ASPNETCORE_ENVIRONMENT" + value: "k8s" + - name: mariadb_host + value: mdb-u-mariadb.nocr.svc + - name: mariadb_database + value: nocr_text_matcher + - name: mariadb_user + value: root + - name: mariadb_password + valueFrom: + secretKeyRef: + name: mdb-u-mariadb + key: mariadb-root-password + - name: ConnectionStrings__UsersContext + value: "server=$(mariadb_host);port=3306;database=$(mariadb_database);uid=$(mariadb_user);pwd=$(mariadb_password)" diff --git a/users b/users index 0f0fb22..76fbafb 160000 --- a/users +++ b/users @@ -1 +1 @@ -Subproject commit 0f0fb22b4fd5b84240b76d619f58f5fdacc72ceb +Subproject commit 76fbafb476d64a01453d41def4ffebe7afe424a7