-
Notifications
You must be signed in to change notification settings - Fork 27
/
init_db.sh
executable file
·41 lines (32 loc) · 1.22 KB
/
init_db.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
# Script to initialize certify DB.
## Usage: ./init_db.sh [kubeconfig]
if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi
NS=inji-certify
CHART_VERSION=12.0.1-develop
helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update
while true; do
read -p "CAUTION: Do we already have Postgres installed? Also make sure the certify DB is backed up as the same will be overriden. Do you still want to continue?" yn
if [ $yn = "Y" ]
then
DB_USER_PASSWORD=$( kubectl -n postgres get secrets db-common-secrets -o jsonpath={.data.db-dbuser-password} | base64 -d )
kubectl create ns $NS
echo Removing existing inji_certify DB installation
helm -n $NS delete postgres-init-certify
echo Copy Postgres secrets
./copy_cm_func.sh secret postgres-postgresql postgres $NS
echo Delete existing DB common sets
kubectl -n $NS delete secret db-common-secrets
echo Initializing DB
helm -n $NS install postgres-init-certify mosip/postgres-init -f init_values.yaml \
--version $CHART_VERSION \
--set dbUserPasswords.dbuserPassword="$DB_USER_PASSWORD" \
--wait --wait-for-jobs
break
else
break
fi
done