While Quickstart Guide **would have helped you to get your hands dirty and build the Kubernetes cluster on a local/single VM instance, which you can consider for either local development, or to understand the details involved in infra and deployment.
However, DIGIT is a cloud-native platform at the same time cloud agnostic, depending on the scale and performance running DIGIT on production requires advanced capabilities like HA, DRS, autoscaling, resiliency, etc.. all these capabilities are provided out of the box by the commercial clouds like AWS, Google, Azure, VMware, OpenStack, etc.. and also the private clouds like NIC and few SDCs implemented clouds, all these cloud providers provide the kubernetes-as-a-managed-service that makes the entire infra setup and management seamless and automated, like infra-as-code, config-as-code.
Know the basics of Kubernetes: https://www.youtube.com/watch?v=PH-2FfFD2PU&t=3s
Know the basics of kubectl commands
Know kubernetes manifests: https://www.youtube.com/watch?v=ohSUtEfDefc
Know how to manage env values, secrets of any service deployed in kubernetes https://www.youtube.com/watch?v=OW244LxB4oI
Know how to port forward to a pod running inside k8s cluster and work locally https://www.youtube.com/watch?v=TT3nd5n5Yus
Know sops to secure your keys/creds: https://www.youtube.com/watch?v=DWzJ87KbwxA
Choose you cloud and follow the Instruction to setup a Kubernetes cluster before moving on to the Deployment.
Post infra setup (Kubernetes Cluster), the deployment has got 2 stages and 2 modes. We can see the stages first and then the modes. As part of a sample exercise we can deploy PGR, however deployment steps are similar, just that the prerequisites will have to be configured accordingly.
Stage 1: Prepare an <env.yaml> master config file, you can name this file as you wish which will have the following configurations, this env file need to be in line with your cluster name.
each service global, local env variables
credentials, secrets (You need to encrypt using sops and create a <env>-secret.yaml separately)
Number of replicas/scale of individual services (Depending on whether dev or prod)
mdms, config repos (Master Data, ULB, Tenant details, Users, etc)
sms g/w, email g/w, payment g/w
GMap key (In case you are using Google Map services in your PGR, PT, TL, etc)
S3 Bucket for Filestore
URL/DNS on which the DIGIT will be exposed
SSL Certificate for the above URL
End-points configs (Internal/external)
Stage 2: Run the digit_setup deployment script and simply answer the questions that it asks.
cd DIGIT-DevOps/deploy-as-code/egov-deployergo run digit_setup.go#Be prepared for the following questions1. Do you have the Kubernetes Setup?2. Provide the path of the intented env kubeconfig file3. Which version of the DIGIT that you want to install4. What DIGIT Modules that you choose to install (Choose PGR)5. All, done, Now do you want to preview the deployment manifests6. Are you good to proceed with the DIGIT InstallationAll Done.
All Done, wait and watch for 10 min, you'll have the DIGIT setup completed and the application will be running on the given URL.
Essentially, DIGIT deployment means that we need to generate Kubernetes manifests for each individual service. We use the tool called helm, which is an easy, effective and customizable packaging and deployment solution. So depending on where and which env you initiate the deployment there are 2 modes that you can deploy.
From local machine - whatever we are trying in this sample exercise so far.
Advanced: From CI/CD System like Jenkins - Depending on how you want to setup your CI/CD and the expertise the steps will vary, however here you can find how we have setup CI/CD on Jenkins and the pipelines are created automatically without any manual intervention.
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
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 egovForwarding from 127.0.0.1:8080 -> 8080Forwarding from [::1]:8080 -> 8080
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.
By now we have successfully completed the digit setup on cloud, use the URL that you mentioned in your env.yaml Eg: https://mysetup.digit.org and create a grievance to ensure the PGR module deployed is working fine. Refer the below product documentation for the steps.
Citizen: You can use your default mobile number (9999999999) to signin using the default Mobile OTP 123456.
Employee: Username: GRO and password: [email protected]
Post grievance creation and assignment of the same to LME, capture the screenshot of the same and share it to ensure your setup is working fine.
Post validating the PGR functionality share the API response of the following request to assess the correctness of successful DIGIT PGR Deployment.
Finally, cleanup the DIGIT Setup if you wish, using the following command. This will delete the entire cluster and other cloud resources that were provisioned for the DIGIT Setup.
cd DIGIT-DevOps/infra-as-code/terraform/my-digit-eksterraform destroy
All Done, we have successfully Created infra on Cloud, Deployed Digit, Bootstrapped DIGIT, Performed a Transaction on PGR and Finally Destroyed the cluster.