DIGIT Docs
  • DIGIT Knowledge Base
  • Local Governance
  • ๐Ÿ‘‹Introducing Local Governance
    • Release Notes
      • Master Migration Document
        • DIGIT SAAS Guideline - Central Instance
      • MDMS & Configuration Updates
      • Service Build Updates
      • Test Cases
      • Gate 2 Release Checklist
      • Implementation Checklist
      • Program Roll Out Plan
      • Product Release Notes
        • Property Tax System Release Notes
        • Residential Construction Permit System UI/UX Revamp Release Notes
        • Local Business License Issuing System - Release Notes
        • Water & Sanitation UI/UX Revamp Release Notes
        • Bill Amendment UI/UX Revamp Release Notes
        • Bill Genie UI/UX Revamp Release Notes
        • Birth & Death Reports Release Notes
        • National Dashboard Enhancement Release Notes
        • Survey Release Notes
        • Product Specific Pages Release Notes
  • Local Governance
    • Understanding Local Governance
    • Value Proposition
  • Local Governance Product Suite
    • Local Governance Stack
      • Local Business License Issuing System
        • Local Business License Issuing Module Functional Specifications
        • Local Business License Issuing User Manual
          • Business License - Citizen User Manual
            • Apply For New Trade Licence
            • Renew Trade License
            • View Application Status & Pay
          • Business License - Employee User Manual
            • Create Applications
            • Collect Payment
            • Renew Licence
            • Process Application
              • Verify Documents
              • Field Inspection
              • Approve Applications
          • TL Assessment Quiz
        • Local Business License - Master Data Templates
          • Trade Type
          • Trade Sub Type
          • Trade Category
          • Trade License Fee
          • Structure Type
          • Structure Sub Type
          • Trade License Document Attachment
        • Local Business License Service Configuration
          • Local Business License Issuing Service - Steps To Upload Data
          • Business License Calculator
          • Business License UI Configuration
            • Employee Inbox UI Details
            • Business License Renewal UI Flow
            • Send Back - Edit UI Flow
            • TL Apply Flow UI Details
            • My Applications UI Flow
            • Employee Search Application Search License UI Flow
            • New Trade License UI Flow
            • Application Details - Trade Details UI Flows
            • Renew Edit Application
        • Local Business License Issuing System Implementation Guide
      • Property Tax System
        • Property Tax System - Functional Specifications
        • Property Tax System - Product Requirements Document
          • Property Amalgamation
          • Capital Value System
          • Property Bifurcation
        • Property Tax System User Manual
          • Property Tax System Citizen User Manual
            • Register Property
            • Search & Pay
            • View My Bills
            • View My Payments
            • View My Properties
            • View My Applications
            • Update Property
            • Transfer Property Ownership
            • Update Mobile Number
            • Amalgamate Property
          • Property Tax System Employee User Manual
            • View Employee Inbox
            • Search Property
            • View Property Details
            • Search Application
            • Collect Property Tax
            • View Payment History
            • Register Property
            • Edit Property
            • Assess Property
            • Transfer Property Ownership
            • Edit Application
            • Reopen Application
            • Send Back Applications
            • Send Back To Citizen
            • Verify & Forward
            • Reject Applications
            • Approve Applications
        • Property Tax System 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 System Service Configuration
          • 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
          • Common PT
          • PT Privacy Changes
            • PT - Steps To Configure Privacy
          • PT - Create Property UI Details
            • Edit-Update Property
            • Property Tax - My Applications
            • Property Tax - My Properties
            • Property Tax - Search Applications
            • Property Tax - Quick Pay for Citizen
            • Property Tax - Search And Pay My Bills
            • Property Tax - My Payments
            • 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
        • Property Tax System Implementation Guide
      • Water & Sewerage Connections
        • Water & Sewerage Connections Functional Specifications
        • Water & Sewerage Connections User Manual
          • Water & Sewerage Connections Citizen User Manual
            • Apply For New Connection
            • Pay Application Fees
            • View Application Details
            • Edit Application
            • View Connection Details
            • View Consumption Details
            • Search & Pay
            • View & Pay Bills
            • View Payment Details
            • Apply For Disconnection
          • Water & Sewerage Connections Employee User Manual
            • Apply For New Connections
            • Search Applications/Connections
            • Add Meter Readings
            • Activate New Connections
            • Collect Bill Payments
            • Modify Connection Details
            • Edit Applications
            • Send Applications Back To Citizen
            • Reject Applications
            • Verify & Forward Applications
            • Approve Connections
        • Water Charges Master Data Templates
          • Water Rates (Metered)
          • Pipe Size Types
          • Water Source Types
          • Water Rates (Non-Metered)
          • Water Penalty Rates
          • Water Interest Rates
        • Sewerage Charges Master Data Templates
          • Sewerage Rates
          • Sewerage Penalty Rates
          • Sewerage Interest Rates
        • Water Service Configuration
          • Legacy/Re-Indexing the Water & Sewerage Service
          • State DSS - Water & Sewerage
          • Water Calculator Service
          • Water Service Disconnection
          • Water Disconnection Calculator Service
          • Water & Sewerage Service UI Docs
            • Citizen: Disconnection Application Create
            • Citizen: My Connections
            • Citizen: Create Application
            • Citizen: My Applications
            • Employee: Application Details
            • Employee: Connection Details
            • Employee: Modify Create Flow
            • Employee: Modify Application Details
            • Employee: Disconnection Create Flow
            • Employee: Disconnection Application Details
            • Employee: Ad-hoc Rebate/Penalty & View Breakup
            • Privacy UI
          • Water & Sewerage Reports
          • Workflow Config-Replacement Data
          • Water & Sewerage Privacy Changes
            • W&S - Steps To Configure Privacy
          • Sewerage Service Configuration
            • Sewerage Service Disconnection
            • Sewerage Disconnection Calculator Service
            • Sewerage Calculator Service
        • Water & Sewerage Connections Implementation Guide
      • Citizen Complaint Resolution System
        • Citizen Complaint Resolution Module Functional Specifications
        • Citizen Complaint Resolution System Workflows
        • Complaint Types List
        • Citizen Complaint Resolution User Manual
          • Citizen Complaint Resolution Citizen User Manual
            • File Complaints
            • View/Track Complaints
            • Rate Complaints
            • Reopen Complaints
          • Citizen Complaint Resolution Employee User Manual
            • CSR - File Complaints
            • CSR - Search/Track Complaints
            • CSR - Reopen Complaints
            • GRO - Assign Complaints
            • GRO - Reassign Complaints
            • GRO - Share Complaints
            • GRO - Reject Complaints
            • FME - Request Reassign
            • FME - Resolve Complaints
          • Citizen Complaint Resolution Assessment Quiz
        • Citizen Complaint Resolution System Demo Script
        • Citizen Complaint Resolution System Master Data Templates
          • Grievance Type
          • Grievance Sub Type
          • Routing Matrix
          • Escalation Matrix
        • Citizen Complaint Resolution System Service Configuration
          • Citizen Complaint Resolution System Migration
      • Residential Construction Permit System
        • Residential Construction Permit System User Manual
          • Residential Construction Permit System Citizen User Manual
            • Register Stakeholders
            • View Application Status
            • Request Edits & Approve Applications
            • Make Payment
          • Residential Construction Permit System - Stakeholders User Manual
            • Register Other Stakeholders
            • Submit For DIGIT-DCR Scrutiny
            • Submit For OC Plan Scrutiny
            • Apply For Building Permits for New Construction
            • Apply For Occupancy Certificate
          • Residential Construction Permit System Employee User Manual
            • Send Applications Back To Citizens
            • Reject Application/Revoke Application
            • Verify & Forward Application
            • Prepare Inspection Report
            • Approve/Reject Applications
        • Residential Construction Permit System Demo Script
        • Residential Construction Permit Module Functional Specifications
        • Residential Construction Permit Service Configuration
          • Data Loading Steps For Residential Construction Permit System
          • BPA Service Configuration
          • BPA Stakeholder Registration
          • Legacy/Re-Indexing For OBPS
          • BPA Calculator Service
          • Setting Up eDCR Service
          • eDCR Integration
          • Noc Services
          • Land Services
          • State DSS - OBPS
          • 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
        • Residential Construction Permit 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
        • Residential Construction Permit System Implementation Guide
      • mCollect - Demand-based Revenue Collection
        • mCollect Functional Specifications
        • mCollect User Manual
          • MCS Citizen User Manual
          • MCS Employee User Manual
        • mCollect Service Configuration
          • e-Challan Service
            • e-Challan Calculator Service
          • Re-Indexing The mCollect Service
          • State DSS - mCollect
          • Current Bill Cancellation UI Flow
            • Bill Details UI Flow
            • Cancel Bill UI Flow
          • Receipt Cancellation UI Flow
            • View Receipt - Cancel UI Flow
          • e-Challan UI Details
            • Edit - Cancel Challan
            • Search and Pay Challan
            • mCollect UI Flow
            • Update - Cancel Challan UI Flow
            • Challan Creation
        • mCollect Master Data Templates
          • Service Category
          • Service Sub Category
          • Service Sub Category GL Code Mapping
      • Faecal Sludge Management (FSM)
      • Finance
        • Finance Module Functional Specifications
        • Finance User Manual
          • Finance Employee User Manual
          • Admin User Manual
            • Finance Reports Manual
        • Finance Service Configuration
          • Finance Collections Voucher Consumer Service
        • Bill Genie Service Configuration
          • UI Configuration
            • Group Bills Screen
            • Employee Search Bills
            • Employee Group Bills
            • Employee Download Bill
        • Bill Amendment Service Configuration
          • UI Configuration
            • Employee: Bill Amendment - Create Flow
            • Employee: Bill Amendment - Search, Edit & Resubmit, Approve, Reject & Send-Back Flows
        • Billing And Payments Data Templates
          • Tax Heads
          • Receipt Format
          • Demand Bill Format
        • 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 Implementation Guide
      • Fire Safety Certification (NOC)
        • Fire Safety Certification (NOC) Functional Specifications
        • Fire Safety Certification (NOC) User Manual
          • Fire Safety Certification (NOC) Citizen User Manual
            • Apply For Fire Safety Certificate (NOC)
            • Pay NOC Fees & View Application Status
          • Fire Safety Certification (NOC) Employee User Manual
            • Create New Application
            • View Application Status
            • Forward Applications
            • Reject Applications
            • Refer Applications
            • Send Back Applications
            • Approve Applications
            • Reject Applications
        • Fire Safety Certification (NOC) Service Configuration
          • Re-Indexing the Fire NOC Service
          • State DSS - Fire NOC
          • Fire NOC Calculator Service
          • NOC DIGIT UI
            • NOC Inbox
            • Application Overview
        • Fire Safety Certification (NOC) Master Data Templates
          • Building Usage Type
          • Building Sub Usage Type
          • Fire Station Master
          • Areas Served Master
          • Fire Station Mapping
          • Fire NOC Fee
      • Citizen Engagement Module
        • Consent Form Citizen User Manual
        • Feedback Rating Citizen User Manual
        • Survey
          • Survey User Manual
            • Survey Employee User Manual
            • Surveys Citizen User Manual
          • Survey Service Configuration
            • Help/FAQ Section - Citizen UI
            • Document Uploader Service
        • Documents: Implementation Details
        • Product Specific Pages
        • Citizen Engagement Configuration
          • Service Request
          • Citizen Feedback Service
          • Citizen Feedback UI
          • Citizen Consent Form UI
      • Birth & Death Certificate Issuance
        • Birth & Death Certificate Issuance User Manual
          • Birth & Death Citizen User Manual
          • Birth & Death Employee User Manual
        • Birth & Death Certificate Issuance Service Configuration
          • Birth and Death Service Setup
          • State DSS - Birth and Death
          • Birth and Death: Reports
      • Dashboards & Analytics
        • Dashboards & Analytics User Manual
        • Dashboards & Analytics Functional Specifications
        • Dashboards & Analytics Service Configuration
          • Dashboards - UI Configuration
            • Dashboards - About & FAQs
            • Dashboards - UI Flow
          • New KPIs
          • KPIs: Pendancy, Citizen Feedback & SLA Changes
          • National Dashboards & Analytics Configuration
          • State Dashboards & Analytics Configuration
          • National Dashboard Ingest Service
            • National Dashboard Adaptor Service
          • W&S - National Dashboard
          • Property Tax - National Dashboard
          • Fire NOC - National Dashboard
          • Trade License - National Dashboard
          • OBPS - National Dashboard
          • PGR - National Dashboard
          • mCollect National Dashboard
          • National Dashboard API Performance Testing and Benchmark
          • National Dashboard: Index Creation Steps
        • DSS Configuration And Setup
          • Building New Dashboards
        • DSS Data Templates
          • KPI Acceptance
      • HRMS
        • HRMS Functional Specifications
        • HRMS Service Configuration
          • HRMS UI Configuration
            • HRMS Employee Create-Edit UI Flow
            • Employee Details UI Flow
            • Employee Activation-Deactivation UI Flow
            • Search Employee By Multiple Criteria UI Flow
            • Employees Count UI Flow
            • Auto Escalation UI Flow
        • HRMS Data Templates
          • User Roles
          • System Users
  • Technology
    • Architecture
      • Specifications
    • Building Blocks & Services
    • Security
      • Security Guidelines
  • Setup
    • Implementation Plan
    • Installation
    • Configuration
      • Git Repos
      • 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
          • Workflow Data Templates
            • Workflow Actions
            • Workflow Levels
            • Workflow Process
          • Common Configuration Details
            • Standard Document List
            • Checklist
            • Configuring Data FAQs
      • Configuring DIGIT Service Stack
        • Core Services
        • 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 Features Enhancements
            • DSS Dashboard - Technical Document for UI
            • DSS Technical Documentation
          • Steps For Migration Process
        • Municipal Service
          • Turn-Io-Adapter
          • Inbox Service
      • Configuring Urban Services
        • Central Instance Configuration
          • UI Build Preparation For New Instance
        • Configuring Common Services
          • Deployment Of App on Play Store
          • Mapping Roles With APIs
          • Setting up a Language
            • Adding New Language
            • Setting Up Default Language For SMS & Emails
          • Setting Up Service Locally
          • Adding Roles To System
          • Adding New APIs For Access
          • User Events Services
          • SMS Template Approval Process
          • DIGIT: Internal Datamart Deployment Steps
          • Customizing PDF Notices And Certificates
            • Integration Of PDF In UI For Download And Print PDF
            • Customizing PDF Receipts & Certificates
          • Notification Enhancement For Different Channels
        • Common UI Docs
          • Events & Notifications UI Docs
            • Employee Flow - Events
            • Employee Flow - Messages
            • Citizen Flow
          • Navigation Between Old & New UI
          • User Profile
            • Citizen Profile
            • Employee Profile
            • Employee City Change
          • Update Number & Invalid Number
          • Troubleshoot Using Browser Network Tab
      • QA Automation
        • Kafka Consumer Producer Approach
        • Jenkins Setup for Automation
        • Automation Framework Knowledge Base
          • Automation Test Tags
          • Automation Test Reporting
        • State-Level UI Customization
    • Customization
      • Writing A New Customer
      • Enhancing Existing Service
    • Operational Support
      • eGov Enablement Support
      • Partner Program Guide
  • General
    • Access DIGIT
    • Partner Toolkit
      • Infra Calculator
      • Resource Calculator
    • Training Resources
      • Training Videos
      • Technical Enablement Areas
      • eDCR Training Plan
    • Source Code
    • Roadmap
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
  • Overview
  • Useful Terms
  • Deployment Setup
  • 4. State services
  • Configuration Setup
  • 1. MDMS Data
  • 2. Persister & Indexer
  • 3. PDF
  • 4. Report & Searcher
  • 5. Internal Gateway
  • Development Guide
  • 1. Common Update For All Services
  • 2. Multi-Schema Services List
  • 3. Migration Changes For Multi-Schema Services
  • 4. Code Changes For Multi Schema Services
  • 5. Central Instance Enabled Development

Was this helpful?

Export as PDF
  1. Introducing Local Governance
  2. Release Notes
  3. Master Migration Document

DIGIT SAAS Guideline - Central Instance

Overview

The page assumes that the deployment of the central instance will happen in a Kubernetes-based environment independent of whether itโ€™s a cloud-based or a bare metal deployment with a Kubernetes-based orchestrator. This page lists all types of services available in a DIGIT SAAS package and the steps to deploy, implement, and add a new service.

Useful Terms

Namespace/deployment-space - refers to the Kubernetes namespace or the equivalent by establishing access restrictions.

State/Tenant - A state is a separate entity whose applications and data are separated from the rest by namespaces and schemas in the database.

Deployment Setup

  1. Backbone Services - The backbone services include Kafka, Redis, and Elastic stack. The number of deployments and the namespace where the services will be deployed are taken care of by the deployment manager itself.

  2. State Deployment space - Namespace - In DIGIT SAAS, the private application/deployment space (namespace in K8s & schema in DB) is provided for different tenants (states) when they onboard, the steps to create and provide the same are mentioned in the following document.

  3. Central/Shared Services - In DIGIT SAAS, each new tenant is given a separate namespace, but most use some unmodified out-of-box services provided by DIGIT deployed in a shared space known as the central namespace. These sets of services include some of DIGITโ€™s core services and registries. Among the services mentioned some can never be modified by the state (tenant) actors and some can be modified. In case of any modification, the services should be deployed in their own space.

The above-mentioned services cannot be modified by the state actors and should only be deployed in the central/shared namespace.

4. State services

The services that are by default deployed and run in the state namespaces whether there are modifications or not. Since they have functionalities that are directly related to the specific requirement of the state.

These services can be divided into multiple categories -

Configuration Setup

The DIGIT applications require different types of config setup, they are as follows the MDMS data, persister, indexer, pdf, report, searcher and internal gateway.

1. MDMS Data

The MDMS data is required for the Master data management service to supply the data required by other modules to perform their basic validation and verify the validity of the data. The prescribed format of the same can be found in the application setup. Since the application is deployed in all the namespaces central and state. Each deployment will need its own GitHub repo.

Central MDMS - central MDMS repo

State 1 MDMS - state1 MDMS repo

2. Persister & Indexer

The persister and indexer configuration for all states should be added in a single GitHub repo in the same branch. Since both applications run in a single place. Each state deployment will have to modify their KAFKA topic names with a prefix of their state schema name.

Persister Topic Name
State 1
State 2

save-property

state1-save-property

state2-save-property

update-property

state1-update-property

state2-update-property

3. PDF

The pdf configs have to be added in a separate repository since the format of pdfs printed will change with each different tenant.

4. Report & Searcher

The configs of report and searcher have to be added in the same GIT repo and same branches as the persister and indexer. The additional change that needs to be done here is that their URL should be appended with state schema names like the topic names with persister config.

State 1
State 2

reportName: AssetImmovableRegister

state1_AssetImmovableRegister

state2_AssetImmovableRegister

- name: billswithaddranduser

state1_billswithaddranduser

state2_billswithaddranduser

5. Internal Gateway

Development Guide

The development of any service in DIGIT should be based on this development guide.

1. Common Update For All Services

The following library versions are a minimum requirement before any service can be made central instance compatible.

Changes to pom.xml

  1. Add Tracer 2.1.1 and above

<dependency>
	<groupId>org.egov.services</groupId>
	<artifactId>tracer</artifactId>
	<version>2.1.1-SNAPSHOT</version>
</dependency>
  1. Services-common 1.1.0 and above

<dependency>
	<groupId>org.egov.services</groupId>
	<artifactId>services-common</artifactId>
	<version>1.1.0-SNAPSHOT</version>
</dependency>
  1. MDMS-Client 0.0.4 and above

<dependency>
	<groupId>org.egov</groupId>
	<artifactId>mdms-client</artifactId>
	<version>0.0.4-SNAPSHOT</version>
</dependency>
  1. ENC-Client 2.04 and above

<dependency>
	<groupId>org.egov</groupId>
	<artifactId>enc-client</artifactId>
	<version>2.0.4-SNAPSHOT</version>
	<exclusions>
		<exclusion>
			<groupId>org.springframework.kafka</groupId>
			<artifactId>spring-kafka</artifactId>
		</exclusion>
		<exclusion>
			<groupId>org.apache.kafka</groupId>
			<artifactId>kafka-clients</artifactId>
		</exclusion>
	</exclusions>
</dependency>

2. Multi-Schema Services List

The following document helps to make multi-environment applications (Services which will run in the DIGIT namespace but store their data in state-specific namespaces of DB based on tenant-id) central instance compatible. These services include the likes of -

  1. Billing-service

  2. Collection-service

  3. workflow-service

  4. egov-apportion-service

  5. egov-hrms

  6. All the municipal registries

  7. Property-services

  8. TL-services

  9. PGR-services

  10. bpa-services

  11. echallan-services

  12. firenoc-services

  13. land-services

  14. noc-services

  15. sw-services

  16. ws-services

Any service that needs to share its data among multiple DB schemas can be added to the above category.

3. Migration Changes For Multi-Schema Services

Certain services in the Central-instance will only be deployed in the central (DIGIT) namespace but their data needs to be stored in different schema belonging to different state namespaces. The migrations of foretold services need to be run in all Required schemas (for instance: namespaces that want to make use of the centrally deployed services). To enable the above functionality the following changes are required.

  1. Migrate.sh

#!/bin/sh
baseurl=$DB_URL
echo "the baseurl : $DB_URL"
schemasetter="?currentSchema="
schemas=$SCHEMA_NAME
echo "the schemas : $schemas"
for schemaname in ${schemas//,/ }
do
    echo "the schema name : ${baseurl}${schemasetter}${schemaname}"
    flyway -url=${baseurl}${schemasetter}${schemaname}  -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate
done
  1. values.yml

#Values.yml of the specific service before multiple schema changes

# Init Containers Configs
initContainers:
  dbMigration:
    enabled: true
    schemaTable: "property_services_schema"
    image:
      repository: "property-services-db"

#Values.yml of the specific service after multiple schema changes.

# Init Containers Configs
initContainers:
  dbMigration:
    enabled: true
    schemaTable: "property_services_schema"
    image:
      repository: "property-services-db"
    env: |
        {{- if index .Values "property-ismultischema-enabled" }}        
        - name: SCHEMA_NAME
          value: {{ index .Values "property-schemas" | quote }}
        {{- end }}
        - name: "DB_URL"
          valueFrom: 
            configMapKeyRef: 
              name: egov-config
              key: db-url
        - name: "SCHEMA_TABLE"
          value: {{ .Values.initContainers.dbMigration.schemaTable | quote }}              
        - name: "FLYWAY_USER"
          valueFrom: 
            secretKeyRef: 
                name: db
                key: flyway-username
        - name: "FLYWAY_PASSWORD"
          valueFrom:
            secretKeyRef: 
                name: db
                key: flyway-password
        - name: "FLYWAY_LOCATIONS"
          valueFrom: 
            configMapKeyRef: 
                name: egov-config
                key: flyway-location
{{- if index .Values "property-ismultischema-enabled" }}        
- name: SCHEMA_NAME
  value: {{ index .Values "property-schemas" | quote }}
{{- end }}

The "property-ismultischema-enabled" Boolean value to check if the feature is enabled and "property-schemas" to derive the value from respective environments YAML. This example of two variables should be named differently based on service-name to avoid conflicts.

  1. Environments.yml

In the respective environmentโ€™s file add the two new variables, one for the if condition and the other field for actual values under the respective service names. Lines 6 and 7 are the sample values provided here.

eg :

property-services:
  property-schemas: 'public,statea,stateb'
  property-ismultischema-enabled: 'true'

4. Code Changes For Multi Schema Services

Application.properties variables to be added.

  1. state.level.tenantid.length=2 State-level tenant value will be picked from the full tenant-id separated by the '.' dot. once the tenant-id is separated by a dot the resulting array of sizes given above will be considered state level.

  2. is.environment.central.instance=true

    Declares whether the environment in which the service is deployed belongs to a central-instance kind of setup.

  3. The both above said variable has to be overridden in the values YAML file of the respective service to pick up the values from the environment.

  {{- if index .Values "global" "is-environment-central-instance" }}        
  - name: IS_ENVIRONMENT_CENTRAL_INSTANCE
    valueFrom:
      configMapKeyRef:
        name: egov-config
        key: is-environment-central-instance
  {{- end }}
  {{- if index .Values "global" "is-environment-central-instance" }}        
  - name: STATE_LEVEL_TENANTID_LENGTH
    valueFrom:
      configMapKeyRef:
        name: egov-config
        key: state-level-tenantid-length
  {{- end }}
  1. The host of the state-specific services referred by this service should be changed to the internal gateway host for tenant-based(namespace) redirection.

  - name: EGOV_MDMS_HOST
    valueFrom:
      configMapKeyRef:
        name: egov-service-host
        key: internal-gateway
  1. If this service allows the search of data without tenant-id then the following validation should be added to all the search APIs belonging to the service. searches without state-level tenant-id (as described by this variable - state.level.tenantid.length) will render the application useless, so the following is mandatory

if(configs.getIsEnvironmentCentralInstance() && criteria.getTenantId() == null) 
  throw new CustomException("EG_PT_INVALID_SEARCH",
                                      " TenantId is mandatory for search ");
                                      
else if(configs.getIsEnvironmentCentralInstance() 
    && criteria.getTenantId().split("\\.").length < configs.getStateLevelTenantIdLength())
 throw new CustomException("EG_PT_INVALID_SEARCH",
       " TenantId should be mandatorily " + configs.getStateLevelTenantIdLength() + " levels for search");
  1. Update the Kafka producer in the service with the following code to enable the service to post to a tenant (namespace) specific topic based on the tenant-id.

@Service
@Slf4j
public class Producer {

	@Autowired
	private CustomKafkaTemplate<String, Object> kafkaTemplate;
	
	@Autowired
	private PropertyConfiguration configs;

	public void push(String tenantId, String topic, Object value) {

		String updatedTopic = topic;
		if (configs.getIsEnvironmentCentralInstance()) {

			String[] tenants = tenantId.split("\\.");
			if (tenants.length > 1)
				updatedTopic = tenants[1].concat("-").concat(topic);
		}
		log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic);
		kafkaTemplate.send(updatedTopic, value);
	}
} 
  1. Replace all the table names in the queries present with the {schema} placeholder

private static String PROEPRTY_AUDIT_QUERY = "select property from {schema}.eg_pt_property_audit where propertyid=?";
  1. Add the following Schema replacer utility method and use the same to replace all queries with the respective schema.

/* * add this variable to your constant class */
public static String SCHEMA_REPLACE_STRING = "{schema}"; /** * Method to fetch the state name from the tenantId * * @param query * @param tenantId * @return */
public String replaceSchemaPlaceholder(String query, String tenantId) {
    String finalQuery = null;
    if (tenantId.contains(".")) {
        String schemaName = tenantId.split("\\.")[1];
        finalQuery = query.replace(Constants.SCHEMA_REPLACE_STRING, schemaName);
    } else {
        finalQuery = query.replace(Constants.SCHEMA_REPLACE_STRING.concat("."), "");
    }
    return finalQuery;
} 

/* * Sample method example to replace query with schema */
public List < String > getPropertyIds(Set < String > ownerIds, String tenantId) {
    List < Object > preparedStmtList = new ArrayList < > ();
    String query = queryBuilder.getQuery(ownerIds, tenantId, preparedStmtList);
    query = util.replaceSchemaPlaceholder(query, tenantId);
    return jdbcTemplate.queryForList(query, preparedStmtList.toArray(), String.class);
}
  1. Change the persister config to alter the Kafka topic names for the configs belonging to your respective multi-schema service. The Kafka topic name should be appended with the schema name of the respective state schema.

5. Central Instance Enabled Development

Whether a service is going to be deployed in a central instance or not, it should follow and integrate with the central instance util library of common services.

  1. Make use of centralInstanceUtil class to perform any tenantId manipulations. Manual manipulation of tenantId is to be avoided for common purposes like getting state-level tenantId, and state-specific Kafka topics. Read the following methods from MultiStateInstanceUtil class found in the common-services package and make use of them as mentioned in the document.

  1. New environment variables are to be added mandatorily for environments.

is.environment.central.instance=false
state.level.tenantid.length=2
state.schema.index.position.tenantid=1
  1. The environment should be set to false when the current server is not for multi-state(non-central-instance), disabling and enabling this make the methods in the multiStateUtil class behave as required.

  2. The state-level tenant length describes what part of the whole tenantId represents the state part. for eg: in tenantId โ€œin.statea.tenantxโ€. in.statea represents the state part so the value will be 2.

  3. The schema index position points to the substring of the tenantId whose value represents the schema name of the database for the given state.

PreviousMaster Migration DocumentNextMDMS & Configuration Updates

Last updated 4 months ago

Was this helpful?

The internal gateway config should be added to the since the app is deployed in the central namespace.

This file is needed for building migration docker image is located in the DB folder of resources. eg: . Update the file with the following contents:

The DB configuration is by default provided in the common file in the helm chart and need not be edited in normal scenarios. Since we are injecting the multiple schema list for app-specific purposes all the DB-migration ENV variables should be overridden in the app-specific values.yml file.

- the full updated sample file can be found here

Only the - name: SCHEMA_NAME variable needs to be added and other fields can be copied from the common as it is without any changes. The above file contains an if-else condition with two new variables

Any services that could potentially be commonly used by all environments in the central instance (refer to for details).

file to refer to the above-said changes

Refer to the common update document .

๐Ÿ‘‹
central git config repo
property-services/src/main/resources/db/migrate.sh
values.yml
values.yml
Sample values YAML
Multi Schema Service List
3.1 General update for services to be Central-Instance compatible
values.yaml
228KB
MultiStateInstanceUtil.pdf
pdf
persister config