Skip to content

Commit

Permalink
Merge pull request #717 from Rakshitha650/MOSIP-32901
Browse files Browse the repository at this point in the history
[MOSIP-32901]added the installation scripts that were required as part of the assigned deployment.
  • Loading branch information
ckm007 authored May 28, 2024
2 parents f1956da + 0810250 commit ff38cb8
Show file tree
Hide file tree
Showing 63 changed files with 1,973 additions and 25 deletions.
47 changes: 47 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# **Esignet Deployment**

## **Overview**
This guide will walk you through the deployment process of the Esignet application. The setup involves creating a Kubernetes cluster, setting up Nginx, installing Istio, and configuring the necessary dependent services.

## Prerequisites
Before you begin, ensure you have the following installed and configured on your system:

Kubernetes (kubectl)
Helm
Istio
* [reference-link](https://github.com/mosip/k8s-infra/blob/main/mosip/on-prem/README.md)

## Storage class setup

* [nfs-clinet](https://github.com/mosip/k8s-infra/tree/main/nfs)

## Istio installation

* [istio](https://github.com/mosip/k8s-infra/blob/main/mosip/on-prem/README.md#istio-for-service-discovery-and-ingress)

## Nginx setup

* [nginx](https://github.com/mosip/k8s-infra/tree/main/mosip/on-prem/nginx)

## Esignet and dependent modules installation
Install in the following order:

* postgres
* iam
* kafka
* artifactory
* config-server
* redis
* esignet
* oidc-ui

## Install

* The same can be achieved by running helm/install-all.sh
* `cd helm`

`./install-all.sh`

### Once all the services are up and running, perform the onboarding process for Esignet
* [partner-onboarding](https://github.com/mosip/esignet/tree/v1.4.0/partner-onboarder)

6 changes: 6 additions & 0 deletions helm/artifactory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Artifactory

## Install
```sh
./install.sh
```
30 changes: 30 additions & 0 deletions helm/artifactory/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Uninstalls artifactory
# Usage: ./delete.sh [kubeconfig]

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

function deleting_artifactory() {
NS=artifactory
while true; do
read -p "Are you sure you want to delete artifactory helm chart?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete artifactory
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_artifactory # calling function
35 changes: 35 additions & 0 deletions helm/artifactory/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Installs artifactory
## Usage: ./install.sh [kubeconfig]

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

NS=artifactory
CHART_VERSION=0.0.1-develop

echo Create $NS namespace
kubectl create ns $NS

function installing_artifactory() {
echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite
helm repo update

echo Installing artifactory
helm -n $NS install artifactory mosip/artifactory --version $CHART_VERSION

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

echo Installed artifactory 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_artifactory # calling function
25 changes: 25 additions & 0 deletions helm/artifactory/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Restart the artifactory service
## Usage: ./restart.sh [kubeconfig]

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

function Restarting_artifactory() {
NS=artifactory
kubectl -n $NS rollout restart deploy

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

echo Restarted Artifactory 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_artifactory # calling function
11 changes: 11 additions & 0 deletions helm/config-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Config server

## Introduction
Config server serves all properties required by MOSIP modules. This must be installed before any other MOSIP modules.

## Install
* Review `values.yaml` and make sure git repository parameters are as per your installation.
* Install
```sh
./install.sh
```
18 changes: 18 additions & 0 deletions helm/config-server/copy_cm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Copy configmaps from other namespaces

function copying_cm() {
COPY_UTIL=./copy_cm_func.sh
DST_NS=config-server # DST_NS: Destination namespace
$COPY_UTIL configmap global default $DST_NS
$COPY_UTIL configmap keycloak-host keycloak $DST_NS
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
copying_cm # calling function
28 changes: 28 additions & 0 deletions helm/config-server/copy_cm_func.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Copy configmap and secret from one namespace to another.
# ./copy_cm_func.sh <resource> <configmap_name> <source_namespace> <destination_namespace> [name]
# Parameters:
# resource: configmap|secret
# name: Optional new name of the configmap or secret in destination namespace. This may be needed if there is
# clash of names

if [ $1 = "configmap" ]
then
RESOURCE=configmap
elif [ $1 = "secret" ]
then
RESOURCE=secret
else
echo "Incorrect resource $1. Exiting.."
exit 1
fi


if [ $# -ge 5 ]
then
kubectl -n $4 delete --ignore-not-found=true $RESOURCE $5
kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | sed "s/name: $2/name: $5/g" | kubectl -n $4 create -f -
else
kubectl -n $4 delete --ignore-not-found=true $RESOURCE $2
kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | kubectl -n $4 create -f -
fi
19 changes: 19 additions & 0 deletions helm/config-server/copy_secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Copy secrets from other namespaces

function copying_secrets() {
COPY_UTIL=./copy_cm_func.sh
DST_NS=config-server # DST_NS: Destination namespace
$COPY_UTIL secret db-common-secrets postgres $DST_NS
$COPY_UTIL secret keycloak keycloak $DST_NS
$COPY_UTIL secret keycloak-client-secrets keycloak $DST_NS
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
copying_secrets # calling function
32 changes: 32 additions & 0 deletions helm/config-server/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# Uninstalls config server
## Usage: ./delete.sh [kubeconfig]

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

function config_server() {
NS=config-server
while true; do
read -p "Are you sure you want to delete config-server helm charts?(Y/n) " yn
if [ $yn = "Y" ]
then
kubectl -n $NS delete configmap global keycloak-host
kubectl -n $NS delete secret db-common-secrets keycloak keycloak-client-secrets
helm -n $NS delete config-server
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
config_server # calling function
36 changes: 36 additions & 0 deletions helm/config-server/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Installs config-server
## Usage: ./install.sh [kubeconfig]

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

NS=config-server
CHART_VERSION=0.0.1-develop

echo Create $NS namespace
kubectl create ns $NS

# 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

echo Istio label
kubectl label ns $NS istio-injection=enabled --overwrite
helm repo update

echo Copy configmaps
sed -i 's/\r$//' copy_cm.sh
./copy_cm.sh

echo Copy secrets
sed -i 's/\r$//' copy_secrets.sh
./copy_secrets.sh

echo Installing config-server
helm -n $NS install config-server mosip/config-server -f values.yaml --wait --version $CHART_VERSION
echo Installed Config-server.
25 changes: 25 additions & 0 deletions helm/config-server/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Restart the config-server service
## Usage: ./restart.sh [kubeconfig]

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

function config_server() {
NS=config-server
kubectl -n $NS rollout restart deploy

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

echo Restarted config-server 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
config_server # calling function
Loading

0 comments on commit ff38cb8

Please sign in to comment.