2. Deployment

Deploying DIGIT platform services

DIGIT Deployment on k3d

Now that the Infra set-up is complete, proceed with the DIGIT Deployment. Following tools need to be installed on the machine before proceeding with the DIGIT Services deployment.

What we'll deploy in Quickstart:

  • DIGIT's core platform services

  • Gov Service/s

DIGIT uses golang scripts to simplify the deployment process, an automated way by leveraging helm package manager to deploy the containerized services onto Kubernetes. Ensure that the below prerequisites are met before you proceed.

1. Prerequisites

  1. To install golang (required v1.13.3) follow these links - Linux or Windows or Mac

  2. kubectl is a CLI to connect to the kubernetes cluster from your machine

  3. Install CURL for making api calls

  4. Install Visualstudio IDE Code for better code visualization/editing capabilities

  5. Install Postman to run digit bootstrap scripts

2. Prepare Deployment Configs

  1. Clone the following DIGIT Devops GitRepo, you may need to install git and then run git clone it to your machine.

    • git clone -b quickstart https://github.com/egovernments/DIGIT-DevOps 
  2. After cloning the repo CD into the folder DIGIT-DevOps and type the "code ." command that will open the visual editor and opens all the files from the repo DIGIT-DevOps

    • cd DIGIT-DevOps
      code 
  3. Create your deployment config file, you can use the following template to update if any custom values to be changed (if you know the impact), otherwise, for the quickstart, you can run it as it is), navigate to the following file in your local repo.

    DIGIT-DevOps/deploy-as-code/helm/environments
Deployment config template
global:
   domain: quickstart.local.digit ## Add your Domain Name
   
cluster-configs:
    namespaces:
      create: true #set this flag true for 1st time deployment, will create the respective namespaces.
      values: [ backbone, cert-manager, egov, kafka-cluster, monitoring, playground, zookeeper-cluster ]
    root-ingress:
      cert-issuer: letsencrypt-prod
      serviceName: digit-ui
      appRoot: digit-ui 
    configmaps:
        egov-config:
            data:
                db-host: postgres.egov ## Add db-host name
                db-name: egov_ms ## Add db-name
                db-url: "jdbc:postgresql://postgres.egov:5432/egov_ms" ## example: jdbc:postgresql://egov-demo.postgres.database.azure.com:5432/egov_demo
                domain: "quickstart.local.digit" ## Add your Domain Name
                egov-services-fqdn-name: "http://quickstart.local.digit/" ## Add your Domain Name
                egov-state-level-tenant-id: "pg" ##Add tenant id example: pb
                es-host: "elasticsearch-client-v1.es-cluster"
                es-indexer-host: "http://elasticsearch-client-v1.es-cluster:9200/"
                flyway-locations: "filesystem:/flyway/sql,filesystem:/flyway/seed,filesystem:/flyway/qa"
                kafka-brokers: "kafka.kafka-cluster:9092"
                kafka-infra-brokers: kafka-v2-infra.kafka-cluster:9092
                logging-level-jdbc: "DEBUG"
                mobile-validation-workaround: "true"
                s3-assets-bucket: "(pg-egov-assets|egov-uat-assets)" ## Add s3-assets-bucket name 
                serializers-timezone-in-ist: "true"
                server-tomcat-max-connections: "500"
                server-tomcat-max-threads: "10"
                sms-enabled: "true"
                spring-datasource-tomcat-initialSize: "1"
                spring-datasource-tomcat-max-active: "2"
                spring-jpa-show-sql: "true"
                timezone: Asia/Kolkata
                tracer-errors-provideexceptionindetails: "true"

        egov-service-host:
            data:
                billing-service: http://billing-service.egov:8080/
                collection-services: http://collection-services.egov:8080/
                collection-search-indexer: http://collection-search-indexer.egov:8080/
                dashboard-analytics: http://dashboard-analytics.egov:8080/
                dashboard-ingest: http://dashboard-ingest.egov:8080/
                egov-common-masters: http://egov-common-masters.egov:8080/
                egov-apportion-service: http://egov-apportion-service.egov:8080/
                egf-master: http://egf-master.egov:8080/
                egf-instrument: http://egf-instrument.egov:8080/
                egov-accesscontrol: http://egov-accesscontrol.egov:8080/
                egov-user: http://egov-user.egov:8080/
                egov-location: http://egov-location.egov:8080/
                egov-filestore: http://egov-filestore.egov:8080/
                egov-localization: http://egov-localization.egov:8080/
                egov-idgen: http://egov-idgen.egov:8080/
                egov-otp: http://egov-otp.egov:8080/
                egov-mdms-service: http://egov-mdms-service.egov:8080/
                egov-mdms-create: http://egov-mdms-create.egov:8080/
                egov-enc-service: http://egov-enc-service.egov:8080/
                egov-workflow-v2: http://egov-workflow-v2.egov:8080/
                egov-searcher: http://egov-searcher.egov:8080/
                egov-data-uploader: http://egov-data-uploader.egov:8080/
                egov-indexer: http://egov-indexer.egov:8080/
                egov-hrms: http://egov-hrms.egov:8080/
                es-client: http://elasticsearch-client-v1.es-cluster:9200
                location: http://location.egov:8080/
                property-services: http://property-services.egov:8080/
                pt-calculator-v2: http://pt-calculator-v2.egov:8080/
                pt-services-v2: http://pt-services-v2.egov:8080/
                pdf-service: http://pdf-service.egov:8080/
                report: http://report.egov:8080/
                tl-services: http://tl-services.egov:8080/
                tl-workflow: http://tl-workflow.egov:8080/
                tl-calculator: http://tl-calculator.egov:8080/
                user-otp: http://user-otp.egov:8080/
                ws-calculator: http://ws-calculator.egov:8080/
                ws-services: http://ws-services.egov:8080/
                firenoc-services: http://firenoc-services.egov:8080/
                firenoc-calculator: http://firenoc-calculator.egov:8080/
                egov-user-event: http://egov-user-event.egov:8080/
                sw-services: "http://sw-services.egov:8080/"
                sw-calculator: "http://sw-calculator.egov:8080/"
                bpa-services: "http://bpa-services.egov:8080/"
                bpa-calculator: "http://bpa-calculator.egov:8080/"
                rainmaker-pgr: "http://rainmaker-pgr:8080/"
                egov-user-chatbot: "http://egov-user-chatbot:8080/"
                zuul: "http://zuul:8080/"

nginx-ingress:
  replicas: 1
  controller:
    image:
      repository: egovio/nginx-ingress-controller
      tag: "0.26.1"
  default-backend-service: "egov/nginx"
  namespace: egov
  

employee:
  dashboard-url: "https://dashboard-pbuat.egovernments.org/s/w---s/app/kibana#/dashboard/4e687470-f3c7-11e8-8d09-b151e2b1cf8e?embed=true&_g=(refreshInterval%3A(pause%3A!f%2Cvalue%3A300000)%2Ctime%3A(from%3Anow-15m%2Cmode%3Aquick%2Cto%3Anow))"
  custom-js-injection: |
    sub_filter.conf: "
      sub_filter  '<head>' '<head>
      <script src=https://s3.ap-south-1.amazonaws.com/egov-uat-assets/globalConfigs.js type=text/javascript></script>
      ';"


digit-ui:
  custom-js-injection: |
    sub_filter.conf: "
      sub_filter  '<head>' '<head>
      <script src=https://s3.ap-south-1.amazonaws.com/egov-uat-assets/globalConfigs.js type=text/javascript></script>
      ';"

egov-persister:
  replicas: 1
  images:
    - egovio/egov-persister
  persist-yml-path: "file:///work-dir/configs/egov-persister/pt-mutation-calculator-persister.yml,file:///work-dir/configs/egov-persister/apportion-persister.yml,file:///work-dir/configs/egov-persister/billing-services-persist.yml,file:///work-dir/configs/egov-persister/egf-bill.yaml,file:///work-dir/configs/egov-persister/egov-user-event-persister.yml,file:///work-dir/configs/egov-persister/egov-workflow-v2-persister.yml,file:///work-dir/configs/egov-persister/firenoc_persiter.yaml,file:///work-dir/configs/egov-persister/hrms-employee-persister.yml,file:///work-dir/configs/egov-persister/pdf-generator.yml,file:///work-dir/configs/egov-persister/pg-service-persister.yml,file:///work-dir/configs/egov-persister/pgr.v3.yml,file:///work-dir/configs/egov-persister/property-services.yml,file:///work-dir/configs/egov-persister/pt-calculator-v2-persister.yml,file:///work-dir/configs/egov-persister/pt-drafts.yml,file:///work-dir/configs/egov-persister/pt-persist.yml,file:///work-dir/configs/egov-persister/tl-billing-slab-persister.yml,file:///work-dir/configs/egov-persister/tl-calculation-persister.yml,file:///work-dir/configs/egov-persister/uploader-persister.yml,file:///work-dir/configs/egov-persister/collection-migration-persister.yml,file:///work-dir/configs/egov-persister/property-services-registry.yml,file:///work-dir/configs/egov-persister/tradelicense.yml,file:///work-dir/configs/egov-persister/sewerage-persist.yml,file:///work-dir/configs/egov-persister/water-persist.yml,file:///work-dir/configs/egov-persister/water-meter.yml,file:///work-dir/configs/egov-persister/bpa-persister.yml,file:///work-dir/configs/egov-persister/assessment-persister.yml,file:///work-dir/configs/egov-persister/chatbot.yml,file:///work-dir/configs/egov-persister/land-persister.yml,file:///work-dir/configs/egov-persister/noc-persister.yml,file:///work-dir/configs/egov-persister/pgr-services-persister.yml,file:///work-dir/configs/egov-persister/pgr-migration-batch.yml, file:///work-dir/configs/egov-persister/vehicle-persister.yaml,file:///work-dir/configs/egov-persister/vendor-persister.yaml,file:///work-dir/configs/egov-persister/fsm-calculator-persister.yaml, file:///work-dir/configs/egov-persister/fsm-persister.yaml, file:///work-dir/configs/egov-persister/echallan.yml"
  initContainers:
    gitSync:
      repo: "git@github.com:egovernments/configs"
      branch: "quickstart"

zuul:
  replicas: 1
  memory_limits: "512Mi"
  custom-filter-property: "false"
  tracing-enabled: "true"
  heap: "-Xmx256m -Xms256m"
  server-tomcat-max-threads: "350"
  server-tomcat-max-connections: "1500"
  egov-open-endpoints-whitelist: "/user/oauth/token,/user-otp/v1/_send,/otp/v1/_validate,/user/citizen/_create,/localization/messages,/localization/messages/v1/_search,/user/password/nologin/_update,/pgr/servicedefinition/v1/_search,/pgr/servicecategories/v1/_search,/pgr/v1/otp/_send,/pgr-master/receivingmode/v1/_search,/tenant/v1/tenant/_search,/egov-location/boundarys,/egov-location/boundarys/boundariesByBndryTypeNameAndHierarchyTypeName,/pgr-master/service/v1/_search,/egov-location/boundarys/getLocationByLocationName,/pgr-master/OTPConfig/_search,/pgr-master/serviceGroup/v1/_search,/egov-location/boundarys/isshapefileexist,/pgr/services/v1/_search,/hr-masters/hrconfigurations/_search,/collection-services/receipts/_view,/pgr-master/service/v2/_search,/pgr-master/servicedefinition/v1/_search,/citizen-services,/citizen-services/v1/requests/receipt/_create,/citizen-services/v1/pgresponse,/citizen-services/v1/requests/anonymous/_search,/egov-mdms-service/v1/_search,/egov-mdms-service/v1/_get,/egov-mdms-service/v1/_reload,/egov-mdms-service/v1/_reloadobj,/egov-location/boundarys/getshapefile,/egov-indexer/index-operations/_index,/egov-indexer/index-operations/_reload,/egov-mdms-service-test/v1/_search,/egov-mdms-create/v1/_update,/egov-mdms-create/v1/_create,/egov-mdms-service-test/v1/_reload,/filestore/v1/files/url,/egov-url-shortening,/whatsapp-webhook/messages,/edcr/rest/dcr/downloadfile,/dashboard-ingest/ingest/upload"
  egov-mixed-mode-endpoints-whitelist: "/pgr/seva/v1/_create,/pgr/seva/v1/_search,/pgr/seva/v1/_count,/workflow/history/v1/_search,/filestore/v1/files/id,/filestore/v1/files,/filestore/v1/files/tag,/egov-common-masters/departments/_search,/pt-property/property/propertytypes/_search,/pt-property/properties/_search,/pt-property/property/usages/_search,/egov-idgen/id/_generate,/egf-masters/financialyears/_search,/egov-common-workflows/process/_start,/egov-common-workflows/process/_search,/egov-common-workflows/tasks,/egov-common-workflows/tasks/{id}/_update,/user/_search,/billing-service/demand/_dues,/billing-service/bill/_generate,/billing-service/demand/_create,/wcms/masters/waterchargesconfig/_search,/wcms/masters/usagetypes/_search,/wcms/masters/pipesizes/_search,/wcms-connection/connection/_getbillingtypes,/wcms-connection/connection/_getconnectiontypes,/wcms/masters/sourcetypes/_search,/wcms/masters/supplytypes/_search,/wcms/masters/storagereservoirs/_search,/wcms/masters/treatmentplants/_search,/wcms/masters/documenttypes-applicationtypes/_search,/wcms/masters/donations/_search,/wcms/masters/nonmeterwaterrates/_search,/wcms-connection/connection/_create,/egov-common-masters/genders/_search,/egov-common-workflows/designations/_search,/access/v1/actions/mdms/_get,/tl-services/v1/BPAREG/_create,/tl-services/v1/BPAREG/_update,/tl-calculator/v1/BPAREG/_getbill,/property-services/property/_search,/billing-service/bill/v2/_search,/egov-location/location/v11/boundarys/_search,/pg-service/transaction/v1/_create,/collection-services/payments/_search,/pdf-service/v1/_create,/billing-service/bill/v2/_fetchbill,/pg-service/transaction/v1/_update,/ws-services/wc/_search,/sw-services/swc/_search,/edcr/rest/dcr/scrutinydetails,/edcr/rest/dcr/occomparison,/egov-pdf/download/PAYMENT/consolidatedreceipt"

4. Add the following entries in your host file /etc/hosts depending on your OS, instructions can be found below.

When you find the host file in your local machine, add the following lines to it, save and close the file.

  • 127.0.0.1 quickstart.local.digit

Those who are using Cloud VM/Instance. Add the below entry to the host file in your local machine/laptop. Replace <Public_IP> with your VM/Instance Public IP.

  • <Public_IP> quickstart.local.digit

3. Deployment

Now we have all the deployments configs ready, we can now run the following command and provide the necessary details asked and this interactive installer will take care of the rest.

  1. Run the deployer go script from the following directory

export KUBECONFIG=<path-to-your-kube_config>

cd DIGIT-DevOps/deploy-as-code/egov-deployer

sudo go run digit_setup.go

#Be prepared for the following questions
1. Do you have the Kubernetes Setup?
2. Provide the path of the intented env kubeconfig file
3. Which version of the DIGIT that you want to install - Choose "Quickstart"
4. What DIGIT Modules that you choose to install
5. All, done, Now do you want to preview the deployment manifests 
6. Are you good to proceed with the DIGIT Installation

All Done.

2. Check all the pods are running and ready using the below command

kubectl get pods -A

Note: If kafka and zookeeper pods go into crashloopbackoff state due to a permission issue, use the below commands.

  • In windows

    1. cd D:\
      wsl chmod -R 777 kube
      kubectl delete pod kafka-0 -n kafka-cluster --kubeconfig=<your_kubeconfig_path>
      kubectl delete pod zookeeper-0 -n zookeeper-cluster --kubeconfig=<your_kubeconfig_path>
  • In Linux/Mac

    1. cd ~
      sudo chmod -R 777 kube
      kubectl delete pod kafka-0 -n kafka-cluster --kubeconfig=<your_kubeconfig_path>
      kubectl delete pod zookeeper-0 -n zookeeper-cluster --kubeconfig=<your_kubeconfig_path>

3. You can now test the Digit application status in the command prompt/terminal by using the below command.

curl -Is http://quickstart.local.digit/employee/login |  head -n 1

OutPut:
HTTP/2 200

Note: Initially pgr-services would be in crashloopbackoff state, but after performing the below Post Deployment Steps pgr-services will start running.

4. Post Deployment Steps

Post deployment, now the application will be accessible from the configured domain.

To try out PGR employee login, Lets create a sample tenant, city, user to login and assign LME employee role through the seed script

  1. We have to do the kubectl port-forwarding of the egov-user service running from kubernetes cluster to your localhost, this will now give you access to egov-user service directly and interact with the api directly.

kubectl port-forward svc/egov-user 8080:8080 -n egov
Output:
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080

2. Seed the sample data

  • Ensure you have the postman to run the following seed data api, if not Install postman on your local

  • Import the following postman collection into the postman and run it, this will have the seed data that enable sample test users and localisation data.

To test the kubernetes operations through kubectl from your local machine, please execute the below commands.

#get the pods running in the cluster
kubectl get pods -n egov

Output:

NAME                                                    READY   STATUS    RESTARTS   AGE
citizen-79cf89659c-8glf4                                1/1     Running   0          14d
egov-accesscontrol-78b78dddb9-tfbkf                     1/1     Running   0          21d
egov-enc-service-574cd7b5b5-hmhh4                       1/1     Running   0          36d
egov-idgen-84954b565b-xsnqj                             1/1     Running   0          45d
egov-indexer-5f5fbb6f4b-58rtm                           1/1     Running   0          43d
egov-localization-6cc5977bb9-gm7f9                      1/1     Running   0          27d
egov-mdms-service-65d6d65d8c-t85d9                      1/1     Running   0          21d
egov-user-6676968d76-8n6t6                              1/1     Running   0          29d
egov-workflow-v2-5cdb96bcf5-dcgmf                       1/1     Running   0          36d
employee-749464fbfb-tptlh                               1/1     Running   0          14d
nginx-ingress-controller-b9678869c-mkslb                1/1     Running   0          49d
pgr-services-b9f4ffdbf-5h5kd                            1/1     Running   0          38d
zuul-788bf8cd8b-9nxfl                                   1/1     Running   0          41d


#Delete the pods so that it gets restarted automatically

kubectl delete pods zuul-788bf8cd8b-9nxfl egov-workflow-v2-5cdb96bcf5-dcgmf pgr-services-b9f4ffdbf-5h5kd -n egov

Output:

pod "zuul-788bf8cd8b-9nxfl" deleted
pod "egov-workflow-v2-5cdb96bcf5-dcgmf" deleted
pod "pgr-services-b9f4ffdbf-5h5kd" deleted

You have successfully completed the DIGIT Infra, Deployment setup and Installed a DIGIT - PGR module.

quickstart.local.digit/employee

Use the below credentials to login into the complaint section

Username: GRO

Password: eGov@4321

City: CITYA

5. Destroying the Setup

While you want to destroy the setup after you have explored/experienced the DIGIT quickstart you can tear down the entire setup using the following instructions

k3d cluster list

OutPut:

NAME          SERVERS   AGENTS   LOADBALANCER
k3s-default   1/1       2/2      true

k3d cluster delete k3s-default

By deleting the cluster it automatically deletes all the DIGIT deployment components and free up the system resources.

Creative Commons LicenseAll content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.

Last updated

​All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.