diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..290bebb Binary files /dev/null and b/.DS_Store differ diff --git a/.circleci/config.yml b/.circleci/config.yml index 67efefe..5219c20 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,264 @@ version: 2.1 setup: true - orbs: - test-harness: govstack-working-group/testutils@1.0.6 + test-harness: govstack-working-group/testutils@1.0.4 + aws-eks: circleci/aws-eks@2.2.0 + slack: circleci/slack@4.12.5 + helm: circleci/helm@2.0.1 + kubernetes: circleci/kubernetes@1.3 + aws-cli: circleci/aws-cli@4.0.0 + +jobs: + deploy-g2psandbox-govstack-chart: + docker: + - image: cimg/python:3.10 + steps: + - checkout + - aws-cli/setup: + role_arn: "${AWS_CIRCLECI_ROLE_ARN}" + region: AWS_REGION + profile_name: "playground" + role_session_name: deploy-test + session_duration: '1800' + - helm/install-helm-client: + version: "v3.8.2" + - run: + name: Update kubeconfig + command: | + aws eks update-kubeconfig --name ${EKS_CLUSTER} + + # Deploy Helm chart to EKS + - run: + name: Deploy Helm chart to EKS + command: | + # Install Helm chart + helm dep up helm/govstack-chart + helm upgrade --install -f helm/govstack-chart/values.yaml g2p-sandbox helm/govstack-chart --create-namespace --namespace paymenthub + # helm upgrade --install g2p-sandbox ./helm/govstack-chart + deploy-fineract-helm-chart: + docker: + - image: cimg/python:3.10 + steps: + - checkout + - aws-cli/setup: + role_arn: "${AWS_CIRCLECI_ROLE_ARN}" + region: AWS_REGION + profile_name: "playground" + role_session_name: deploy-test + session_duration: '1800' + - helm/install-helm-client: + version: "v3.8.2" + - run: + name: Update kubeconfig + command: | + aws eks update-kubeconfig --name ${EKS_CLUSTER} + - helm/upgrade-helm-chart: + add-repo: "https://fynarfin.io/images/fineract/" + chart: "https://fynarfin.io/images/fineract/fin-engine-1.1.0-SNAPSHOT.tgz" + release-name: fineract + namespace: fineract + recreate-pods: true + wait: true + timeout: "300s" + + # create-secret: + # docker: + # - image: cimg/base:2022.06 + # steps: + # - checkout + # # - setup_remote_docker: + # # version: 20.10.14 + # - aws-cli/setup: + # role_arn: "${AWS_CIRCLECI_ROLE_ARN}" + # region: AWS_REGION + # profile_name: "playground" + # role_session_name: deploy-test + # session_duration: '1800' + # - run: + # name: Update kubeconfig + # command: | + # aws eks update-kubeconfig --name ${EKS_CLUSTER} + # - kubernetes/install-kubectl + # # - aws-eks/update-kubeconfig-with-authenticator: + # # cluster-name: "GStack-sb-eks-plg" + # # aws-region: "$REGION" + # - run: | + # cd helm/kibana-secret/ + # make secrets || echo "kibana" already exists + # - run: | + # cd helm/es-secret/ + # make secrets || echo "elastic-certificates" already exists + # - run: | + # export ENV_NAMESPACE=paymenthub + # kubectl delete secret bulk-processor-secret -n $ENV_NAMESPACE || echo "delete the secret if exist" + # kubectl create secret generic bulk-processor-secret \ + # --from-literal=aws-access-key="$S3_ACCESS_KEY_ID" \ + # --from-literal=aws-secret-key="$S3_SECRET_ACCESS_KEY" -n $ENV_NAMESPACE + + # # - run: | + # # kubectl delete secret bulk-processor-secret -n paymenthub || echo "delete the secret if exist" + # # kubectl create secret generic bulk-processor-secret \ + # # --from-literal=aws-access-key="$S3_ACCESS_KEY_ID" \ + # # --from-literal=aws-secret-key="$S3_SECRET_ACCESS_KEY" -n paymenthub + + # deploying-bpmns: + # docker: + # - image: cimg/base:2022.06 + # # - image: 'curlimages/curl:8.2.1' + # steps: + # - checkout + # - aws-cli/setup: + # role_arn: "${AWS_CIRCLECI_ROLE_ARN}" + # region: AWS_REGION + # profile_name: "playground" + # role_session_name: deploy-test + # session_duration: '1800' + # - run: + # name: Update kubeconfig + # command: | + # aws eks update-kubeconfig --name ${EKS_CLUSTER} + # - kubernetes/install-kubectl + # # - run: + # # name: Wait for Port Forward + # # command: | + # # until nc -z localhost 5000; do sleep 1; done + # - run: + # name: download and execute the bpmn upload + # command: | + # #insatll netcat + # echo install netcat + # sudo apt install -y netcat + # sleep 10 + # check_count=0 + # until ((check_count==20)) || nc -vz ph-ee-zeebe-ops 80; do + # echo "Waiting for zeebe-ops service"; + # sleep 5; + # check_count=$(($check_count + 1)); + # done; + # echo ------zeebe-ops service available----------- + # sleep 10 + # #Deploy BPMN + # kubectl port-forward service/ph-ee-zeebe-ops 5000:80 -n $NAMESPACE & + # echo "sleeping to get portforwading ready" + # git clone https://github.com/openMF/ph-ee-env-labs.git + # cd ph-ee-env-labs/orchestration/ + # sed -i "/HOST=/c\HOST=http://localhost:5000/zeebe/upload" deployBpmn.sh + # cat deployBpmn.sh + # chmod +x deployBpmn.sh + # cd .. + # timeout 180s sh orchestration/deployBpmn.sh && sleep 5 || echo 'deploy Bpmn done' + # echo ---------------------------successful-------------------------- + # # # curl -o deployBpmn.sh https://raw.githubusercontent.com/openMF/ph-ee-env-labs/master/orchestration/deployBpmn.sh + # # cd helm/bpmn-upload + # # chmod +x deployBpmn.sh + # # sh deployBpmn.sh + + helm-test: + docker: + - image: cimg/python:3.10 + steps: + - checkout + - aws-cli/setup: + role_arn: "${AWS_CIRCLECI_ROLE_ARN}" + region: AWS_REGION + profile_name: "playground" + role_session_name: deploy-test + session_duration: '1800' + - kubernetes/install-kubectl + - run: + name: Update kubeconfig + command: | + aws eks update-kubeconfig --name ${EKS_CLUSTER} + - helm/install-helm-client: + version: "v3.8.2" + - run: + name: Run Helm Tests + command: | + helm test g2p-sandbox --filter name=g2p-sandbox-test-gov --namespace paymenthub || echo test + + - run: + name: Fetch Integration Test Report + command: | + #!/bin/bash + mkdir -p integration_report/test-report + + echo "Fetch Integration Test Report for GOV" + kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-gov |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report + # Specify the path to the downloaded file + downloaded_file="integration_report/test-report/cucumber.xml" + # Loop until the file is not empty + while [ ! -s $downloaded_file ]; do + echo "File is empty, waiting..." + sleep 60 # You can adjust the sleep interval as needed + kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-gov |cut -d " " -f1`:/ph-ee-connector-integration-test/build/ integration_report/test-report + downloaded_file="integration_report/test-report/cucumber.xml" + done + echo "File is no longer empty, processing..." + mv integration_report/test-report/cucumber.xml integration_report/test-report/cucumber_gov.xml + mv integration_report/test-report/reports/tests/test integration_report/test-report/reports/tests/test_gov + + mkdir -p integration_report_final + cp integration_report/test-report/cucumber_gov.xml integration_report_final/ || echo "" + cp integration_report/test-report/cucumber_ams.xml integration_report_final/ || echo "" + + ls integration_report/test-report/ + # kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-gov |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report + for i in $(kubectl get pods -n paymenthub |cut -d " " -f1|tail -n +2); do + echo "--------------------------------------------------------------------Logs of $i Start---------------------------------------------------------------------------" >> all_pod_logs.log + kubectl logs -n paymenthub $i --all-containers=true >> all_pod_logs.log + echo "---------------------------------------------------------------------Logs of $i End----------------------------------------------------------------------------" >> all_pod_logs.log + echo " " >> all_pod_logs.log + echo " " >> all_pod_logs.log + done + mv all_pod_logs.log integration_report/test-report/reports/tests/ + + - store_test_results: + path: integration_report_final/ + - store_artifacts: + path: integration_report/test-report/reports/tests + # - run: + # name: Run Helm Tests + # command: | + # helm test g2p-sandbox --namespace paymenthub || echo test + # - run: + # name: Fetch Integration Test Report + # command: | + # #!/bin/bash + # mkdir -p integration_report/test-report + # kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-connection |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report + + # # Specify the path to the downloaded file + # downloaded_file="integration_report/test-report/cucumber.xml" + + # # Loop until the file is not empty + # while [ ! -s $downloaded_file ]; do + # echo "File is empty, waiting..." + # sleep 60 # You can adjust the sleep interval as needed + # kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-connection |cut -d " " -f1`:/ph-ee-connector-integration-test/build/ integration_report/test-report + # downloaded_file="integration_report/test-report/cucumber.xml " + # done + # echo "File is no longer empty, processing..." + # # kubectl cp paymenthub/`kubectl get pods -n paymenthub | grep g2p-sandbox-test-connection |cut -d " " -f1`:/ph-ee-connector-integration-test/build integration_report/test-report + # # - run: + # # name: Fetch Integration Test Report + # # command: | + # # kubectl cp -n $KUBE_NAMESPACE : ./integration_report # Replace and + # # - run: + # # name: List Contents of Integration Report Directory + # # command: | + # # ls -l /tmp/integration_report + # - store_test_results: + # path: integration_report/test-report/cucumber.xml + # - store_artifacts: + # path: integration_report/test-report/reports/tests/test + # # path: integration_report/test-report/reports/tests/test + # # - store_test_results: + # # path: integration_reports/test-report/cucumber.xml + # # - store_artifacts: + # # path: ph-ee-integration-test/build/reports/tests/test workflows: - test_everything: + deploy: jobs: - test-harness/create-config: post-steps: # Persist to workspace has to be defined in main workflow @@ -13,6 +266,43 @@ workflows: root: workspace paths: - generated.yml + context: # CircleCI context containing AWS credentials + - AWS + - playground - test-harness/execute-tests: requires: - - test-harness/create-config + - test-harness/create-config + context: # CircleCI context containing AWS credentials + - AWS + - playground + - deploy-g2psandbox-govstack-chart: + context: # CircleCI context containing AWS credentials + - AWS + - playground + - deploy-fineract-helm-chart: + context: + - AWS + - playground + # - create-secret: + # requires: + # - deploy-g2psandbox-govstack-chart + # - deploy-fineract-helm-chart + # context: + # - AWS + # - playground + # - deploying-bpmns: + # requires: + # - deploy-g2psandbox-govstack-chart + # - deploy-fineract-helm-chart + # context: + # - AWS + # - playground + - helm-test: + context: + - AWS + - playground + # requires: + # - create-secret + # - deploying-bpmns + + diff --git a/examples/README.md b/examples/README.md index d28678d..c385d9c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -37,4 +37,7 @@ your own secrets, then start up via docker compose. 2. `curl -k https://localhost/processes/14` 3. `curl -k -X POST https://localhost/processes/14/start` 4. `curl -k https://localhost/instances` -5. `curl -k https://localhost/instances/12` \ No newline at end of file +5. `curl -k https://localhost/instances/12` + +## deployment and config script for govstack BB-payment sandbox +1. \ No newline at end of file diff --git a/helm/.DS_Store b/helm/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/helm/.DS_Store differ diff --git a/helm/bpmn-upload/deployBpmn.sh b/helm/bpmn-upload/deployBpmn.sh new file mode 100644 index 0000000..52589f4 --- /dev/null +++ b/helm/bpmn-upload/deployBpmn.sh @@ -0,0 +1,28 @@ +#!/bin/sh +$HOST= "kubectl port-forward service/ph-ee-zeebe-ops 5000:80 -n paymenthub" +HOST="$HOST/zeebe/upload" +deploy(){ + cmd="curl --insecure --location --request POST $HOST \ + --header 'Platform-TenantId: gorilla' \ + --form 'file=@\"$PWD/$1\"'" + echo $cmd + eval $cmd + #If curl response is not 200 it should fail the eval cmd + + cmd="curl --insecure --location --request POST $HOST \ + --header 'Platform-TenantId: rhino' \ + --form 'file=@\"$PWD/$1\"'" + echo $cmd + eval $cmd + #If curl response is not 200 it should fail the eval cmd +} + +LOC=https://github.com/openMF/ph-ee-env-labs/tree/master/orchestration/feel/*.bpmn +for f in $LOC; do + deploy $f +done + +LOC2=https://github.com/openMF/ph-ee-env-labs/tree/master/orchestration/feel/example/*.bpmn +for f in $LOC2; do + deploy $f +done \ No newline at end of file diff --git a/helm/govstack-chart/Chart.yaml b/helm/govstack-chart/Chart.yaml index e8204c9..1d27c21 100644 --- a/helm/govstack-chart/Chart.yaml +++ b/helm/govstack-chart/Chart.yaml @@ -8,5 +8,5 @@ appVersion: 1.1.0 dependencies: - name: ph-ee-g2psandbox - repository: https://fynarfin.io/images/ph-ee-g2psandbox-1.2.0 - version: 1.2.0 + repository: https://fynarfin.io/images/ph-ee-g2psandbox-1.5.0/ + version: 1.5.0 diff --git a/helm/govstack-chart/config/application-tenants.properties b/helm/govstack-chart/config/application-tenants.properties index dc9bc2e..07b0865 100644 --- a/helm/govstack-chart/config/application-tenants.properties +++ b/helm/govstack-chart/config/application-tenants.properties @@ -1,6 +1,8 @@ -bpmns.tenants[0].id= "lion" -bpmns.tenants[0].flows.payment-transfer= "mock_payment_transfer-{dfspid}" -bpmns.tenants[1].id= "rhino" -bpmns.tenants[1].flows.payment-transfer= "MockPayerFundTransfer-{dfspid}" -bpmns.tenants[2].id= "gorilla" -bpmns.tenants[2].flows.payment-transfer= "PayerFundTransfer-{dfspid}" \ No newline at end of file +bpmns.tenants[0].id= lion +bpmns.tenants[0].flows.payment-transfer= minimal_mock_fund_transfer_account_lookup-{dfspid} +bpmns.tenants[1].id= rhino +bpmns.tenants[1].flows.payment-transfer= minimal_mock_fund_transfer-{dfspid} +bpmns.tenants[1].flows.outbound-transfer-request= minimal_mock_transfer_request-{dfspid} +bpmns.tenants[2].id= gorilla +bpmns.tenants[2].flows.payment-transfer= PayerFundTransfer-{dfspid} +bpmns.tenants[2].flows.outbound-transfer-request= {ps}_flow_{ams}-{dfspid} \ No newline at end of file diff --git a/helm/govstack-chart/values.yaml b/helm/govstack-chart/values.yaml index 6879aac..7e28193 100644 --- a/helm/govstack-chart/values.yaml +++ b/helm/govstack-chart/values.yaml @@ -1,6 +1,6 @@ ph-ee-g2psandbox: ph-ee-engine: - + zeebe-cluster-helm: enabled: true @@ -10,24 +10,26 @@ ph-ee-g2psandbox: enabled: true zeebe-operate-helm: + enabled: true ingress: enabled: false - + kibana: + enabled: true ingress: - enabled: false + enabled: false + + #operations: - operations: - ph_ee_connector_ams_mifos: enabled: true - image: docker.io/openmf/ph-ee-connector-ams-mifos:v1.3.0 + image: docker.io/openmf/ph-ee-connector-ams-mifos:v1.7.0 ingress: - enabled: false + enabled: false ph_ee_connector_mojaloop: enabled: true - image: docker.io/openmf/ph-ee-connector-mojaloop:v1.2.0 + image: docker.io/openmf/ph-ee-connector-mojaloop:v1.5.0 ingress: enabled: false @@ -35,93 +37,104 @@ ph-ee-g2psandbox: channel: enabled: true - image: docker.io/openmf/ph-ee-connector-channel:v1.6.1 + image: docker.io/openmf/ph-ee-connector-channel:v1.11.0 operations: - url: "http://ops-bk.sandbox.fynarfin.io/api/v1" + url: "http://ph-ee-operations-app:80/api/v1" server: ssl: keyPassword: "password" - keyStorePassword: "password" + keyStorePassword: "password" ingress: enabled: false - + operations_app: enabled: true - image: docker.io/openmf/ph-ee-operations-app:v1.5.0 + image: docker.io/openmf/ph-ee-operations-app:v1.17.1 tenants: "rhino,gorilla" ingress: enabled: false operations_web: - enabled: true - image: docker.io/openmf/ph-ee-operations-web:v1.3.2 + enabled: true + image: docker.io/openmf/ph-ee-operations-web:v1.20.0 ingress: - enabled: false + enabled: false ph_ee_connector_gsma: enabled: true - image: docker.io/openmf/ph-ee-connector-gsma:v1.0.2 + image: docker.io/openmf/ph-ee-connector-gsma:v1.3.0 ingress: enabled: false ph_ee_connector_slcb: enabled: false - + mpesa: enabled: false - + roster_connector: enabled: false - + paygops_connector: enabled: false - + notifications: enabled: true - image: docker.io/openmf/ph-ee-notifications:v1.0.0 + image: docker.io/openmf/ph-ee-notifications:v1.4.0 NOTIFICATION_FAILURE_ENABLED: "false" ingress: - enabled: false + enabled: false connector_bulk: enabled: true - image: docker.io/openmf/ph-ee-bulk-processor:v1.5.0 + image: docker.io/openmf/ph-ee-bulk-processor:v1.12.0 + LOGGING_LEVEL_ROOT: "DEBUG" tenants: "rhino,gorilla" aws: - region: "us-east-2" + region: "ap-south-1" access_key: "AKIAX32JM37TZOJ5AKFB" secret_key: "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" operations_app: - contactpoint: "https://ops-bk.sandbox.fynarfin.io/" + contactpoint: "http://ph-ee-operations-app:80" endpoints: - batch_transaction: "/api/v1/batch/transactions" + batch_transaction: "/api/v1/batch/transactions" ingress: enabled: false zeebe_ops: enabled: true - image: docker.io/openmf/ph-ee-zeebe-ops:v1.1.0 + image: docker.io/openmf/ph-ee-zeebe-ops:v1.4.0 tenants: "rhino,gorilla" ingress: enabled: false messagegateway: enabled: true - image: docker.io/openmf/message-gateway:v1.0.0 + image: docker.io/openmf/message-gateway:v1.1.0 secret: value: api_key: "eKiC1_JWdKy7eaTGQFHxXXjXjacr60W9Zntl" project_id: "PJ5ff552ce01d2978c" ingress: enabled: false - + importer_es: enabled: true - image: docker.io/openmf/openmf/ph-ee-importer-es:v1.4.0 + image: docker.io/openmf/ph-ee-importer-es:v1.14.0 importer_rdbms: enabled: true - image: docker.io/openmf/ph-ee-importer-rdbms:v1.4.1 + image: docker.io/openmf/ph-ee-importer-rdbms:v1.13.1 + + mockpayment: + enabled: true + image: docker.io/openmf/ph-ee-connector-mock-payment-schema:v1.6.0 + limits: + memory: "1024M" + cpu: "500m" + requests: + memory: "512M" + cpu: "100m" wildcardhostname: "" tls: "" @@ -140,4 +153,17 @@ ph-ee-g2psandbox: enabled: true replica: replicaCount: 0 - \ No newline at end of file + + integration_test: + enabled: true + replicas: 1 + image: docker.io/openmf/ph-ee-integration-test:v1.6.2 + gradle: + command: ./gradlew test -Dcucumber.filter.tags="@gov" + + account_mapper: + image: openmf/ph-ee-identity-account-mapper:v1.6.0 + enabled: true + LOGGING_LEVEL_ROOT: INFO + ingress: + enabled: false