Skip to content

Commit

Permalink
Merge pull request #251 from ckm007/master
Browse files Browse the repository at this point in the history
updating master with 1.1.5.4 release changes
  • Loading branch information
ckm007 authored Oct 24, 2021
2 parents db255b2 + d0961e5 commit 4f4c7ed
Show file tree
Hide file tree
Showing 291 changed files with 21,115 additions and 16,509 deletions.
1,240 changes: 3 additions & 1,237 deletions .github/workflows/push_trigger.yml

Large diffs are not rendered by default.

1,272 changes: 1 addition & 1,271 deletions .github/workflows/release_trigger.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ install: true
cache:
directories:
- $HOME/.m2
script: mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true -B -V
script: cd registration && mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true -B -V
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Registration
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_registration&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_registration)
[![Join the chat at https://gitter.im/mosip-community/Registration](https://badges.gitter.im/mosip-community/Registration.svg)](https://gitter.im/mosip-community/Registration?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)



This repository contains the two components of registration:
1. Registration Client (UI Component)
1. Registration Services
This repository contains the components related to registration:
1. Registration Client
2. Registration services
3. Registration libs - installer and run wrapper

Refer to README in respective folders for details.

Expand Down
92 changes: 92 additions & 0 deletions db_release_scripts/mosip_reg/reg_release_db_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
### -- ---------------------------------------------------------------------------------------------------------
### -- Script Name : Reg Release DB deploy
### -- Deploy Module : MOSIP Reg
### -- Purpose : To deploy Reg Database alter scripts for the release.
### -- Create By : Ram Bhatt
### -- Created Date : Jan-2021
### --
### -- Modified Date Modified By Comments / Remarks
### -- -----------------------------------------------------------------------------------------------------------

### -- -----------------------------------------------------------------------------------------------------------

#########Properties file #############
set -e
properties_file="$1"
release_version="$2"
echo `date "+%m/%d/%Y %H:%M:%S"` ": Properties File Name - $properties_file"
echo `date "+%m/%d/%Y %H:%M:%S"` ": DB Deploymnet Version - $release_version"
#properties_file="./app.properties"
if [ -f "$properties_file" ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file \"$properties_file\" found."
while IFS='=' read -r key value
do
key=$(echo $key | tr '.' '_')
eval ${key}=\${value}
done < "$properties_file"
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file not found, Pass property file name as argument."
fi
echo `date "+%m/%d/%Y %H:%M:%S"` ": ------------------ Database server and service status check for ${MOSIP_DB_NAME}------------------------"

today=`date '+%d%m%Y_%H%M%S'`;
LOG="${LOG_PATH}${MOSIP_DB_NAME}-release-${release_version}-${today}.log"
touch $LOG

SERVICE=$(PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "select count(1) from pg_roles where rolname IN('sysadmin')";exit; > /dev/null)

if [ "$SERVICE" -eq 0 ] || [ "$SERVICE" -eq 1 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server and service is up and running" | tee -a $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server or service is not running" | tee -a $LOG 2>&1
fi

echo `date "+%m/%d/%Y %H:%M:%S"` ": ----------------------------------------------------------------------------------------"

echo `date "+%m/%d/%Y %H:%M:%S"` ": Started sourcing the $MOSIP_DB_NAME Database Alter scripts" | tee -a $LOG 2>&1

echo `date "+%m/%d/%Y %H:%M:%S"` ": Database Alter scripts are sourcing from :$BASEPATH/$MOSIP_DB_NAME/" | tee -a $LOG 2>&1

#========================================DB Alter Scripts deployment process begins on IDMAP DB SERVER==================================

echo `date "+%m/%d/%Y %H:%M:%S"` ": Alter scripts deployment on $MOSIP_DB_NAME database is started....Deployment Version...$release_version" | tee -a $LOG 2>&1

ALTER_SCRIPT_FILENAME_VERSION="sql/${release_version}_${ALTER_SCRIPT_FILENAME}"

echo `date "+%m/%d/%Y %H:%M:%S"` ": Alter scripts file which is considered for release deployment - $ALTER_SCRIPT_FILENAME_VERSION" | tee -a $LOG 2>&1

cd /$BASEPATH/$MOSIP_DB_NAME/

pwd | tee -a $LOG 2>&1

CONN=$(PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "SELECT count(pg_terminate_backend(pg_stat_activity.pid)) FROM pg_stat_activity WHERE datname = '$MOSIP_DB_NAME' AND pid <> pg_backend_pid()";exit; >> $LOG 2>&1)

if [ ${CONN} == 0 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": No active database connections exist on ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Active connections exist on the database server and active connection will be terminated for DB deployment." | tee -a $LOG 2>&1
fi

if [ ${ALTER_SCRIPT_FLAG} == 1 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Deploying Alter scripts for ${MOSIP_DB_NAME} database" | tee -a $LOG 2>&1
PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $ALTER_SCRIPT_FILENAME_VERSION >> $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": There are no alter scripts available for this deployment at ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1
fi

if [ $(grep -c ERROR $LOG) -ne 0 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Database Alter scripts deployment version $release_version is completed with ERRORS, Please check the logs for more information" | tee -a $LOG 2>&1
echo `date "+%m/%d/%Y %H:%M:%S"` ": END of Alter scripts MOSIP database deployment" | tee -a $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Database Alter scripts deployment version $release_version completed successfully, Please check the logs for more information" | tee -a $LOG 2>&1
echo `date "+%m/%d/%Y %H:%M:%S"` ": END of MOSIP \"${MOSIP_DB_NAME}\" database alter scripts deployment" | tee -a $LOG 2>&1
fi

echo "******************************************"`date "+%m/%d/%Y %H:%M:%S"` "*****************************************************" >> $LOG 2>&1


14 changes: 14 additions & 0 deletions db_release_scripts/mosip_reg/reg_release_deploy.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DB_SERVERIP=
DB_PORT=9001
SU_USER=postgres
SU_USER_PWD=
DEFAULT_DB_NAME=postgres
MOSIP_DB_NAME=mosip_reg
SYSADMIN_USER=sysadmin
SYSADMIN_PWD=
BASEPATH=/home/madmin/database_release
LOG_PATH=/home/madmin/logs/
ALTER_SCRIPT_FLAG=1
ALTER_SCRIPT_FILENAME=reg-scripts_release.sql
REVOKE_SCRIPT_FLAG=1
REVOKE_SCRIPT_FILENAME=reg-scripts_revoke.sql
92 changes: 92 additions & 0 deletions db_release_scripts/mosip_reg/reg_revoke_db_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
### -- ---------------------------------------------------------------------------------------------------------
### -- Script Name : Reg Revoke DB deploy
### -- Deploy Module : MOSIP Reg
### -- Purpose : To revoke Reg Database alter scripts for the release.
### -- Create By : Ram Bhatt
### -- Created Date : Jan-2020
### --
### -- Modified Date Modified By Comments / Remarks
### -- -----------------------------------------------------------------------------------------------------------

### -- -----------------------------------------------------------------------------------------------------------

#########Properties file #############
set -e
properties_file="$1"
revoke_version="$2"
echo `date "+%m/%d/%Y %H:%M:%S"` ": $properties_file"
echo `date "+%m/%d/%Y %H:%M:%S"` ": DB Revoke Version - $revoke_version"
#properties_file="./app.properties"
if [ -f "$properties_file" ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file \"$properties_file\" found."
while IFS='=' read -r key value
do
key=$(echo $key | tr '.' '_')
eval ${key}=\${value}
done < "$properties_file"
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Property file not found, Pass property file name as argument."
fi
echo `date "+%m/%d/%Y %H:%M:%S"` ": ------------------ Database server and service status check for ${MOSIP_DB_NAME}------------------------"

today=`date '+%d%m%Y_%H%M%S'`;
LOG="${LOG_PATH}${MOSIP_DB_NAME}-revoke-${today}.log"
touch $LOG

SERVICE=$(PGPASSWORD=$SU_USER_PWD psql --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "select count(1) from pg_roles where rolname IN('sysadmin')";exit; > /dev/null)

if [ "$SERVICE" -eq 0 ] || [ "$SERVICE" -eq 1 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server and service is up and running" | tee -a $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Postgres database server or service is not running" | tee -a $LOG 2>&1
fi

echo `date "+%m/%d/%Y %H:%M:%S"` ": ----------------------------------------------------------------------------------------"

echo `date "+%m/%d/%Y %H:%M:%S"` ": Started sourcing the $MOSIP_DB_NAME Database Deployment Revoke scripts" | tee -a $LOG 2>&1

echo `date "+%m/%d/%Y %H:%M:%S"` ": Database revoke scripts are sourcing from :$BASEPATH/$MOSIP_DB_NAME/alter-scripts" | tee -a $LOG 2>&1

#========================================DB Alter Scripts deployment process begins on IDMAP DB SERVER==================================

echo `date "+%m/%d/%Y %H:%M:%S"` ": Revoke scripts for DB deployment on $MOSIP_DB_NAME database is started....Revoke Version...$revoke_version" | tee -a $LOG 2>&1

REVOKE_SCRIPT_FILENAME_VERSION="sql/${revoke_version}_${REVOKE_SCRIPT_FILENAME}"

echo `date "+%m/%d/%Y %H:%M:%S"` ": Alter scripts file which is considered for deployment revoke - $REVOKE_SCRIPT_FILENAME_VERSION" | tee -a $LOG 2>&1

cd /$BASEPATH/$MOSIP_DB_NAME/

pwd | tee -a $LOG 2>&1

CONN=$(PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "SELECT count(pg_terminate_backend(pg_stat_activity.pid)) FROM pg_stat_activity WHERE datname = '$MOSIP_DB_NAME' AND pid <> pg_backend_pid()";exit; >> $LOG 2>&1)

if [ ${CONN} == 0 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": No active database connections exist on ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Active connections exist on the database server and active connection will be terminated for DB deployment." | tee -a $LOG 2>&1
fi

if [ ${REVOKE_SCRIPT_FLAG} == 1 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Executing revoke scripts for ${MOSIP_DB_NAME} database" | tee -a $LOG 2>&1
PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $REVOKE_SCRIPT_FILENAME_VERSION >> $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": There are no revoke scripts available for this deployment at ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1
fi

if [ $(grep -c ERROR $LOG) -ne 0 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Database deployment revoke version $revoke_version is completed with ERRORS, Please check the logs for more information" | tee -a $LOG 2>&1
echo `date "+%m/%d/%Y %H:%M:%S"` ": END of Alter scripts MOSIP database deployment" | tee -a $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": Database deployment revoke version $revoke_version completed successfully, Please check the logs for more information" | tee -a $LOG 2>&1
echo `date "+%m/%d/%Y %H:%M:%S"` ": END of MOSIP \"${MOSIP_DB_NAME}\" database deployment revoke" | tee -a $LOG 2>&1
fi

echo "******************************************"`date "+%m/%d/%Y %H:%M:%S"` "*****************************************************" >> $LOG 2>&1


Loading

0 comments on commit 4f4c7ed

Please sign in to comment.