Skip to content
Permalink
Browse files
Update README file and provision.sh
  • Loading branch information
Anh3h committed Dec 5, 2019
1 parent 685bdf7 commit e3d4a7e74a635611fa3bf00c2eff37052d4c638a
Showing 2 changed files with 78 additions and 8 deletions.
@@ -1,16 +1,43 @@
# Fineract CN Docker-Compose scripts
This project contains Docker Compose Scripts for running Fineract CN especially in Development.
This project contains Docker and Kubernetes Scripts for deploying Fineract CN, especially in Development.

## Requirements
- Kubernetes
- Docker
- Docker-compose
- Java

# Deploy and provision Fineract CN
# Deploy and provision Fineract CN using Kubernetes
Make sure you set up and connect to your Kubernetes cluster. You can follow [this](https://cwiki.apache.org/confluence/display/FINERACT/Install+and+configure+kubectl+and+Google+Cloud+SDK+on+ubuntu+16.04) guide to set up a Kubernetes cluster on GKE.

- Enter the Kubernetes directory.

`cd kubernetes_scripts`

- To deploy all the Fineract CN services on your cluster, run :

`bash kubectl-start-up.sh`
- You should make sure an external ip address had been assigned to all the deployed services by running:

`kubectl get services`
- Finally provison the microservices by running:

`cd bash_scripts`

`bash provision.sh --deploy-on-kubernetes playground` # where playground is your tenant name

- To shut down and reset you cluster, run:

`bash kubectl-shut-down.sh`

# Deploy and provision Fineract CN using Docker and Docker-compose

You can either deploy and provision Fineract CN automatically using bash scripts or manually using Postman.
Postman is the preferred way as it is more tested and this way you understand better what is happening.
Also this way you don't have to start all the micro services (helpful if your workstation is lacking resources).

## Hints:
- Postman is the preferred approach if you want to understand what is happening and, Bash is preferred when you already understand what's happening so, you simply what to automate the process.

- With Postman, you have more flexibility in deciding which service gets to be deployed and provisioned, therefore, making it the preferred route if you have limited resources.

# 1. Deploy and provision Fineract automatically using bash scripts

@@ -24,7 +51,7 @@ Also this way you don't have to start all the micro services (helpful if your wo

`cd bash_scripts`

`bash provision.sh playground` #where playground is your tenant name
`bash provision.sh playground` # where playground is your tenant name

## 2. Deploy Fineract manually using postman

@@ -181,7 +208,7 @@ docker-compose up

## Integration tests
We have a shell script that verifies if the setup still works.
For this install [Newman](https://learning.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman/) and
For this install [Newman](https://learning.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman/) and
run the script ./integration_test.sh. It takes about 15minutes to complete.
Beware that the script overwrites contents of .env file.

@@ -44,6 +44,40 @@ function init-variables {
NOTIFICATIONS_MS_NAME="notification-v1"
}

function config-kubernetes-addresss {
kubectl get services -o=jsonpath="{range .items[*]}{.metadata.name}{\"=\"}{.status.loadBalancer.ingress[0].ip}{\"\n\"}{end}" > cluster_addressess.txt
while IFS="=" read -r service ip; do
if [[ ${#ip} -gt 0 ]]
then
case "$service" in
'#'*) ;;
"cassandra-cluster") CASSANDRA_CONTACT_POINTS="$ip:9042" ;;
"postgresdb-cluster") POSTGRES_HOST="$ip" ;;
"provisioner-service") PROVISIONER_URL="http://$ip:2020/provisioner/v1" ;;
"identity-service") IDENTITY_URL="http://$ip:2021/identity/v1" ;;
"rhythm-service") RHYTHM_URL="http://$ip:2022/rhythm/v1" ;;
"office-service") OFFICE_URL="http://$ip:2023/office/v1" ;;
"customer-service") CUSTOMER_URL="http://$ip:2024/customer/v1" ;;
"accounting-service") ACCOUNTING_URL="http://$ip:2025/accounting/v1" ;;
"portfolio-service") PORTFOLIO_URL="http://$ip:2026/portfolio/v1" ;;
"deposit-service") DEPOSIT_URL="http://$ip:2027/deposit/v1" ;;
"teller-service") TELLER_URL="http://$ip:2028/teller/v1" ;;
"reporting-service") REPORT_URL="http://$ip:2029/report/v1" ;;
"cheques-service") CHEQUES_URL="http://$ip:2030/cheques/v1" ;;
"payroll-service") PAYROLL_URL="http://$ip:2031/payroll/v1" ;;
"group-service") GROUP_URL="http://$ip:2032/group/v1" ;;
"notification-service") NOTIFICATIONS_URL="http://$ip:2033/notification/v1" ;;
esac
elif [[ ${service} != "kubernetes" ]]
then
echo "$service ip has not been conigured"
exit 1
fi
done < "cluster_addressess.txt"

echo "Successfully configured kubernetes ip addresses"
}

function auto-seshat {
TOKEN=$( curl -s -X POST -H "Content-Type: application/json" \
"$PROVISIONER_URL"'/auth/token?grant_type=password&client_id=service-runner&username=wepemnefret&password=oS/0IiAME/2unkN1momDrhAdNKOhGykYFH/mJN20' \
@@ -378,6 +412,16 @@ function update_ledger {
}

init-variables
if [[ "$1" == "--deploy-on-kubernetes" ]]; then
config-kubernetes-addresss
TENANT=$2
elif [[ "$2" == "--deploy-on-kubernetes" ]]; then
config-kubernetes-addresss
TENANT=$1
else
TENANT=$1
fi

auto-seshat
create-application "$IDENTITY_MS_NAME" "" "$MS_VENDOR" "$IDENTITY_URL"
create-application "$RHYTHM_MS_NAME" "" "$MS_VENDOR" "$RHYTHM_URL"
@@ -394,7 +438,6 @@ create-application "$GROUP_MS_NAME" "" "$MS_VENDOR" "$GROUP_URL"
create-application "$NOTIFICATIONS_MS_NAME" "" "$MS_VENDOR" "$NOTIFICATIONS_URL"

# Set tenant identifier
TENANT=$1
create-tenant ${TENANT} "${TENANT}" "All in one Demo Server" ${TENANT}
assign-identity-ms ${TENANT}
login ${TENANT} "antony" $ADMIN_PASSWORD
@@ -419,7 +462,7 @@ set-application-permission-enabled-for-user ${TENANT} $RHYTHM_MS_NAME "identity_
provision-app ${TENANT} $ACCOUNTING_MS_NAME
provision-app ${TENANT} $PORTFOLIO_MS_NAME
echo "Waiting for Portfolio to provision."
sleep 60s
sleep 45s
set-application-permission-enabled-for-user ${TENANT} $RHYTHM_MS_NAME "portfolio__v1__khepri" "imhotep"
provision-app ${TENANT} $DEPOSIT_MS_NAME
provision-app ${TENANT} $TELLER_MS_NAME

0 comments on commit e3d4a7e

Please sign in to comment.