diff --git a/kubernetes/fineract-server-deployment.yml b/kubernetes/fineract-server-deployment.yml index f7b0355ea19..dbffb0a2737 100644 --- a/kubernetes/fineract-server-deployment.yml +++ b/kubernetes/fineract-server-deployment.yml @@ -41,6 +41,7 @@ metadata: name: fineract-server labels: app: fineract-server + tier: fineract-server spec: selector: matchLabels: @@ -58,8 +59,26 @@ spec: - name: fineract-server image: apache/fineract:latest env: - - name: JAVA_OPTS - value: -Dfineract_tenants_url=jdbc:mysql:thin://fineractmysql:3306/fineract_tenants -Dfineract_tenants_driver=org.drizzle.jdbc.DrizzleDriver -Dfineract_tenants_uid=root -Dfineract_tenants_pwd=skdcnwauicn2ucnaecasdsajdnizucawencascdca -Djava.awt.headless=true -XX:+UseG1GC -Dfile.encoding=UTF-8 + - name: DRIVERCLASS_NAME + value: org.drizzle.jdbc.DrizzleDriver + - name: PROTOCOL + value: jdbc + - name: SUB_PROTOCOL + value: mysql:thin + - name: fineract_tenants_driver + value: org.drizzle.jdbc.DrizzleDriver + - name: fineract_tenants_url + value: jdbc:mysql:thin://fineractmysql:3306/fineract_tenants + - name: fineract_tenants_uid + valueFrom: + secretKeyRef: + name: fineract-tenants-db-secret + key: username + - name: fineract_tenants_pwd + valueFrom: + secretKeyRef: + name: fineract-tenants-db-secret + key: password - name: FINERACT_DEFAULT_TENANTDB_HOSTNAME value: fineractmysql - name: FINERACT_DEFAULT_TENANTDB_PORT diff --git a/kubernetes/kubectl-shutdown.sh b/kubernetes/kubectl-shutdown.sh index e42361b39f1..ba21d32e8a4 100755 --- a/kubernetes/kubectl-shutdown.sh +++ b/kubernetes/kubectl-shutdown.sh @@ -18,7 +18,7 @@ # under the License. # -kubectl delete -f secrets.yml +kubectl delete secret fineract-tenants-db-secret kubectl delete -f fineractmysql-configmap.yml kubectl delete -f fineractmysql-deployment.yml kubectl delete -f fineract-server-deployment.yml diff --git a/kubernetes/kubectl-startup.sh b/kubernetes/kubectl-startup.sh index a3e393a589c..233a3a00cd3 100755 --- a/kubernetes/kubectl-startup.sh +++ b/kubernetes/kubectl-startup.sh @@ -19,7 +19,7 @@ # echo "Setting Up Fineract service configuration..." -kubectl apply -f secrets.yml +kubectl create secret generic fineract-tenants-db-secret --from-literal=username=root --from-literal=password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16) kubectl apply -f fineractmysql-configmap.yml echo @@ -30,7 +30,7 @@ fineractmysql_pod="" while [[ ${#fineractmysql_pod} -eq 0 ]]; do fineractmysql_pod=$(kubectl get pods -l tier=fineractmysql --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') done -#sleep 5 + fineractmysql_status=$(kubectl get pods ${fineractmysql_pod} --no-headers -o custom-columns=":status.phase") while [[ ${fineractmysql_status} -ne 'Running' ]]; do sleep 1 @@ -40,3 +40,16 @@ done echo echo "Starting fineract server..." kubectl apply -f fineract-server-deployment.yml + +fineract-server_pod="" +while [[ ${#fineract-server_pod} -eq 0 ]]; do + fineract-server_pod=$(kubectl get pods -l tier=fineract-server --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') +done + +fineract-server_status=$(kubectl get pods ${fineract-server_pod} --no-headers -o custom-columns=":status.phase") +while [[ ${fineract-server_status} -ne 'Running' ]]; do + sleep 1 + fineract-server_status=$(kubectl get pods ${fineract-server_pod} --no-headers -o custom-columns=":status.phase") +done + +echo "Fineract server is up and running" \ No newline at end of file diff --git a/kubernetes/secrets.yml b/kubernetes/secrets.yml deleted file mode 100644 index b3e66698416..00000000000 --- a/kubernetes/secrets.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - - -apiVersion: v1 -kind: Secret -metadata: - name: fineract-tenants-db-secret -type: Opaque -stringData: - username: root - password: skdcnwauicn2ucnaecasdsajdnizucawencascdca \ No newline at end of file