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
JBoss Wildfly v11.x
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
Code Block | ||
---|---|---|
| ||
https://github.com/egovernments/eGov-infraOps/blob/master/helm/environments/dev.yaml
https://github.com/egovernments/eGov-infraOps/blob/master/helm/environments/qa.yaml |
Database configuration
Add or update the db url in the environment specific file using the below property.
Code Block |
---|
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.
Code Block | ||
---|---|---|
| ||
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.
The configurations to be done in the /egov-egi/src/main/resources/config/application-config.properties or in the ${HOME_DIR}/wildfly-11.0.0.Final/modules/system/layers/base/org/egov/settings/main/config/egov-erp-override.properties
Enable multi tenancy by enabling the following property
Code Block | ||
---|---|---|
| ||
multitenancy.enabled=true |
The state schema is configured by adding the following property
Code Block | ||
---|---|---|
| ||
statewide.schema.name=generic |
generic is the statewide schema name.
Default schema name and the statewide schema name should be same. The default schema name is configured using the following property
Code Block | ||
---|---|---|
| ||
default.schema.name=generic |
CurrentTenantIdentifierResolver will take the default schema if no schema is present in the ApplicationThreadLocals.
: true |
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)
Ex:
The default tenants are configured in the finance service yaml file using below configuration.
Code Block | ||
---|---|---|
| ||
tenants: |
tenant.citya.egovernments.org=citya
tenant.cityb.egovernments.org=cityb |
To override and have a separate tenants for specific environment then update the environment specific file like below.
Code Block | ||
---|---|---|
| ||
FinanceTenants: | tenant.citya.egovernments.org=citya tenant.cityb.egovernments.org=cityb |
Insert data into eg_city, in the city table, domain 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:Code Block language java For citya, domain url should be citya.egovernments.org For cityb, domain url should be cityb.egovernments.org
Database migration settings
...
The default database migration configurations are present in the application configuration file.
Code Block | ||
---|---|---|
| ||
#Enable/Disable flyway migration
db.migration.enabled=true |
The following are the SQL file locations to pick and execute according to the properties configured in the properties file.
The SQL files present in the following locations will be executed on all the schemas present in the database.
Code Block |
---|
#Enable/Disable flyway migration validation
db.flyway.validateon.migrate=false
#Enable/Disable repairing of flyway migration checksum
db.flyway.migration.repair=false
#Various flyway migration sql script file paths
db.flyway.main.migration.file.path=classpath:/db/migration/main/ |
Sample scripts will be executed if dev.mode is set as true.
Code Block |
---|
db.flyway.sample.migration.file.path=classpath:/db/migration/sample/ |
City wise scripts will be executed on the city’s schema
Code Block |
---|
db.flyway.tenant.migration.file.path=classpath:/db/migration/%s/ |
Statewide scripts will be executed on the configured statewide schema if the statewide migration is enabled.
Code Block |
---|
statewide.schema.name=generic db.flyway.statewide.migration.file.path=classpath:/db/migration/statewide/ #Enable/Disable to run migration sql's inside "statewide" migration folder (resources/db/migration/statewide) statewide.migration.required=true db.flyway.statewide.migration.file.path=classpath:false #Schema name where statewide migration to be executed, value must be your default schema name (see default.schema.name) statewide.schema.name=generic #Enable/Disable dev mode, this must be set to false in all non dev environments dev.mode=false |
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.
Code Block | ||
---|---|---|
| ||
# Enable/Disable to execute the sample sql scripts. dev_mode: false # Enable/Disable flyway migration validation db_flyway: true #Enable/Disable to run migration sql's inside "statewide" migration folder (resources/db/migration/statewide/statewide) statewide_migration: true #Enable or Disable Multitenancy multitenancy: true |
System Integration User Details Configuration
Add the following System integrator user details
...
Configure the following property either in the finance service values yaml file or the environment specific yaml file.
Code Block | ||
---|---|---|
| ||
Systemintegration: | si.microservice.user=SIFINANCE${si-microservice-user} si.microservice.password=sifinance123@${si-microservice-password} si.microservice.usertype=SYSTEM si.microservice.scope=read si.microservice.granttype=password env: | - name: si-microservice-password valueFrom: secretKeyRef: name: egov-si-microservice key: si-microservice-password - name: si-microservice-user valueFrom: secretKeyRef: name: egov-si-microservice key: si-microservice-user |
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.
Code Block |
---|
finance: true |
File store Configuration
Configure the following property either in the finance
...
service values yaml file or the environment specific yaml file.
Code Block | ||
---|---|---|
| ||
filestore: /tmp/egovfilestore |
SMS and Email Configuration
Configure the following property either in the finance service values yaml file or the environment specific yaml file.
Code Block | ||
---|---|---|
| ||
sms: true
mail: true
smc_config: |
# Add/update the sms related properties
mail_config: |
# Add/update the mail related properties |
Quartz Scheduler Configuration
Configure the following property either in the finance service values yaml file or the environment specific yaml file.
Code Block | ||
---|---|---|
| ||
scheduler: true |
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.
Code Block |
---|
microservice: | egov.default.services.endpoint=https://egov-micro-dev.egovernments.org/ egov.hrms.service.endpoint=httpshttp://egov-micro-dev.egovernments.org/hrms.egov:8080/ egov.accesscontrol.service.endpoint=httpshttp://egov-micro-dev.egovernments.org/accesscontrol.egov:8080/ egov.hr.masters.service.endpoint=httpshttp://egovhr-micro-dev.egovernments.orgmasters.egov:8080/ egov.user.service.endpoint=httpshttp://egov-micro-dev.egovernments.org/user.egov:8080/ egov.common.masters.endpoint=httpshttp://egov-microcommon-dev.egovernments.org/masters.egov:8080/ egov.billing.service.endpoint=httpshttp://egovbilling-micro-dev.egovernments.org/service.egov:8080/ egov.collection.service.endpoint=httpshttp://egovcollection-micro-dev.egovernments.org/ services.egov:8080/ egov.egf.master.service.endpoint=httpshttp://egovegf-micro-dev.egovernments.org/master.egov:8080/ egov.egf.instrument.service.endpoint=httpshttp://egovegf-micro-dev.egovernments.orginstrument.egov:8080/ egov.mdms.service.endpoint=httpshttp://egov-micromdms-dev.egovernments.org/service.egov:8080/ egov.indexer.service.endpoint=httpshttp://egov-micro-dev.egovernments.org/ egov.filestore.service.endpoint=https://egov-micro-dev.egovernments.org/ |
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.
Code Block |
---|
$ vim /etc/hosts 127.0.0.1 egov-micro-dev.egovernments.orgindexer.egov:8080/ egov.services.billing.service.bill.generate=billing-service/bill/v2/_fetchbill egov.filestore.service.endpoint=http://egov-filestore.egov:8080/ |
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.
Add the property and update the MDMS search URL
...
.
MDMS serach url is configured in the Application Configuration file.
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.
Code Block |
---|
$ vim /etc/hosts
127.0.0.1 egov-micro-dev.egovernments.org |
References
Title | Link |
---|---|
API Contracts | https://github.com/egovernments/egov-coexistence/blob/master/docs/voucher_apis.yaml Voucher APIs |
Co-existence finance code available | https://github.com/egovernments/egov-coexistence Co-existence repository |
Sample client implementation repository | https://github.com/egovernments/eGov-Punjab-Implementation Punjab implementation repository |
Configuring MDMS |
...