Setting up Finance Service
Overview
This document describes the steps to be followed to set up a new instance of Finance. When a new state or city is to be set up, there are some activities to be executed in a defined order. Setting up an instance of an application server and configuration changes etc are a few of the key activities.
Technical Prerequisites
Prior Knowledge of Java/J2EE.
Prior Knowledge of Spring and Hibernate
Prior knowledge of Maven
Prior knowledge of Git.
Hardware/Software Prerequisites
Maven v3.2.x
PostgreSQL v9.6
Git 2.8.3
JDK 8 update 112 or higher
Create subdomains under the main domain for each of the cities that are to be set up
Create a schema per city in the database
Configurations and Setup
The Co-existence repository is the base repository for the finance product and the client-specific data needs to be defined in the Client implementation repository
How to set up a client implementation repository
Fork and create a client implementation repository from Client implementation repository to keep client-specific data and configurations.
Any configurations and data specific to the client should be added in the client repository.
Application Configuration
The default application configurations of the finance service are present in the application configuration file. To enable or disable any feature, either update the values in the application configuration file or the override configuration file.
The override configuration is the template and the values for the template are present either in the finance service values yaml file or in the environment named yaml file. The finance service values yaml is the common file to override the default values and the changes made to this file are applicable to all environments (dev, qa, uat, prod etc).
Any specific configuration change is required for any specific environment then update the environment named yaml file.
Sample environment named yaml files for your reference
https://github.com/egovernments/Train-InfraOps/blob/master/helm/environments/dev.yaml
Database configuration
Add or update the db url in the environment specific file using the below property.
erp-db-url: "jdbc:postgresql://egov-dev-db.ctm6jbmr5mnj.ap-south-1.rds.amazonaws.com:5432/finance_qa_db"
Update the db username and password, which are configured in the environment named secrets yaml file.
For example, for the dev environment, update the dev-secrets.yaml.
secrets:
db:
username: <username value>
password: <password value>
Set up a schema-based multi-tenant database
Finance co-existence service uses schema-based multi-tenancy, this means there will be one schema present for a city. The following are the configuration changes to set up this kind of database.
Enable multi tenancy by enabling the following property
Each ULB is enabled by adding a schema name and domain name. Schema names should follow a naming standard, It should be the same as that of the city name.
Each ULB can be configured by adding an entry like tenant.<domain_name>=schema_name (city_name)
The default tenants are configured in the finance service yaml file using below configuration.
To override and have a separate tenants for specific environment then update the environment specific file like below.
Here citya.egovernments.org, cityb.egovernments.org are the domains and citya, cityb are the schemas/tenants.
Example environment specific configuration file for your reference.
Update the domainurl in the eg_city table.
Domain URL value should be the same as configured tenant domain_name
Ex:
Database migration settings
The default database migration configurations are present in the application configuration file.
Override the default values by updating the properties either in the finance service values yaml file or the environment specific yaml file. The following are the different properties.
System Integration User Details Configuration
Configure the following property either in the finance service values yaml file or the environment specific yaml file.
Add one user in the system for system integration - SIFINANCE mapped with role SYS_INTEGRATOR_FINANCE by using the user service createnovalidate API.
Find the createnovalidate API details below
Elastic Dashboard Configuration
To enable or disable an event to push the bills and vouchers to the elastic search indexer the below need to be configured either in the finance service values yaml file or the environment specific yaml file.
File store Configuration
Configure the following property either in the finance service values yaml file or the environment specific yaml file.
Quartz Scheduler Configuration
Configure the following property either in the finance service values yaml file or the environment specific yaml file.
DIGIT integration configuration
Finance service reads data from multiple other DIGIT services. The following are the different services finance system reads data from. Update the domain URL of the respective service based on the service where it is running.
MDMS Configuration
The following master data is present in the MDMS repository.
Department
Designation
BusinessServiceMapping
TaxHeadMasterGlCodeMapping
InstrumentGLcodeMapping
AccountCodeTemplate
FinanceInstrumentStatusMapping
tenants
OnlineGLCodeMapping
Define all the departments in the Departments json
Define all the designations in the Designations json
Configure finance tenants in the Citymodule json to enable finance module in the ULB
Define business services mapping in the Business Service Mapping json to integrate different business services like Property Tax, Trade License and FireNOC etc with Finance and to post vouchers like demand and receipt vouchers. Enabling and disabling voucher posting for any service can be configured here.
Define the Tax head and instrument glcode mappings in the Account Head Mapping json. This file contains each tax head wise glcode mapping and each instrument wise glcode mappings.
Different instrument statuses can be defined in the Instrument Status Mapping json file.
Different types of contractor bill templates are defined in the AccountCode Template file. These templates will be used in the contractor bill creation screen to auto-populate the account codes.
Service-wise glcode mapping for the online instrument type for the particular city is defined in the Online Instrument Type json.
Define the business service wise bank account mappings in the BankAccount Service Mapping json file. These details to be configured city wise as the bank details are specific to a city.
MDMS serach url is configured in the Application Configuration file.
Sub domain formation logic in front end employee app
Finance coexistence follows schema per ulb structure and each city requires one sub domain. Sub domain formation for the different environments is happening dynamically by reading the environment value from the FIN_ENV environment variable in the js file.
The following code snippet shows the sub domain formation logic
The FIN_ENV variable is configurable and configured in the globalConfigs.js which is present (to be created if not present) in the S3 Bucket. The following code snippet shows the same.
The following are some examples
The globalConfigs.js file is custom injected in the environment specific yaml files. The following code snippet shows the same.
The sample environment yaml files for your reference
Changes required to setup workspace in local machine
Setup Finance service workspace by following the instructions provided in README.
After set up is done, make the changes to the host file in the local machine, by mapping the domain URLs with a local IP address and save the changes. Restart your local machine to make the host mapping effective.
References
Title | Link |
---|---|
API Contracts | |
Co-existence finance code available | |
Sample client implementation repository | |
Configuring MDMS | |
Adding new service and CI/CD |