-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #370 from mosip/MOSIP-35816
[MOSIP-35816]
- Loading branch information
Showing
40 changed files
with
592 additions
and
780 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Installs signup services in correct order | ||
## Usage: ./install-all.sh [kubeconfig] | ||
## Installs signup services in correct order | ||
## Usage: ./install.sh [kubeconfig] | ||
|
||
if [ $# -ge 1 ] ; then | ||
export KUBECONFIG=$1 | ||
fi | ||
|
||
ROOT_DIR=`pwd` | ||
|
||
function installing_All() { | ||
helm repo add mosip https://mosip.github.io/mosip-helm | ||
helm repo update | ||
function installing_signup() { | ||
|
||
declare -a module=("signup-service" | ||
"signup-ui" | ||
) | ||
helm repo add mosip https://mosip.github.io/mosip-helm | ||
# List of modules to install | ||
declare -a modules=("signup-service" "signup-ui") | ||
|
||
echo Installing signup services | ||
echo "Installing signup services" | ||
|
||
for i in "${module[@]}" | ||
# Install modules | ||
for module in "${modules[@]}" | ||
do | ||
cd $ROOT_DIR/"$i" | ||
cd $ROOT_DIR/"$module" | ||
./install.sh | ||
done | ||
|
||
echo All signup services deployed sucessfully. | ||
echo "All signup services deployed successfully." | ||
return 0 | ||
} | ||
|
||
# set commands for error handling. | ||
# 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 nounset ## set -u : exit the script if you try to use an uninitialized variable | ||
set -o errtrace # trace ERR through 'time command' and other functions | ||
set -o pipefail # trace ERR through pipes | ||
installing_All # calling function | ||
installing_signup # calling function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
keycloak: | ||
realms: | ||
mosip: # realm | ||
roles: | ||
- AUTH | ||
- ID_REPOSITORY | ||
- REGISTRATION_ADMIN | ||
clients: | ||
- name: mosip-signup-client | ||
mappers: [] | ||
saroles: | ||
- AUTH | ||
- CREDENTIAL_REQUEST | ||
- ID_REPOSITORY | ||
- REGISTRATION_ADMIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
# Initialises signup keycloak-init | ||
## Usage: ./keycloak-init.sh [kubeconfig] | ||
|
||
if [ $# -ge 1 ] ; then | ||
export KUBECONFIG=$1 | ||
fi | ||
|
||
NS=signup | ||
CHART_VERSION=0.0.1-develop | ||
COPY_UTIL=../copy_cm_func.sh | ||
|
||
helm repo add mosip https://mosip.github.io/mosip-helm | ||
helm repo update | ||
|
||
echo "checking if mosip-pms-client, mosip-ida-client & mpartner_default_auth client is created already" | ||
IAMHOST_URL=$(kubectl -n esignet get cm esignet-global -o jsonpath={.data.mosip-iam-external-host}) | ||
SIGNUP_CLIENT_SECRET_KEY='mosip_signup_client_secret' | ||
SIGNUP_CLIENT_SECRET_VALUE=$(kubectl -n keycloak get secrets keycloak-client-secrets -o jsonpath={.data.$SIGNUP_CLIENT_SECRET_KEY} | base64 -d) | ||
echo "Copying keycloak configmaps and secret" | ||
$COPY_UTIL configmap keycloak-host keycloak $NS | ||
$COPY_UTIL configmap keycloak-env-vars keycloak $NS | ||
$COPY_UTIL secret keycloak keycloak $NS | ||
|
||
echo "creating and adding roles to keycloak pms & mpartner_default_auth clients for ESIGNET" | ||
kubectl -n $NS delete secret --ignore-not-found=true keycloak-client-secrets | ||
helm -n $NS delete signup-keycloak-init | ||
helm -n $NS install signup-keycloak-init mosip/keycloak-init \ | ||
-f keycloak-init-values.yaml \ | ||
--set clientSecrets[0].name="$SIGNUP_CLIENT_SECRET_KEY" \ | ||
--set clientSecrets[0].secret="$SIGNUP_CLIENT_SECRET_VALUE" \ | ||
--version $CHART_VERSION --wait --wait-for-jobs | ||
|
||
SIGNUP_CLIENT_SECRET_VALUE=$(kubectl -n $NS get secrets keycloak-client-secrets -o jsonpath={.data.$SIGNUP_CLIENT_SECRET_KEY}) | ||
# Check if the secret exists | ||
if kubectl get secret keycloak-client-secrets -n keycloak >/dev/null 2>&1; then | ||
echo "Secret 'keycloak-client-secrets' exists. Performing secret update..." | ||
kubectl -n keycloak get secret keycloak-client-secrets -o json | | ||
jq ".data[\"$SIGNUP_CLIENT_SECRET_KEY\"]=\"$SIGNUP_CLIENT_SECRET_VALUE\"" | | ||
kubectl apply -f - | ||
else | ||
echo "Secret 'keycloak-client-secrets' does not exist. Copying the secret to the keycloak namespace." | ||
$COPY_UTIL secret keycloak-client-secrets $NS keycloak | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
# Installs signup services in correct order | ||
## Usage: ./install-all.sh [kubeconfig] | ||
|
||
if [ $# -ge 1 ] ; then | ||
export KUBECONFIG=$1 | ||
fi | ||
|
||
ROOT_DIR=`pwd` | ||
NS=signup | ||
|
||
echo "This script considers below mentioned points:" | ||
echo "1. Keycloak is installed in keycloak namespace and already initialised once during esignet pre-requisites initialisation." | ||
echo "2. Redis is installed and relevant secret and configmap is present in redis namespace as part of esignet pre-requisites installation." | ||
echo "3. Kafka is installed in kafka namespace as part of esignet pre-requisites installation." | ||
|
||
function installing_prereq() { | ||
helm repo add mosip https://mosip.github.io/mosip-helm | ||
helm repo update | ||
|
||
echo Create $NS namespace | ||
kubectl create ns $NS || true | ||
|
||
./copy_cm_func.sh configmap esignet-global esignet $NS | ||
echo "Sucessfully copied esignet-global configmap from esignet namespace to "$NS" " | ||
|
||
|
||
./copy_cm_func.sh configmap redis-config redis $NS | ||
./copy_cm_func.sh secret redis redis $NS | ||
echo "Sucessfully copied configmaps and secrets required to connect to the redis server from redis namespace which is also shared with esignet" | ||
|
||
echo "Note: By default pointing to the Kafka installed in kafka namespace used by esignet service as well. In case want to change the same, deploy new kafka server and update in signup application properties." | ||
|
||
cd $ROOT_DIR/keycloak | ||
./keycloak-init.sh | ||
|
||
SIGNUP_HOST=$(kubectl -n esignet get cm esignet-global -o jsonpath={.data.mosip-signup-host}) | ||
echo "Please enter the recaptcha admin site key for domain "$SIGNUP_HOST"" | ||
read SSITE_KEY | ||
echo Please enter the recaptcha admin secret key for domain $SIGNUP_HOST | ||
read SSECRET_KEY | ||
|
||
echo Setting up captcha secrets | ||
kubectl -n $NS create secret generic signup-captcha --from-literal=signup-captcha-site-key=$SSITE_KEY --from-literal=signup-captcha-secret-key=$SSECRET_KEY --dry-run=client -o yaml | kubectl apply -f - | ||
|
||
echo creating empty signup-keystore-password secret | ||
kubectl -n $NS create secret generic signup-keystore-password --from-literal=signup-keystore-password='' --dry-run=client -o yaml | kubectl apply -f - | ||
|
||
echo creating empty signup-keystore secret | ||
kubectl -n $NS create secret generic signup-keystore --from-literal=oidckeystore.p12='' --dry-run=client -o yaml | kubectl apply -f - | ||
|
||
echo All signup services pre-requisites deployed sucessfully. | ||
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_prereq # calling function |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.