Skip to content

Commit

Permalink
[MOSIP-38705] & [MOSIP-38705] added installation script for esignet-w…
Browse files Browse the repository at this point in the history
…ith-plugins and for esignet.

Signed-off-by: techno-467 <[email protected]>
  • Loading branch information
Prafulrakhade committed Jan 17, 2025
1 parent 64b9415 commit 74b0adb
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 34 deletions.
2 changes: 1 addition & 1 deletion deploy/delete-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Deleting_All() {
helm -n $SOFTHSM_NS delete esignet-softhsm

declare -a module=("oidc-ui"
"esignet"
"esignet-with-plugins"
"captcha"
)
echo Deleting esignet services
Expand Down
2 changes: 2 additions & 0 deletions deploy/esignet-with-plugins/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/
Chart.lock
21 changes: 21 additions & 0 deletions deploy/esignet-with-plugins/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
31 changes: 31 additions & 0 deletions deploy/esignet-with-plugins/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Uninstalls esignet-with-plugins helm chart
## Usage: ./delete.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function Deleting_esignet_with_plugins() {
NS=esignet
while true; do
read -p "Are you sure you want to delete all esignet-with-plugins helm charts?(Y/n) " yn
if [[ $yn = "Y" ]] || [[ $yn = "y" ]];
then
helm -n $NS delete esignet
break
else
break
fi
done
return 0
}

# set commands for error handling.
set -e
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errtrace # trace ERR through 'time command' and other functions
set -o pipefail # trace ERR through pipes
Deleting_esignet_with_plugins # calling function

118 changes: 118 additions & 0 deletions deploy/esignet-with-plugins/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/bin/bash
# Installs esignet-with-plugins helm chart
## Usage: ./install.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

echo Create $NS namespace
kubectl create ns $NS

function installing_esignet_with_plugins() {

while true; do
read -p "Do you want to continue installing esignet-with-plugins services? (y/n): " ans
if [ "$ans" = "Y" ] || [ "$ans" = "y" ]; then
break
elif [ "$ans" = "N" ] || [ "$ans" = "n" ]; then
exit 1
else
echo "Please provide a correct option (Y or N)"
fi
done

NS=esignet
CHART_VERSION=1.5.0-develop

ESIGNET_HOST=$(kubectl -n esignet get cm esignet-global -o jsonpath={.data.mosip-esignet-host})

echo Create $NS namespace
kubectl create ns $NS || true

echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite
helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update

COPY_UTIL=../copy_cm_func.sh
$COPY_UTIL configmap esignet-softhsm-share softhsm $NS
$COPY_UTIL configmap postgres-config postgres $NS
$COPY_UTIL configmap redis-config redis $NS
$COPY_UTIL secret esignet-softhsm softhsm $NS
$COPY_UTIL secret redis redis $NS

while true; do
read -p "Is Prometheus Service Monitor Operator deployed in the k8s cluster? (y/n): " response
if [[ "$response" == "y" || "$response" == "Y" ]]; then
servicemonitorflag=true
break
elif [[ "$response" == "n" || "$response" == "N" ]]; then
servicemonitorflag=false
break
else
echo "Not a correct response. Please respond with y (yes) or n (no)."
fi
done

echo "Do you have public domain & valid SSL? (Y/n) "
echo "Y: if you have public domain & valid ssl certificate"
echo "n: If you don't have a public domain and a valid SSL certificate. Note: It is recommended to use this option only in development environments."
read -p "" flag

if [ -z "$flag" ]; then
echo "'flag' was provided; EXITING;"
exit 1;
fi
ENABLE_INSECURE=''
if [ "$flag" = "n" ]; then
ENABLE_INSECURE='--set enable_insecure=true';
fi

while true; do
read -p "Do you want to use the default plugins? (y/n): " ans
if [[ "$ans" == "y" || "$ans" == "Y" ]]; then
echo "Default plugins are listed below, please provide the correct plugin number."
echo "1. esignet-mock-plugin.jar"
echo "2. mosip-identity-plugin.jar"
read -p "Enter the plugin number: " plugin_no
while true; do
if [[ "$plugin_no" == "1" ]]; then
plugin_option="--set pluginNameEnv=esignet-mock-plugin.jar"
break
elif [[ "$plugin_no" == "2" ]]; then
plugin_option="--set pluginNameEnv=mosip-identity-plugin.jar"
break
else
echo "please provide the correct plugin number (1 or 2)."
fi
done
break
elif [[ "$ans" == "n" || "$ans" == "N" ]]; then
read -p "Provide the URL to download the plugins zip " plugin_url
read -p "Provide the plugin jar name (with extension eg., test-plugin.jar) " plugin_jar
plugin_option="--set pluginNameEnv=$plugin_jar --set pluginUrlEnv=$plugin_url"
break
else
echo " Invalid response. Please respond with y (yes) or n (no)."
fi
done

echo Installing esignet-with-plugins
helm -n $NS install esignet mosip/esignet --version $CHART_VERSION \
$ENABLE_INSECURE $plugin_option \
--set metrics.serviceMonitor.enabled=$servicemonitorflag -f values.yaml --wait

kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status

echo Installed esignet-with-plugins service
return 0
}

# set commands for error handling.
set -e
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errtrace # trace ERR through 'time command' and other functions
set -o pipefail # trace ERR through pipes
installing_esignet_with_plugins # calling function
24 changes: 24 additions & 0 deletions deploy/esignet-with-plugins/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Restarts the esignet-with-plugins service

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function Restarting_esignet_with_plugins() {
NS=esignet
kubectl -n $NS rollout restart deploy esignet

kubectl -n $NS get deploy esignet -o name | xargs -n1 -t kubectl -n $NS rollout status

echo Retarted esignet-with-plugins services
return 0
}

# set commands for error handling.
set -e
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errtrace # trace ERR through 'time command' and other functions
set -o pipefail # trace ERR through pipes
Restarting_esignet_with_plugins # calling function
103 changes: 103 additions & 0 deletions deploy/esignet-with-plugins/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
## Uncomment required parms added with single '#' when needed.
#image:
# registry: docker.io
# repository: mosipdev/esignet
# tag: develop

#extraEnvVars: |
# - name: KEYCLOAK_EXTERNAL_URL
# valueFrom:
# configMapKeyRef:
# name: keycloak-host
# key: keycloak-external-url
# - name: MOSIP_ESIGNET_CAPTCHA_SITE_KEY
# valueFrom:
# secretKeyRef:
# name: esignet-captcha
# key: esignet-captcha-site-key
# - name: MOSIP_ESIGNET_CAPTCHA_MODULE_NAME
# value: esignet
# - name: IDA_AUTHENTICATOR_ENV
# value: Staging
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
# name: redis-config
# key: redis-host
# - name: REDIS_PORT
# valueFrom:
# configMapKeyRef:
# name: redis-config
# key: redis-port
# - name: REDIS_PASSWORD
# valueFrom:
# secretKeyRef:
# name: redis
# key: redis-password
# - name: DATABASE_HOST
# valueFrom:
# configMapKeyRef:
# name: postgres-config
# key: database-host
# - name: DATABASE_PORT
# valueFrom:
# configMapKeyRef:
# name: postgres-config
# key: database-port
# - name: DATABASE_NAME
# valueFrom:
# configMapKeyRef:
# name: postgres-config
# key: database-name
# - name: DATABASE_USERNAME
# valueFrom:
# configMapKeyRef:
# name: postgres-config
# key: database-username
# - name: DB_DBUSER_PASSWORD
# valueFrom:
# secretKeyRef:
# name: db-common-secrets
# key: db-dbuser-password
# - name: SOFTHSM_ESIGNET_SECURITY_PIN
# valueFrom:
# secretKeyRef:
# name: esignet-softhsm
# key: security-pin
# - name: MOSIP_ESIGNET_HOST
# valueFrom:
# configMapKeyRef:
# name: esignet-global
# key: mosip-esignet-host
# - name: MOSIP_SIGNUP_HOST
# valueFrom:
# configMapKeyRef:
# name: esignet-global
# key: mosip-signup-host
# - name: MOSIP_IDA_CLIENT_SECRET
# valueFrom:
# secretKeyRef:
# name: keycloak-client-secrets
# key: mosip_ida_client_secret
# - name: MOSIP_ESIGNET_MISP_KEY
# valueFrom:
# secretKeyRef:
# name: esignet-misp-onboarder-key
# key: mosip-esignet-misp-key
#extraEnvVarsCM:
# - esignet-softhsm-share

#extraEnvVarsSecret: []

#istio:
# enabled: true
# gateways:
# - istio-system/public
# - istio-system/internal
# prefix: /v1/esignet/

#enable_insecure: false
#springConfigNameEnv:
#activeProfileEnv:
#pluginNameEnv: esignet-mock-plugin.jar
#pluginUrlEnv:
37 changes: 7 additions & 30 deletions deploy/esignet/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function installing_esignet() {
fi
done


NS=esignet
CHART_VERSION=1.5.0-develop

Expand All @@ -32,6 +31,7 @@ function installing_esignet() {
kubectl create ns $NS || true

echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite
helm repo add mosip https://mosip.github.io/mosip-helm
helm repo update

Expand Down Expand Up @@ -69,37 +69,14 @@ function installing_esignet() {
ENABLE_INSECURE='--set enable_insecure=true';
fi

while true; do
read -p "Do you want to use the default plugins? (y/n): " ans
if [[ "$ans" == "y" || "$ans" == "Y" ]]; then
echo "Default plugins are listed below, please provide the correct plugin number."
echo "1. esignet-mock-plugin.jar"
echo "2. mosip-identity-plugin.jar"
read -p "Enter the plugin number: " plugin_no
while true; do
if [[ "$plugin_no" == "1" ]]; then
plugin_option="--set pluginNameEnv=esignet-mock-plugin.jar"
break
elif [[ "$plugin_no" == "2" ]]; then
plugin_option="--set pluginNameEnv=mosip-identity-plugin.jar"
break
else
echo "please provide the correct plugin number (1 or 2)."
fi
done
break
elif [[ "$ans" == "n" || "$ans" == "N" ]]; then
read -p "Provide the URL to download the plugins zip " plugin_url
read -p "Provide the plugin jar name (with extension eg., test-plugin.jar) " plugin_jar
plugin_option="--set pluginNameEnv=$plugin_jar --set pluginUrlEnv=$plugin_url"
break
else
echo " Invalid response. Please respond with y (yes) or n (no)."
fi
done
read -p "Provide the URL to download the plugins zip " plugin_url
read -p "Provide the plugin jar name (with extension eg., test-plugin.jar) " plugin_jar
plugin_option="--set pluginNameEnv=$plugin_jar --set pluginUrlEnv=$plugin_url"

echo Installing esignet
helm -n $NS install esignet mosip/esignet --version $CHART_VERSION $ENABLE_INSECURE $plugin_option \
helm -n $NS install esignet mosip/esignet --version $CHART_VERSION \
--set image.repository=mosipdev/esignet --set image.tag=develop \
$ENABLE_INSECURE $plugin_option \
--set metrics.serviceMonitor.enabled=$servicemonitorflag -f values.yaml --wait

kubectl -n $NS get deploy -o name | xargs -n1 -t kubectl -n $NS rollout status
Expand Down
2 changes: 1 addition & 1 deletion deploy/install-esignet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function installing_eSignet() {

helm repo add mosip https://mosip.github.io/mosip-helm
# List of modules to install
declare -a modules=("esignet" "oidc-ui")
declare -a modules=("esignet-with-plugins" "oidc-ui")

echo "Installing eSignet services"

Expand Down
2 changes: 1 addition & 1 deletion deploy/restart-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
function Restarting_All() {
ROOT_DIR=`pwd`

declare -a module=("esignet"
declare -a module=("esignet-with-plugins"
"captcha"
"oidc-ui"
)
Expand Down
Loading

0 comments on commit 74b0adb

Please sign in to comment.