All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
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.
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
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.
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.
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
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
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
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 clusterkubectlgetpods-negovOutput:NAMEREADYSTATUSRESTARTSAGEcitizen-79cf89659c-8glf41/1Running014degov-accesscontrol-78b78dddb9-tfbkf1/1Running021degov-enc-service-574cd7b5b5-hmhh41/1Running036degov-idgen-84954b565b-xsnqj1/1Running045degov-indexer-5f5fbb6f4b-58rtm1/1Running043degov-localization-6cc5977bb9-gm7f91/1Running027degov-mdms-service-65d6d65d8c-t85d91/1Running021degov-user-6676968d76-8n6t61/1Running029degov-workflow-v2-5cdb96bcf5-dcgmf1/1Running036demployee-749464fbfb-tptlh1/1Running014dnginx-ingress-controller-b9678869c-mkslb1/1Running049dpgr-services-b9f4ffdbf-5h5kd1/1Running038dzuul-788bf8cd8b-9nxfl1/1Running041d#Delete the pods so that it gets restarted automaticallykubectldeletepodszuul-788bf8cd8b-9nxflegov-workflow-v2-5cdb96bcf5-dcgmfpgr-services-b9f4ffdbf-5h5kd-negovOutput:pod"zuul-788bf8cd8b-9nxfl"deletedpod"egov-workflow-v2-5cdb96bcf5-dcgmf"deletedpod"pgr-services-b9f4ffdbf-5h5kd"deleted
You have successfully completed the DIGIT Infra, Deployment setup and Installed a DIGIT - PGR module.
Use the below link in browser
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.