Pre-registration Developers Guide

Overview

The documentation here will guide you through the pre-requisites required for Pre-registration developer setup.

Software setup

Below are the list of tools required in Pre-registration

  1. JDK 11

  2. Any IDE (Eclipse, IntelliJ IDEA)

  3. Apache Maven (zip folder)

  4. pgAdmin

  5. Postman

  6. Git

  7. lombok.jar (file)

  8. MOSIP Pre-registration specific JARs: The version will depend on which Pre Registration branch you have cloned. If it is "release-1.2.0.1" then you can download 1.2.0.1.B1 or 1.2.0.1.B2 version of below jars whichever is available.

  9. Notepad++ (optional)

Follow the steps below to setup Pre-registration on your local system

  1. Fork the MOSIP Pre-registration repository from Github MOSIP repository to your GitHub account.

  2. Clone the forked repository into your local machine.

    • git clone https://github.com/${urgithubaccname}/pre-registration.git

    • git remote add upstream https://github.com/mosip/pre-registration.git

    • git remote set-url --push upstream no_push

    • git remote -v

    • git checkout -b my-release-1.2.0.1

    • git fetch upstream

    • git rebase upstream/release-1.2.0.1

  3. Inside settings.xml change local repository directory to your directory name where .m2 folder is located. E.g.: <localRepository>C:/Users/username/.m2/repository</localRepository>

  4. Add settings.xml inside .m2 folder (Maven Folder). E.g.: C:\Users\username\.m2

  5. Import the project in Eclipse IDE and it starts updating Maven projects configuration, refreshing workspaces, project starts building (downloading sources, javadoc).

  6. Add downloaded lombok.jar to project, click on downloaded JAR and install specifying Eclipse IDE(eclipse.exe) location.

  1. Configure the JDK (Standard VM) with your Eclipse by traversing through Preferences → Java → Installed JREs.

  1. Add MOSIP Pre-registration specific JARs from Maven central:

    • Adding JARs to Build Path: Right click on service -> Build Path -> Configure Build Path -> click on Classpath -> Add External JARs -> Add required JARs -> Apply and close.

  1. Add auth-adapter, transliteration, ref-idobjectvalidator, virusscanner, lombok JARs to pre-registration-application-service, pre-registration-datasync-service classpath.

  2. Add auth-adapter, lombok JARs to pre-registration-core, pre-registration-batchjob, pre-registration-captcha-service, pre-registration-booking-service classpath.

  3. Run mvn clean install -Dgpg.skip=true command to build locally and to execute test cases.

  4. Update Maven dependencies: Maven syncs the Eclipse project settings with that of the pom. It downloads dependencies required for the project.

  5. Build and run the Project.

  6. To run the pre-registration-application-service locally without config server, update values in application.properties and bootstrap.properties:

  • spring.cloud.config.uri=https://localhost:8080

  • spring.cloud.config.label=develop

  • spring.cloud.config.name=pre-registration

  • spring.application.name=pre-registration-application-service

  • spring.profiles.active=default Point below urls to a valid env which has MOSIP setup:

  • mosip.base.url=https://yourenvurl

  • auth-token-generator.rest.issuerUrl:https://iam.yourenvurl/auth/realms/mosip

  • javax.persistence.jdbc.password: XXXXXX

  • javax.persistence.jdbc.url=jdbc:postgresql://yourenvurl:5432/mosip_prereg

  • mosip.batch.token.authmanager.password: XXXXXX

  • mosip.iam.adapter.appid=prereg

  • mosip.iam.adapter.clientsecret=XXXXXX

  • auth.server.admin.issuer.uri=https://iam.yourenvurl/auth/realms/

Developer setup for MOSIP Pre-registration UI

  1. Fork the Pre-registration UI repo to your GitHub account.

  2. Clone the forked repository into your local machine.

  • git clone https://github.com/${urgithubaccname}/pre-registration-ui.git

  • git remote add upstream https://github.com/mosip/pre-registration-ui.git

  • git remote set-url --push upstream no_push

  • git remote -v

  • git checkout -b my-release-1.2.0.1

  • git fetch upstream

  • git rebase upstream/release-1.2.0.1

  1. Install all dependencies with npm install.

  2. Install Angular JS npm install -g @angular/cli.

  3. Start the Angular JS server ng serve.

  4. Open http://localhost:4200 to access the application.

  5. You will face CORS issue since API Services are hosted on https://{env}.

Using the Angular CLI proxy solution to get around CORS issue

  1. Update the API services BASE_URL in config.json:

    • config.json is found inside assets directory.

    • E.g.: C:\MOSIP\pre-registration-ui\pre-registration-ui\src\assets\config.json

    {
    "BASE_URL": "https://localhost:4200/proxyapi/",
    "PRE_REG_URL": "preregistration/v1/"
    }
  2. Create a new file named proxy.conf.json:

    Location should be in C:\MOSIP\pre-registration-ui\pre-registration-ui\proxy.conf.json project folder.

    {
     "/proxyapi": {
      "target": "https://{env}/",
      "secure": true,
      "changeOrigin": true,
      "pathRewrite": {
        "^/proxyapi": ""
          }
        }
      }
  3. Start the server by executing ng serve --proxy-config proxy.conf.json --ssl true.

  4. Open the browser, load the app with https://localhost:4200.

Pre-registration API

  1. For API documentation, refer here.

  2. The APIs can be tested with the help of Swagger-UI and Postman.

  3. Swagger is an interface description language for describing restful APIs expressed using JSON. You can access Swagger-UI of pre-registration here:

    • Pre-registration Application service : https://{env}/preregistration/v1/application-service/swagger-ui.html

    • Pre-registration Datasync Service : https://{env}/preregistration/v1/sync/datasync-service/swagger-ui.html

    • Pre-registration Captcha service : https://{env}/preregistration/v1/captcha/swagger-ui.html

    • Pre-registration Booking service : https://{env}/preregistration/v1/appointment/booking-service/swagger-ui.html

Last updated

Copyright © 2021 MOSIP. This work is licensed under a Creative Commons Attribution (CC-BY-4.0) International License unless otherwise noted.

#300: Mock Services -1st draft

Change request updated