-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MOSIP-33145] Merge to develop from develop-java21
Signed-off-by: JanardhanBS-SyncByte <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,010 additions
and
18 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release/pre-release Preparation. | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
MESSAGE: | ||
description: 'Triggered for release or pe-release' | ||
required: false | ||
default: 'Release Preparation' | ||
RELEASE_TAG: | ||
description: 'tag to update' | ||
required: true | ||
SNAPSHOT_TAG: | ||
description: 'tag to be replaced' | ||
required: true | ||
BASE: | ||
description: 'base branch for PR' | ||
required: true | ||
jobs: | ||
maven-release-preparation: | ||
uses: mosip/kattu/.github/workflows/release-changes.yml@master | ||
with: | ||
MESSAGE: ${{ inputs.MESSAGE }} | ||
RELEASE_TAG: ${{ inputs.RELEASE_TAG }} | ||
SNAPSHOT_TAG: ${{ inputs.SNAPSHOT_TAG }} | ||
BASE: ${{ inputs.BASE }} | ||
secrets: | ||
ACTION_PAT: ${{ secrets.ACTION_PAT }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |
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,35 @@ | ||
name: Tagging of repos | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
TAG: | ||
description: 'Tag to be published' | ||
required: true | ||
type: string | ||
BODY: | ||
description: 'Release body message' | ||
required: true | ||
default: 'Changes in this Release' | ||
type: string | ||
PRE_RELEASE: | ||
description: 'Pre-release? True/False' | ||
required: true | ||
default: False | ||
type: string | ||
DRAFT: | ||
description: 'Draft? True/False' | ||
required: false | ||
default: False | ||
type: string | ||
|
||
jobs: | ||
tag-branch: | ||
uses: mosip/kattu/.github/workflows/tag.yml@master | ||
with: | ||
TAG: ${{ inputs.TAG }} | ||
BODY: ${{ inputs.BODY }} | ||
PRE_RELEASE: ${{ inputs.PRE_RELEASE }} | ||
DRAFT: ${{ inputs.DRAFT }} | ||
secrets: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |
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 |
---|---|---|
@@ -1,9 +1,18 @@ | ||
.idea | ||
*/target* | ||
*/logs | ||
<<<<<<< HEAD | ||
.metadata/ | ||
.sonarlint/ | ||
*/.classpath | ||
*/.project | ||
*/.settings/ | ||
*/lib/ | ||
*/lib/ | ||
======= | ||
../.metadata/ | ||
../.sonarlint/ | ||
.classpath | ||
.project | ||
.settings/ | ||
lib/ | ||
>>>>>>> 4b78bb010ab198e4a5e09246e21840b55a5cf30b |
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,96 @@ | ||
FROM mosipdev/openjdk-21-jre:latest | ||
|
||
# label to be assigned along with Docker build [Mandatory] | ||
ARG SOURCE | ||
ARG COMMIT_HASH | ||
ARG COMMIT_ID | ||
ARG BUILD_TIME | ||
LABEL source=${SOURCE} | ||
LABEL commit_hash=${COMMIT_HASH} | ||
LABEL commit_id=${COMMIT_ID} | ||
LABEL build_time=${BUILD_TIME} | ||
|
||
# can be passed during Docker build as build time environment for github branch to pickup configuration from. | ||
ARG spring_config_label | ||
|
||
# can be passed during Docker build as build time environment for spring profiles active | ||
ARG active_profile | ||
|
||
# can be passed during Docker build as build time environment for config server URL | ||
ARG spring_config_url | ||
|
||
# environment variable to pass github branch to pickup configuration from, at docker runtime | ||
ENV spring_config_label_env=${spring_config_label} | ||
# environment variable to pass active profile such as DEV, QA etc at docker runtime | ||
ENV active_profile_env=${active_profile} | ||
# environment variable to pass spring configuration url, at docker runtime | ||
ENV spring_config_url_env=${spring_config_url} | ||
|
||
ARG biosdk_zip_url | ||
|
||
ENV biosdk_zip_file_path=${biosdk_zip_url} | ||
|
||
ARG biosdk_local_dir=biosdk-client | ||
|
||
ENV biosdk_local_dir_name=${biosdk_local_dir} | ||
|
||
ARG sdk_impl | ||
|
||
ARG service_context=/biosdk-service | ||
|
||
ENV service_context_env=${service_context} | ||
|
||
#ENV biosdk_zip_url=$biosdk_zip_url | ||
ENV biosdk_bioapi_impl=${sdk_impl} | ||
|
||
# can be passed during Docker build as build time environment for github branch to pickup configuration from. | ||
ARG container_user=mosip | ||
|
||
# can be passed during Docker build as build time environment for github branch to pickup configuration from. | ||
ARG container_user_group=mosip | ||
|
||
# can be passed during Docker build as build time environment for github branch to pickup configuration from. | ||
ARG container_user_uid=1001 | ||
|
||
# can be passed during Docker build as build time environment for github branch to pickup configuration from. | ||
ARG container_user_gid=1001 | ||
|
||
# set working directory for the user | ||
WORKDIR /home/${container_user} | ||
|
||
ENV work_dir=/home/${container_user} | ||
|
||
ARG loader_path=${work_dir}/additional_jars/ | ||
|
||
ENV loader_path_env=${loader_path} | ||
|
||
ARG logging_level_root=INFO | ||
|
||
ENV logging_level_root_env=${logging_level_root} | ||
|
||
# install packages and create user for ubunutu latest | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends sudo && \ | ||
groupadd -g ${container_user_gid} ${container_user_group} && \ | ||
useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} && \ | ||
mkdir -p /home/${container_user} ${loader_path} | ||
|
||
|
||
ADD configure_biosdk.sh /home/${container_user}/configure_biosdk.sh | ||
|
||
ADD ./target/biosdk-services-*.jar biosdk-services.jar | ||
|
||
RUN chmod +x /home/${container_user}/configure_biosdk.sh \ | ||
&& chmod a-w /home/${container_user}/configure_biosdk.sh \ | ||
&& chmod 775 biosdk-services.jar \ | ||
&& chown -R ${container_user}:${container_user} /home/${container_user} | ||
|
||
# select container user for all tasks | ||
USER ${container_user_uid}:${container_user_gid} | ||
|
||
EXPOSE 9099 | ||
|
||
ENTRYPOINT ["./configure_biosdk.sh"] | ||
|
||
CMD echo $biosdk_bioapi_impl ; \ | ||
java -Dloader.path="${loader_path_env}" -Dserver.servlet.context-path="${service_context_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED -jar biosdk-services.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 |
---|---|---|
@@ -1,13 +1,73 @@ | ||
[![Maven Package upon a push](https://github.com/mosip/biosdk-services/actions/workflows/push_trigger.yml/badge.svg?branch=develop)](https://github.com/mosip/biosdk-services/actions/workflows/push_trigger.yml) | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=develop&project=mosip_biosdk-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=develop&id=mosip_biosdk-services) | ||
# Bio SDK services | ||
|
||
This service provides a mock implementation of Bio-SDK REST Service. It by default loads [Mock BIO SDK](https://github.com/mosip/mosip-mock-services/tree/master/mock-sdk) internally on the startup and exposes the endpoints to perform 1:N match, segmentation, extraction as per the [IBioAPI](https://github.com/mosip/commons/blob/master/kernel/kernel-biometrics-api/src/main/java/io/mosip/kernel/biometrics/spi/IBioApiV2.java). This can be configured to load a different JAR that has a different implementation of `IBioAPIV2`, provided its dependencies are in place. | ||
|
||
# Bio-SDK Service | ||
## Requirements: | ||
* Java version = 21.X.X | ||
* Maven version >= 3.9.6 | ||
|
||
## Overview | ||
This is reference service and provides a mock implementation of Bio-SDK REST Service. By default loads [Mock BIO SDK](https://github.com/mosip/mosip-mock-services/tree/master/mock-sdk) internally on the startup and exposes the endpoints to perform 1:1 match, extraction as per the [IBioAPI](https://github.com/mosip/commons/blob/master/kernel/kernel-biometrics-api/src/main/java/io/mosip/kernel/biometrics/spi/IBioApi.java). | ||
## Run jar directly | ||
|
||
To know more about Biometric SDK, refer [biometric-sdk](https://docs.mosip.io/1.2.0/biometrics/biometric-sdk). | ||
### Build | ||
|
||
### License | ||
This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE). | ||
Go to biosdk-services folder and run the below command, this will create a jar file in target folder | ||
```text | ||
mvn clean install | ||
``` | ||
|
||
### Run jar | ||
|
||
```text | ||
java -Dloader.path=<biosdk jar provided by third-party vendors> -Dbiosdk_bioapi_impl=<classpath of class that implements IBioApi interface> --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED -jar biosdk-services-<version>.jar | ||
``` | ||
|
||
For example: | ||
```text | ||
java -Dloader.path=mock-sdk-1.2.1-SNAPSHOT-jar-with-dependencies.jar -Dbiosdk_bioapi_impl=io.mosip.mock.sdk.impl.SampleSDKV2 -jar biosdk-services-1.2.1-SNAPSHOT.jar | ||
``` | ||
|
||
### Check service status | ||
```text | ||
http://{host}:9099/biosdk-service | ||
In case of localhost: | ||
http://localhost:9099/biosdk-service | ||
``` | ||
You will see response like | ||
```text | ||
Service is running... Fri Jan 29 08:49:28 UTC 2021 | ||
``` | ||
|
||
## Run as docker | ||
|
||
### Build docker image | ||
|
||
Build the Dockerfile to create docker image | ||
|
||
### Run docker image | ||
|
||
Run the docker image by providing: | ||
* biosdk_zip_url (environment variable), url for third-party biosdk library zip file | ||
* biosdk_bioapi_impl (environment variable) where biosdk_zip_url is the path of the class that implements IBioApi interface methods | ||
|
||
|
||
### Check service status | ||
```text | ||
http://{host}:9099/biosdk-service | ||
In case of localhost: | ||
http://localhost:9099/biosdk-service | ||
``` | ||
You will see response like | ||
```text | ||
Service is running... Fri Jan 29 08:49:28 UTC 2021 | ||
``` | ||
|
||
## Swagger UI for exposed APIs | ||
```text | ||
http://{host}:9099/biosdk-service/swagger-ui.html | ||
In case of localhost: | ||
http://localhost:9099/biosdk-service/swagger-ui.html |
Oops, something went wrong.