Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOSIP-35421] Moved installtion scripts of prereg apitestrig. #725

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,28 @@ Prerequisites:
$ cd <service folder>
$ docker build -f Dockerfile
```
## Deploy
To deploy Commons services on Kubernetes cluster using Dockers refer to [Sandbox Deployment](https://docs.mosip.io/1.2.0/deployment/sandbox-deployment).

## Deployment in K8 cluster with other MOSIP services:
### Pre-requisites
* Set KUBECONFIG variable to point to existing K8 cluster kubeconfig file:
```
export KUBECONFIG=~/.kube/<k8s-cluster.config>
```
### Install
```
$ cd deploy
$ ./install.sh
```
### Delete
```
$ cd deploy
$ ./delete.sh
```
### Restart
```
$ cd deploy
$ ./restart.sh
```

## Configuration
Refer to the [configuration guide](docs/configuration.md).
Expand Down
28 changes: 28 additions & 0 deletions deploy/prereg-apitestrig/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# PREREG APITESTRIG

# INSTALL

This `install.sh` script automates the process of cloning `mosip-functional-tests` repository from a user-defined specific branch from a Git repository, running an installation script to deploy prereg apitestrig within the cluster, and cleaning up the repository afterward.

Note: This directory contains `values.yaml` file which contains the latest prereg apitestrig release changes with latest released Docker image and tag. The above install script uses this `values.yaml` by default to deploy apitestrig with latest changes.

## Prerequisites

- Ensure you have **git** installed on your machine.
- You need access to the Kubernetes cluster configuration file (`kubeconfig`).
- Ensure you have the necessary permissions to execute shell scripts.

## Script Usage

1. **Clone this script to your local machine**.
2. **Run the script using the following command**:
```bash
./script.sh <path-to-kubeconfig>
```

## TL;DR

```console
$ helm repo add mosip https://mosip.github.io
$ helm install my-release mosip/apitestrig -f values.yaml
```
52 changes: 52 additions & 0 deletions deploy/prereg-apitestrig/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# Prompt the user for the branch name
read -p "Enter the Git branch (default is 'develop'): " GIT_BRANCH
GIT_BRANCH=${GIT_BRANCH:-develop} # Default to 'develop' if no input is provided

echo "set kubeconfig"
export KUBECONFIG=$1

# Set variables
REPO_URL="https://github.com/mosip/mosip-functional-tests.git"
INSTALL_SCRIPT="install.sh"
VALUES_FILE="../../../values.yaml" # Path to your custom values.yaml file

# Clone the repository
echo "Cloning repository from $REPO_URL on branch $GIT_BRANCH..."
if git clone -b "$GIT_BRANCH" "$REPO_URL" ; then
echo "Repository cloned successfully."
else
echo "Failed to clone repository."
exit 1
fi

# Navigate to the deployment directory
echo "Navigating to deploy directory..."
git_repo_name="$(basename "$REPO_URL" .git)"

cd $git_repo_name

git sparse-checkout init --cone && git sparse-checkout set deploy/apitestrig

find . -type f ! -path "./deploy/*" -exec rm -f {} \;

cd deploy/apitestrig || { echo "apitestrig directory not found."; exit 1; }
cp $VALUES_FILE values.yaml

# Check if the install script exists and is executable
if [ -x "$INSTALL_SCRIPT" ]; then
echo "Running install script with values file $VALUES_FILE..."
source ./"$INSTALL_SCRIPT"
echo "Install script executed successfully."
else
echo "Install script not found or not executable."
exit 1
fi

# Cleanup cloned repository
echo "Cleaning up..."
cd ../../..
rm -rf $git_repo_name

echo "Deployment complete!"
55 changes: 55 additions & 0 deletions deploy/prereg-apitestrig/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
modules:
masterdata:
enabled: false
image:
repository: mosipqa/apitest-masterdata
tag: develop
pullPolicy: Always
prereg:
enabled: true
image:
repository: mosipqa/apitest-prereg
tag: develop
pullPolicy: Always
idrepo:
enabled: false
image:
repository: mosipqa/apitest-idrepo
tag: develop
pullPolicy: Always
partner:
enabled: false
image:
repository: mosipqa/apitest-partner
tag: develop
pullPolicy: Always
resident:
enabled: false
image:
repository: mosipqa/apitest-resident
tag: develop
pullPolicy: Always
auth:
enabled: false
image:
repository: mosipqa/apitest-auth
tag: develop
pullPolicy: Always
esignet:
enabled: false
image:
repository: mosipqa/apitest-esignet
tag: develop
pullPolicy: Always
mimoto:
enabled: false
image:
repository: mosipqa/apitest-mimoto
tag: develop
pullPolicy: Always
pms:
enabled: false
image:
repository: mosipqa/apitest-pms
tag: develop
pullPolicy: Always
Loading