-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af9ddbf
commit 07d85d7
Showing
102 changed files
with
2,588 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
All notable changes to this module will be documented in this file. | ||
|
||
## 1.2.4 - 2023-02-06 | ||
- Transition from 1.2.4-beta version to 1.2.4 version | ||
|
||
## 1.2.4-beta - 2022-09-20 | ||
- Upgraded spring-boot-starter-parent to 2.2.13 and spring beans to 5.2.20.RELEASE. Remove log4j depencdency which was not used | ||
|
||
## 1.2.3 - 2022-01-13 | ||
- Updated to log4j2 version 2.17.1 | ||
|
||
## 1.2.2 - 2021-05-11 | ||
|
||
- TimeZone is now made configurable | ||
|
||
## 1.2.1 - 2021-02-26 | ||
|
||
- Updated domain name in application.properties | ||
- Added size validations | ||
- Change the time zone to IST for date generation | ||
|
||
## 1.2.0 - 2020-06-17 | ||
|
||
- Added typescript definition generation plugin | ||
- Upgraded to tracer:`2.0.0-SNAPSHOT` | ||
- Upgraded to spring boot `2.2.6-RELEASE` | ||
- Upgraded to flyway-core `6.4.3 version` | ||
|
||
## 1.1.0 | ||
|
||
- Added option to auto create sequences | ||
- Moved id generation config from DB to MDMS | ||
- Set `autocreate.new.seq` to `true` to enable auto creation of sequences | ||
|
||
## 1.0.0 | ||
|
||
- Base version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM frolvlad/alpine-java:jdk8-slim | ||
WORKDIR /app | ||
ADD ./target/egov-idgen-1.2.4-SNAPSHOT.jar id-gen-service.jar | ||
ENTRYPOINT ["java", "-jar", "id-gen-service.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Local Setup | ||
|
||
This document will walk you through the dependencies of this service and how to set it up locally | ||
|
||
- To setup the egov-idgen service in your local system, clone the [Core Service repository](https://github.com/egovernments/core-services). | ||
|
||
## Dependencies | ||
|
||
### Infra Dependency | ||
|
||
- [X] Postgres DB | ||
- [ ] Redis | ||
- [ ] Elasticsearch | ||
- [ ] Kafka | ||
- [ ] Consumer | ||
- [ ] Producer | ||
|
||
## Running Locally | ||
|
||
To run the IdGen services in your local system, you need to port forward below services | ||
|
||
```bash | ||
function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} | ||
kubectl port-forward -n egov $(kgpt egov-mdms-service) 8088:8080 | ||
``` | ||
|
||
To run the notification mail services locally, update below listed properties in `application.properties` before running the project: | ||
|
||
```ini | ||
# The host of the running environment (eg:https://egov-micro-qa.egovernments.org/citizen) | ||
mdms.service.host=http://127.0.0.1:8088/ | ||
|
||
# MDMS service URI. i.e egov-mdms-service/v1/_search | ||
mdms.service.search.uri= | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
IMAGE_NAME=ghcr.io/sunbird-rc/id-gen-service | ||
|
||
build: | ||
rm -rf ./target | ||
mvn clean install | ||
|
||
docker: build | ||
docker build -t $(IMAGE_NAME) . | ||
|
||
release: docker | ||
@docker push $(IMAGE_NAME):latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# egov-idgen service | ||
|
||
The egov-idgen service generates new id based on the id formats passed. The application exposes a Rest API to take in requests and provide the ids in response in the requested format. | ||
|
||
### DB UML Diagram | ||
|
||
- TBD | ||
|
||
### Service Dependencies | ||
|
||
- egov-mdms-service | ||
|
||
### Swagger API Contract | ||
|
||
Link to the swagger API contract yaml and editor link like below | ||
|
||
http://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/egov-services/master/docs/idgen/contracts/v1-0-0.yml#!/ | ||
|
||
|
||
## Service Details | ||
|
||
The application can be run as any other spring boot application but needs lombok extension added in your ide to load it. Once the application is up and running API requests can be posted to the url and ids can be generated. | ||
In case of intellij the plugin can be installed directly, for eclipse the lombok jar location has to be added in eclipse.ini file in this format -javaagent:lombok.jar. | ||
|
||
|
||
### API Details | ||
|
||
- id/v1/_genearte | ||
|
||
## Reference document | ||
|
||
Details on every parameters and its significance are mentioned in the document - `https://digit-discuss.atlassian.net/l/c/eH501QE3` | ||
|
||
|
||
### Kafka Consumers | ||
|
||
- NA | ||
|
||
### Kafka Producers | ||
|
||
- NA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.13.RELEASE</version> | ||
<relativePath></relativePath> | ||
</parent> | ||
<groupId>org.egov</groupId> | ||
<artifactId>egov-idgen</artifactId> | ||
<version>1.2.4-SNAPSHOT</version> | ||
<name>egov-idgen</name> | ||
<description>Id generation service</description> | ||
<properties> | ||
<log4j2.version>2.17.1</log4j2.version> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<lombok.version>1.18.8</lombok.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>5.2.20.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.aspectj</groupId> | ||
<artifactId>aspectjrt</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-aspects</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.flywaydb</groupId> | ||
<artifactId>flyway-core</artifactId> | ||
<version>6.4.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.egov.services</groupId> | ||
<artifactId>tracer</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.egov</groupId> | ||
<artifactId>mdms-client</artifactId> | ||
<version>0.0.3-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.jayway.jsonpath</groupId> | ||
<artifactId>json-path</artifactId> | ||
<version>2.2.0</version> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>repo.egovernments.org</id> | ||
<name>eGov ERP Releases Repository</name> | ||
<url>https://nexus-repo.egovernments.org/nexus/content/repositories/releases/</url> | ||
</repository> | ||
<repository> | ||
<id>repo.egovernments.org.snapshots</id> | ||
<name>eGov ERP Snapshots Repository</name> | ||
<url>https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
</repositories> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<excludes> | ||
<exclude> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</exclude> | ||
<exclude> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>cz.habarta.typescript-generator</groupId> | ||
<artifactId>typescript-generator-maven-plugin</artifactId> | ||
<version>2.22.595</version> | ||
<executions> | ||
<execution> | ||
<id>generate</id> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<phase>process-classes</phase> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<jsonLibrary>jackson2</jsonLibrary> | ||
<classes> | ||
<class>org.egov.id.model.IdRequest</class> | ||
<class>org.egov.id.model.IdResponse</class> | ||
</classes> | ||
<customTypeNaming> | ||
<typeNaming>org.egov.id.model.ResponseStatusEnum$ResponseStatusEnum:ResponseStatus</typeNaming> | ||
</customTypeNaming> | ||
<customTypeMappings> | ||
<customTypeMapping>org.egov.id.model.Error:Error</customTypeMapping> | ||
<customTypeMapping>org.egov.id.model.ErrorRes:ErrorRes</customTypeMapping> | ||
<customTypeMapping>org.egov.id.model.Role:Role</customTypeMapping> | ||
<customTypeMapping>org.egov.id.model.UserInfo:UserInfo</customTypeMapping> | ||
</customTypeMappings> | ||
<namespace>Digit</namespace> | ||
<debug>true</debug> | ||
<outputKind>module</outputKind> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
50 changes: 50 additions & 0 deletions
50
services/id-gen-service/src/main/java/org/egov/PtIdGenerationApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.egov; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang3.exception.ExceptionUtils; | ||
import org.egov.id.masterdata.MasterDataProvider; | ||
import org.egov.id.utils.Constants; | ||
import org.egov.tracer.config.TracerConfiguration; | ||
import org.egov.tracer.model.CustomException; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.util.ObjectUtils; | ||
|
||
/** | ||
* Description : This is initialization class for pt-idGeneration module | ||
* | ||
* @author Pavan Kumar Kamma | ||
* | ||
*/ | ||
@SpringBootApplication | ||
@Slf4j | ||
@Import({TracerConfiguration.class}) | ||
public class PtIdGenerationApplication { | ||
|
||
@Value("${egov.mdms.provider}") | ||
private String masterDataProviderClassName; | ||
public static void main(String[] args) { | ||
SpringApplication.run(PtIdGenerationApplication.class, args); | ||
} | ||
|
||
@Bean | ||
public MasterDataProvider masterDataProvider() { | ||
MasterDataProvider masterDataProvider = null; | ||
try{ | ||
if(ObjectUtils.isEmpty(masterDataProviderClassName)){ | ||
masterDataProviderClassName = Constants.DEFAULT_MASTER_DATA_PROVIDER; | ||
} | ||
Class<?> masterDataProviderClass = Class.forName(masterDataProviderClassName); | ||
|
||
masterDataProvider = (MasterDataProvider) masterDataProviderClass.newInstance(); | ||
log.info("Invoked MasterDataProvider with Classname: {}", masterDataProviderClassName); | ||
} catch(ClassNotFoundException | InstantiationException | IllegalAccessException e){ | ||
log.error("MDMS provider class {} cannot be instantiate with exception: {}", masterDataProviderClassName, ExceptionUtils.getStackTrace(e)); | ||
throw new CustomException("Unable to load MDMS provider class", "MDMS Provider Init Exception"); | ||
} | ||
return masterDataProvider; | ||
} | ||
} |
Oops, something went wrong.