DIGIT Urban
PlatformDomainsAcademyDesign SystemFeedback
v2.6
v2.6
  • DIGIT Urban
  • Access DIGIT
  • Architecture
  • Roadmap
  • Release Notes
    • MDMS Configuration & Service Build Updates
    • Test Cases
    • Property Tax Release Notes
    • Citizen Engagement: Documents Feature Release Notes
    • OBPS Release Notes
  • Source Code-Urban Stack
  • 📘Product Docs
    • Products & Modules
      • Trade License (TL)
        • TL Brochure
        • TL Roadmap
        • TL Module Functional Specifications
        • TL Workflows
        • TL Implementation Guide
        • TL Master Data Templates
          • Trade Type
          • Trade Sub Type
          • Trade Category
          • Trade License Fee
          • Structure Sub Type
          • Structure Type
          • Trade License Document Attachment
        • TL Service Configuration
          • Trade License Calculator
        • TL Apply Flow UI Details
          • My Applications UI Flow
          • Send Back - Edit UI Flow
          • Trade License Renewal UI Flow
          • Employee Inbox UI Details
          • Employee Search Application Search License UI Flow
          • New Trade License UI Flow
          • Application Details - Trade Details UI Flows
          • Renew Edit Application
        • TL User Manual
          • Citizen User Manual
          • Employee User Manual
        • TL Demo Script
      • Property Tax
        • PT Brochure
        • PT Roadmap
        • PT Module Functional Specifications
        • PT Workflows
        • PT Implementation Guide
        • PT Master Data Templates
          • Mutation Fee
          • Rebate Rates
          • Penalty Rates
          • Interest Rates
          • Tax Rates
          • Unit Rates
          • Special Category Documents
          • Owner Special Category
          • Ownership Sub Category
          • Ownership Category
          • Usage Category Detail
          • Road Type
          • Construction Type
          • Property Type
          • Property Sub Type
          • Usage Category Major
          • Usage Category Minor
          • Usage Category Sub Minor
        • Property Tax Service
          • Property Mutation & Mutation Calculator
          • PT Update Number & Alternate Number
            • Update Primary Mobile Number & Alternate Mobile Number
          • Assessment of Property
          • PT Calculator
          • Fuzzy Search
            • Fuzzy Search Reindexing
        • PT - Create Property UI Details
          • Edit-Update Property
          • Property Tax - My Applications
          • Property Tax - My Properties
          • Property Tax - Quick Pay for Citizen
          • Create Application - Employee UI/UX Revamp
          • Employee Edit Application Flow
          • Employee - Search Property, Property Details Page & Assessment
          • Employee - Inbox & Application Details
          • Employee Inbox (Old UI)
          • Citizen Mutation Flow
          • Employee - Mutation (Ownership Transfer)
        • PT Data Migration
        • PT User Manual
          • Citizen User Manual
          • Employee User Manual
      • Water & Sewerage (W&S)
        • W&S Implementation Guide
        • W&S Module Functional Specifications
        • Water Services
          • Water Calculator Service
          • Sewerage Service
          • Sewerage Calculator Service
        • Sewerage Charges Master Data Templates
          • Sewerage Rates
          • Sewerage Penalty Rates
          • Sewerage Interest Rates
        • Water Charges Master Data Templates
          • Water Rates (Metered)
          • Pipe Size Types
          • Water Source Types
          • Water Rates (Non-Metered)
          • Water Penalty Rates
          • Water Interest Rates
        • W&S User Manual
          • W&S Citizen User Manual
          • W&S Employee User Manual
      • Public Grievances & Redressal (PGR)
        • PGR Brochure
        • PGR Roadmap
        • PGR Module Functional Specifications
        • PGR Workflows
        • PGR Implementation Guide
        • PGR Master Data Templates
          • Grievance Type
          • Grievance Sub Type
        • PGR Service Configuration
          • PGR Migration
        • PGR User Manual
          • Complaint Types List
          • Citizen User Manual
          • Employee User Manual
        • PGR Demo Script
      • Online Building Plan Approval System (OBPAS)
        • OBPAS Brochure
        • OBPAS Module Functional Specifications
        • OBPAS Implementation Guide
        • OBPAS Master Data Templates
          • Fee Structure
          • NOC Departments
          • Stakeholders Type
          • List Of Services
          • Service-Wise Documents
          • Building Occupancy
          • Building Sub Occupancy
          • Building Usage
          • Inspection Checklist
          • Town Planning Schemes
        • OBPAS DIGIT UI
          • Stakeholder - Registration Flow
          • OBPS-BPA/OC-BPA Employee Flow
            • OBPS Inbox
            • OBPS Search Application
          • OBPS-BPA/OC-BPA Architect
          • OBPS EDCR /OC-EDCR
          • OBPS BPA / OCBPA Citizen
          • Employee - Stakeholder
            • Stakeholder Inbox
            • Stakeholder Search Application
        • OBPAS Service Configuration
          • BPA Service Configuration
          • BPA Calculator Service
          • Setting Up eDCR Service
          • eDCR Integration
          • Noc Services
          • Land Services
        • OBPAS Demo Script
        • OBPAS User Manual
          • OBPAS Citizen User Manual
          • OBPAS Employee User Manual
      • mCollect (MCS)
        • mCollect Roadmap
        • mCollect Master Data Templates
          • Service Category
          • Service Sub Category
          • Service Sub Category GL Code Mapping
        • eChallan UI Details
          • Edit - Cancel Challan
          • Search and Pay Challan
          • mCollect UI Flow
          • Update - Cancel Challan UI Flow
          • Challan Creation
        • mCollect User Manual
          • MCS Citizen User Manual
          • MCS Employee User Manual
      • Faecal Sludge Management (FSM)
        • FSM Service Configuration
          • FSM Implementation - Configuration
          • FSM Calculator v1.0
          • FSM Services
          • FSM Vendor Registry v1.0
          • FSM Vehicle Registry v1.0
          • Legacy/Re-Indexing the FSM Data
          • FSM-DSS Technical Documentation
        • FSM User Manual
          • Citizen User Manual
          • Employee User Manual
          • DSO User Manual
          • Septage Treatment Plant Operator User Manual
      • Finance
        • Finance Module Functional Specifications
        • Finance Implementation Guide
        • Finance Master Data Templates
          • Bank Account
          • Chart Of Accounts
          • Funds
          • Function
          • Contractors
          • Suppliers
          • Schemes
          • Sub Schemes
          • Banks
          • Bank Branch
          • Deduction
          • Opening Balances
          • Sub Ledger Category
          • Sub Ledger Master
        • Finance Service Configuration
          • Finance Collections Voucher Consumer Service
        • Finance User Manual
          • Employee User Manual
          • Admin User Manual
          • Finance Reports Manual
      • Fire NOC
        • Fire NOC Master Data Templates
          • Building Usage Type
          • Building Sub Usage Type
          • Fire Station Master
          • Areas Served Master
          • Fire Station Mapping
          • Fire NOC Fee
        • Fire NOC Service
          • Fire NOC Calculator Service
        • Fire NOC User Manual
          • Fire NOC Citizen User Manual
          • Fire NOC Employee User Manual
        • NOC DIGIT UI
          • NOC Inbox
          • Application Overview
      • e-Challan Service
        • eChallan Calculator Services
      • HRMS
        • HRMS Employee Create-Edit UI Flow
        • Employee Details UI Flow
        • Employee Activation-Deactivation UI Flow
        • Search Employee By Multiple Criteria UI Flow
        • HRMS Service
        • Employees Count UI Flow
      • Events And Notifications
        • Citizen Flow
        • Employee Flow - Events
        • Employee Flow - Messages
      • Citizen Engagement Module
        • Documents: Implementation Details
      • Current Bill Cancellation UI Flow
        • Bill Details UI Flow
        • Cancel Bill UI Flow
      • Receipt Cancellation UI Flow
        • View Receipt - Cancel UI Flow
      • Auto Escalation UI Flow
      • DSS UI Flow
      • Product FAQs
  • Training Resources
    • Open Events
    • Training Videos
    • Technical Enablement Areas
    • eDCR Training Plan
  • Partner Support
    • eGov Enablement Support for DIGIT
    • Security Guidelines Handbook
    • Troubleshooting Guide
  • ⏹️Setup
    • Quickstart
      • 1. Infra Setup
      • 2. Deployment
      • FAQ
    • Full Installation
      • On AWS
        • 1. Pre-requisites
        • 2. Understanding EKS
        • 3. Setup AWS account
        • 4. Infra-as-code (Terraform)
        • 5. Prepare Deployment Config
        • 6. Deploy DIGIT
        • 7. Bootstrap DIGIT
        • FAQ
      • On Azure
        • 1. Pre-requisites
        • 2. Understanding AKS
        • 3. Infra-as-code (Terraform)
      • On GCP
      • On SDC
      • On NIC
    • Open Source Tools used in DIGIT
    • Productionize DIGIT
      • scaling
        • Horizontally Scale DIGIT Services
    • Learn More
      • Setup Requirements
        • Tech Enablement Training - Essential Skills and Pre-requisites
        • Tech Enablement Training (eDCR) - Essential Skills and Prerequisites
        • DIGIT Rollout Program Governance
        • DevOps Skills Requirements
        • Infra Requirements
        • Team Composition for DIGIT Implementation
        • Infra Best Practices
        • Operational Best practices
        • Why Kubernetes for DIGIT
      • Supported Clouds
        • Google Cloud
        • Azure
        • AWS
        • VSphere
        • SDC
        • NIC
      • Deployment - Key Concepts
        • Security Practices
        • CI/CD
        • Readiness & Liveness
        • Resource Requests & Limits
      • Understanding ERP Stack
        • ERP Monolithic Architecture
        • ERP Hybrid Architecture
        • ERP Coexistence Architecture
        • APMDP-HYBRID-INFRA-ARCHITECTURE
        • eGov SmartCity eGovernance Suite
        • ERP Deployment Process
        • ERP Release Process
        • ERP User Guide
      • Deploying DIGIT Services
        • Deployment Architecture
        • Routing Traffic
        • Backbone Deployment
      • Troubleshooting
        • Distributed Tracing
        • Logging
        • Monitoring & Alerts
  • 🫐Configure
    • Configure DIGIT
      • Git Repos
      • Setting up DIGIT
        • Configuring InfraOps
        • Setting up DIGIT Environment
        • Email And SMS Setup
        • FileStore Setup
        • Setting Up SSL Certificate
        • Periodic Log Cleanup
      • Setting up Master Data
        • MDMS Overview
        • Configuring Tenants
        • Configuring Master Data
        • Adding New Master
        • State Level Vs City Level Master
      • Master Data Collection Templates
        • Environment Setup
          • State Level Setup
            • Tenants Information
            • SMS Account Configuration
            • Email Account Configuration
            • Google Play Store Account
            • Payment Gateway Configuration
            • POS Integration Configuration
            • Domain Name Configuration
            • SSL Configuration
            • ULB Departments
            • ULB Designations
            • Localization
            • Google Map Configuration
          • ULB Level Setup
            • Boundary Hierarchies
            • Boundary Data
            • Cross Hierarchy Mapping
            • ULB Bank Accounts
        • Module Setup
          • Web Portals Templates
            • State Portal
            • ULB Portal
          • HRMS Data Templates
            • User Roles
            • System Users
          • Billing And Payments Data Templates
            • Tax Heads
            • Receipt Format
            • Demand Bill Format
          • DSS Data Templates
            • KPI Acceptance
          • Workflow Data Templates
            • Workflow Actions
            • Workflow Levels
            • Workflow Process
            • Workflow Notifications
          • Common Configuration Details
            • Standard Document List
            • Service Document Mapping
            • Checklist
            • Configuring Data FAQs
      • Configuring DIGIT Service Stack
        • Core Services
          • Workflow Services
          • Location Services
          • User Services
          • Access Control Services
          • PDF Generation Service
          • MDMS (Master Data Management Service)
          • Payment Gateway Service
          • NLP Engine Service
          • User Session Management In DIGIT
          • Indexer Service
          • URL Shortening Service
          • XState Core Chatbot
            • XState-Chatbot Integration Document
            • Xstate-Chatbot Message Localisation
        • Business Service
          • Appropriation Service
          • Billing Service
            • Bill Amendment Service Configuration
          • Collection Service
            • Collection Service Migration
            • Collection Service V2
          • Billing Collection Integration
          • Dashboard Analytics - Backend
          • DSS Technical Documentation
          • DSS Dashboard - Technical Document for UI
          • DSS Features Enhancements
          • Technical Script/Steps For Migration Process
          • Bill Amendment
        • Municipal Service
          • Turn-Io-Adapter
          • Inbox Service
        • Utilities
      • Configuring Services
        • Persister Configuration
        • Indexer Configuration
        • Setting up a Language
          • Adding New Language
          • Setting Up Default Language For SMS & Emails
        • API Dos and Don'ts
        • Setting Up SMS Gateway
          • Using The Generic GET & POST SMS Gateway Interface
        • Setting Up Service Locally
        • Configuring Workflows
          • Setting Up Workflows
          • Configuring Workflows For An Entity
          • Workflow Auto Escalation
        • DSS Configuration And Setup
          • Building New Dashboards
        • Configuring New Reports
          • Types Of Reports Used In Report Service
          • Impact Of Heavy Reports On Platform
        • Adding Roles To System
        • Mapping Roles With APIs
        • Deployment Of App on Play Store
        • Adding New APIs For Access
        • FileStore Service
        • Telemetry Service
        • Report Service
        • ID Generation Service
        • Localization Service
        • Email Notification Service
        • SMS Notification Service
        • SMS Template Approval Process
        • Searcher Service
        • Zuul Service
        • User OTP Service
        • eGov OTP Service
        • Persister Service
        • Encryption Service
        • Document Uploader Service
        • Notification Enhancement Based on Different Channels
        • Configuring Localization
          • Setup Base Product Localization
          • Configure SMS and Email
        • DIGIT: Internal Datamart Deployment Steps
        • Customizing PDF Notices And Certificates
          • Integration Of PDF In UI For Download And Print PDF
          • Customizing PDF Receipts & Certificates
      • QA Automation
        • Kafka Consumer Producer Approach
        • Jenkins Setup for Automation
        • Automation Framework Knowledge Base
          • Automation Test Tags
          • Automation Test Reporting
        • State-Level UI Customization
      • Configuration FAQs
    • CI/CD SetUp
      • CI/CD Build Job Pipeline Setup
  • 🛃Customize
    • Customize DIGIT
      • Frontend/UI
      • DIGIT Customization
        • API Do's & Don'ts
        • Writing A New Customer
        • Enhancing Existing Service
Powered by GitBook

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

On this page
  • Prerequisites
  • CI/CD Cluster Setup
  • Understand the Resource Graph in Terraform script:
  • Custom variables/configurations:
  • Important: Create your own keybase key before you run the terraform
  • Run terraform
  • 2. Jenkins Deployment
  • Prerequisites:

Was this helpful?

Edit on GitHub
Export as PDF
  1. Configure

CI/CD SetUp

CI/CD setup

PreviousConfiguration FAQsNextCI/CD Build Job Pipeline Setup

Last updated 2 years ago

Was this helpful?

Prerequisites

  1. GitHub Organization account

  2. the belo repo's to your GitHub Organization account 1. and 2.

  3. (version 1.13.X)

  4. ​ with the admin access to provision EKS Service, you can always subscribe to free AWS account to learn the basics and try, but there is a limit to , for this demo you need to have a commercial subscription to the EKS service, if you want to try out for a day or two, it might cost you about Rs 500 - 1000. (Note: Post the Demo, for the internal folks, eGov will provide a 2-3 hrs time bound access to eGov's AWS account based on the request and available number of slots per day)

  5. Install on your local machine that helps you interact with the kubernetes cluster

  6. Install that helps you package the services along with the configurations, envs, secrets, etc into a

  7. Install version (0.14.10) for the Infra-as-code (IaC) to provision cloud resources as code and with desired resource graph and also it helps to destroy the cluster at one go.

  8. ​ on your local machine so that you can use aws cli commands to provision and manage the cloud resources on your account.

  9. Install that helps you authenticate your connection from your local machine so that you should be able to deploy DIGIT services.

  10. Use the credentials provided for the Terraform () to connect with your AWS account and provision the cloud resources.

    ​

    1. You'll get a Secret Access Key and Access Key ID. Save them safely.

    2. Open the terminal and Run the following command you have already installed the AWS CLI and you have the credentials saved. (Provide the credentials and you can leave the region and output format as blank)

    aws configure --profile cicd-infra-account 
    
    AWS Access Key ID []:<Your access key>
    AWS Secret Access Key []:<Your secret key>
    Default region name []: ap-south-1
    Default output format []: text
    1. The above will create the following file In your machine as /Users/.aws/credentials

    [cicd-infra-account] 
    aws_access_key_id=*********** 
    aws_secret_access_key=****************************

CI/CD Cluster Setup

Before we provision the cloud resources, we need to understand and be sure about what resources need to be provisioned by terraform to deploy CI/CD.

The following is the resource graph that we are going to provision using terraform in a standard way so that every time and for every env, it'll have the same infra.

  • EKS Control Plane (Kubernetes Master)

  • Work node group (VMs with the estimated number of vCPUs, Memory)

  • EBS Volumes (Persistent Volumes)

  • VPCs (Private network)

  • Users to access, deploy and read-only

Understand the Resource Graph in Terraform script:

  • Here we have already written the terraform script that provisions the production-grade DIGIT Infra and can be customized with the specified configuration.

git clone --branch release https://github.com/egovernments/DIGIT-DevOps.git
cd DIGIT-DevOps/infra-as-code/terraform


└── modules
    ├── kubernetes
    │   └── aws
    │       ├── eks-cluster
    │       │   ├── main.tf
    │       │   ├── outputs.tf
    │       │   └── variables.tf
    │       ├── network
    │       │   ├── main.tf
    │       │   ├── outputs.tf
    │       │   └── variables.tf
    │       └── workers
    │           ├── main.tf
    │           ├── outputs.tf
    │           └── variables.tf
    └── storage
        └── aws
            ├── main.tf
            ├── outputs.tf
            └── variables.tf

In here, you will find the main.tf under each of the modules that has the provisioning definition for resources like EKS cluster, and Storage, etc. All these are modularized and reacts as per the customized options provided.

Example:

  • VPC Resources:

    • VPC

    • Subnets

    • Internet Gateway

    • Route Table

  • EKS Cluster Resources:

    • IAM Role to allow EKS service to manage other AWS services

    • EC2 Security Group to allow networking traffic with EKS cluster

    • EKS Cluster

  • EKS Worker Nodes Resources:

    • IAM role allowing Kubernetes actions to access other AWS services

    • EC2 Security Group to allow networking traffic

    • Data source to fetch latest EKS worker AMI

    • AutoScaling Launch Configuration to configure worker instances

    • AutoScaling Group to launch worker instances

  • Storage Module

    • Configuration in this directory creates EBS volume and attaches it together.

  • The following main.tf with create s3 bucket to store all the state of the execution to keep track

  • DIGIT-DevOps/Infra-as-code/terraform/egov-cicd/remote-state
    
    [**main.tf**](https://github.com/egovernments/DIGIT-DevOps/blob/release/infra-as-code/terraform/egov-cicd/remote-state/main.tf)\*\*\*\*
provider "aws" {
  region = "ap-south-1"
}

#This is a bucket name that you can name as you wish
resource "aws_s3_bucket" "terraform_state" {
  bucket = "try-cicd-workshop-yourname" 

  versioning {
    enabled = true
  }

  lifecycle {
    prevent_destroy = true
  }
}

#This is a bucket name that you can name as you wish
resource "aws_dynamodb_table" "terraform_state_lock" {
  name           = "try-cicd-workshop-yourname"
  read_capacity  = 1
  write_capacity = 1
  hash_key       = "LockID"

  attribute {
    name = "LockID"
    type = "S"
  }
}
  1. The following main.tf contains the detailed resource definitions that need to be provisioned, please have a look at it.

    Dir: DIGIT-DevOps/Infra-as-code/terraform/egov-cicd

terraform {
  backend "s3" {
    bucket = "try-cicd-workshop-yourname"
    key = "terraform"
    region = "ap-south-1"
  }
}

module "network" {
  source             = "../modules/kubernetes/aws/network"
  vpc_cidr_block     = "${var.vpc_cidr_block}"
  cluster_name       = "${var.cluster_name}"
  availability_zones = "${var.network_availability_zones}"
}

module "iam_user_deployer" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-user"

  name          = "${var.cluster_name}-kube-deployer"
  force_destroy = true  
  create_iam_user_login_profile = false
  create_iam_access_key         = true

  # User "egovterraform" has uploaded his public key here - https://keybase.io/egovterraform/pgp_keys.asc
  pgp_key = "${var.iam_keybase_user}"
}

module "iam_user_admin" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-user"

  name          = "${var.cluster_name}-kube-admin"
  force_destroy = true  
  create_iam_user_login_profile = false
  create_iam_access_key         = true

  # User "egovterraform" has uploaded his public key here - https://keybase.io/egovterraform/pgp_keys.asc
  pgp_key = "${var.iam_keybase_user}"
}

module "iam_user_user" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-user"

  name          = "${var.cluster_name}-kube-user"
  force_destroy = true  
  create_iam_user_login_profile = false
  create_iam_access_key         = true

  # User "test" has uploaded his public key here - https://keybase.io/test/pgp_keys.asc
  pgp_key = "${var.iam_keybase_user}"
}

data "aws_eks_cluster" "cluster" {
  name = "${module.eks.cluster_id}"
}

data "aws_eks_cluster_auth" "cluster" {
  name = "${module.eks.cluster_id}"
}
provider "kubernetes" {
  host                   = "${data.aws_eks_cluster.cluster.endpoint}"
  cluster_ca_certificate = "${base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)}"
  token                  = "${data.aws_eks_cluster_auth.cluster.token}"
  load_config_file       = false
  version                = "~> 1.11"
}

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  cluster_name    = "${var.cluster_name}"
  cluster_version = "${var.kubernetes_version}"
  subnets         = "${concat(module.network.private_subnets, module.network.public_subnets)}"

  tags = "${
    map(
      "kubernetes.io/cluster/${var.cluster_name}", "owned",
      "KubernetesCluster", "${var.cluster_name}"
    )
  }"

  vpc_id = "${module.network.vpc_id}"

  worker_groups_launch_template = [
    {
      name                    = "spot"
      subnets                 = "${slice(module.network.private_subnets, 0, length(var.availability_zones))}"
      override_instance_types = "${var.override_instance_types}"
      asg_max_size            = "${var.number_of_worker_nodes}"
      asg_desired_capacity    = "${var.number_of_worker_nodes}"
      kubelet_extra_args      = "--node-labels=node.kubernetes.io/lifecycle=spot"
      spot_allocation_strategy= "lowest-price"
      spot_max_price          = "${var.spot_max_price}"
      spot_instance_pools     = 1
      cpu_credits             = "standard"
    },
  ]
  
  map_users    = [
    {
      userarn  = "${module.iam_user_deployer.this_iam_user_arn}"
      username = "${module.iam_user_deployer.this_iam_user_name}"
      groups   = ["system:masters"]
    },
    {
      userarn  = "${module.iam_user_admin.this_iam_user_arn}"
      username = "${module.iam_user_admin.this_iam_user_name}"
      groups   = ["global-readonly", "digit-user"]
    },
    {
      userarn  = "${module.iam_user_user.this_iam_user_arn}"
      username = "${module.iam_user_user.this_iam_user_name}"
      groups   = ["global-readonly"]
    },    
  ]
}

module "jenkins" {

  source = "../modules/storage/aws"
  storage_count = 1
  environment = "${var.cluster_name}"
  disk_prefix = "jenkins-home"
  availability_zones = "${var.availability_zones}"
  storage_sku = "gp2"
  disk_size_gb = "20"
  
}

Custom variables/configurations:

You can define your configurations in variables.tf and provide the env specific cloud requirements so that using the same terraform template you can customize the configurations.

├── egov-cicd
│   ├── main.tf 
│   ├── outputs.tf
│   ├── providers.tf
│   ├── remote-state
│   │   └── main.tf
│   └── variables.tf

Following are the values that you need to mention in the following files, the blank ones will be prompted for inputs while execution.

#
# Variables Configuration
#

variable "cluster_name" {
  default = "<Desired Cluster name>"  #eg: my-digit-cicd
}

variable "vpc_cidr_block" {
  default = "192.168.0.0/16"
}

variable "network_availability_zones" {
  default = ["ap-south-1b", "ap-south-1a"]
}

variable "availability_zones" {
  default = ["ap-south-1b"]
}

variable "kubernetes_version" {
  default = "1.18"
}

variable "instance_type" {
  default = "t3a.xlarge"
}

variable "override_instance_types" {
  default = ["t3.xlarge", "r5ad.xlarge", "r5a.xlarge", "t3a.xlarge"]
}

variable "number_of_worker_nodes" {
  default = "1"
}

variable "spot_max_price" {
  default = "0.0538"
}

variable "ssh_key_name" {
  default = "egov-cicd"
}
variable "iam_keybase_user" {
  default = "keybase:egovterraform"
}

Important: Create your own keybase key before you run the terraform

Run terraform

Now that we know what the terraform script does, the resources graph that it provisions and what custom values should be given with respect to your env.

Let's begin to run the terraform scripts to provision infra required to Deploy DIGIT on AWS.

  1. First CD into the following directory and run the following command 1-by-1 and watch the output closely.

cd DIGIT-DevOps/infra-as-code/terraform/egov-cicd/remote-state
terraform init
terraform plan
terraform apply


cd DIGIT-DevOps/infra-as-code/terraform/egov-cicd
terraform init
terraform plan
terraform apply

Upon Successful execution following resources gets created which can be verified by the command "terraform output"

  • s3 bucket: to store terraform state.

  • Network: VPC, security groups.

  • EKS cluster: with master(s) & worker node(s).

  • Storage(s): for es-master, es-data-v1, es-master-infra, es-data-infra-v1, zookeeper, kafka, kafka-infra.

aws sts get-caller-identity

# Run the below command and give the respective region-code and the cluster name
aws eks --region <region-code> update-kubeconfig --name <cluster_name>
  1. Finally, Verify that you are able to connect to the cluster by running the following command

kubectl config use-context <your cluster name>

kubectl get nodes

NAME                                             STATUS AGE   VERSION               OS-Image           
ip-192-168-xx-1.ap-south-1.compute.internal   Ready  45d   v1.18.10-eks-bac369   Amazon Linux 2   

Whola! All set and now you can go Deploy Jenkins...

2. Jenkins Deployment

Post infra setup (Kubernetes Cluster), We start with deploying the Jenkins and kaniko-cache-warmer.

Prerequisites:

  • Sub Domain to expose CI/CD URL

  • SSL Certificate for the sub-domain

  • KubeConfig env's name and deploymentJobs name from ci.yaml should be the same

  • SSL Certificate for the sub-domain

cd DIGIT-DevOps/tree/release/deploy-as-code
kubectl config use-context <your cluster name>
go run main.go deploy -c -e ci 'jenkins,kaniko-cache-warmer,nginx-ingress,cert-manager'

You have launch the Jenkins, Same you can access through your sub-domain which you configured in ci.yaml

helps you build a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, Terraform builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure.

Ideally, one would write the terraform script from the scratch using this .

Let's Clone the where the terraform script to provision EKS cluster is available and below is the structure of the files.

****

Use this URL to , this will create both public and private key in your machine, upload the public key into the account that you have just created, and give a name to it and ensure that you mention that in your terraform. This allows to encrypt all the sensitive information.

Example user keybase user in eGov case is "egovterraform" needs to be created and has to uploaded his public key here -

you can use this to Decrypt your secret key. To decrypt PGP Message, Upload the PGP Message, PGP Private Key and Passphrase.

IAM users auth: using keybase to create admin, deployer, the user. Use this URL to , this will create both public and private key in your machine, upload the public key into the account that you have just created, and give a name to it and ensure that you mention that in your terraform. This allows to encrypt all the sensitive information.

Example user keybase user in eGov case is "egovterraform" needs to be created and has to uploaded his public key here -

you can use this to Decrypt your secret key. To decrypt PGP Message, Upload the PGP Message, PGP Private Key and Passphrase.

Use this link to to get the kubeconfig file and being able to connect to the cluster from your local machine so that you should be able to deploy DIGIT services to the cluster.

GitHub

With

(username and password)

Prepare an < and <>, you can name this file as you wish which will have the following configurations.

credentials, secrets (You need to encrypt using and create a ci-secret.yaml separately)

Check and Update ****details (like githuh Oauth app clientId and clientSecret, GitHub user details gitReadSshPrivateKey and gitReadAccessToken etc..)

To create Jenkins namespace mark this true

Add your env's kubconfigs under kubConfigs like

Update the and repo name with your forked repo name and provide read-only access to github user to those repo's.

🫐
Fork
https://github.com/egovernments/DIGIT-DevOps
https://github.com/egovernments/CIOps
AWS KMS
Go lang
SOPS
GitHub user
Docker Hub account
AWS account
what is offered as free
kubectl
Helm
kubernetes manifests
terraform
Install AWS CLI
AWS IAM Authenticator
AWS IAM User
Infra-as-code
Terraform
doc
DIGIT-DevOps GitHub repo
main.tf
variables.tf
https://keybase.io/
create your own PGP key
keybase
https://keybase.io/egovterraform/pgp_keys.asc
portal
https://keybase.io/
create your own PGP key
keybase
https://keybase.io/egovterraform/pgp_keys.asc
portal
get the kubeconfig from EKS
Oauth App
GitHub User ssh key
GitHub user generate a personal read only access token
Docker hub account details
ci.yaml> master config file
ci-secrets.yaml
sops
ci-secrets.yaml
flag
https://github.com/egovernments/DIGIT-DevOps/blob/release/config-as-code/environments/ci-demo-secrets.yaml#L50
CIOps
DIGIT-DevOps