Prerequisites and local development setup

Before we proceed to prerequisites check, local development setup and actually developing the service, it is advised to go through core concepts of DIGIT - DIGIT Concepts

Prerequisites:

Technical prerequisites -

  • Prior Knowledge of Java/J2EE.

  • Prior Knowledge of Spring Boot.

  • Prior Knowledge of REST APIs and related concepts like path parameters, headers, JSON etc.

  • Prior knowledge of Git

  • PostgreSQL

  • Kafka

  • Following services should be up and running( or else should be pointed to sandbox environment):

    • user

    • MDMS

    • Persister

    • Location

    • Localization

    • Id-Gen

    • Billing-service

    • URL-shortener

Non technical prerequisites -

  • Docker registry should be setup

  • CI/CD pipeline should be setup

Link to setup docker and CI/CD pipeline can be found here - https://docs.digit.org/urban/platform/setup-digit/jenkins-setup

If you are starting off with a fresh linux/windows machine, we will setup a few things before we can start developing a service -

i) Install Git - Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Git can be downloaded from the following link -

Git for windows

Git for linux

ii) Install JDK8 -

JDK8 for windows

JDK8 for linux

iii) Install IDE - For creating SpringBoot/Java applications we recommend using IntelliJ IDE. IntelliJ can be downloaded from the following links -

IntelliJ for windows

IntelliJ for linux

iv) Install Kafka (version 3.2.0 which is the latest version) - Kafka is the messaging queue that DIGIT services use to communicate with each other asynchronously. To install kafka, follow the following links -

Kafka for windows

Kafka for linux

v) Install Postman - Postman is the tool we use to hit and test the APIs exposed by various services that we have. To install postman, follow the following links -

Postman for windows

Postman for linux

vi) Install Kubectl - Kubectl is the tool that we use to interact with services deployed on our sandbox environment.

https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/

https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/

vii) Install aws-iam-authenticator - https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html (This is an optional step, this is applicable only if your sandbox environment is setup on AWS)

viii) Post installation of kubectl, you need to add configuration to allow access to resources present in our sandbox environment. Steps for creation of this config file are a part of the set up guides mentioned above. A sample kubectl config with placeholders is attached for your reference -

apiVersion: v1 clusters: - cluster: certificate-authority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BuWnlPMERQTHJITGoyCkcxZy8vWmZYbmFCT2k3dlZLSXFXUUR6RlltWGkwME9vOEVoalVyMU5sQ3FISnF1dUo3TlRWQWk1cXA0Qm1xWU8KUTBrbTVxTVVHbG9ZdkNmN1lHQWREWTVnWGg4dzFVMVdaNWNub0Q4WWc3aEtlSjRMRzRram1adlNucGZrS3VxNApiVDdUSjEwUEZlWFJkek8xa2FkQ3VMQSttUlg3OEd5WEw0UTZnOFdPUlhOVDYzdXN3MnlpMXVVN1lMTT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= server: https://3201E325058272AA0990C04346DA6E82.yl4.ap-south-1.eks.amazonaws.com name: eks_egov-dev contexts: - context: cluster: eks_egov-dev namespace: egov user: eks_egov-dev name: dev current-context: dev kind: Config preferences: {} users: - name: eks_egov-dev user: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - token - -i - egov-dev command: aws-iam-authenticator env: - name: AWS_ACCESS_KEY value: {AWS_ACCESS_KEY_PLACEHOLDER} - name: AWS_SECRET_ACCESS_KEY value: {AWS_SECRET_ACCESS_KEY_PLACEHOLDER} - name: AWS_REGION value: {AWS_REGION_PLACEHOLDER}

*** NOTE - In case you run into an error stating “error: You must be logged in to the server (Unauthorized)”, try to add sudo before the command. For example, “sudo kubectl get pods”. That should resolve the error.