Working with Source Code
Last updated
Last updated
Use the project , java folder in it contains all the modules of registry as well as claims service
JDK version 1.8
Run the configure-dependencies.sh
script in the root of the repo as follows:
Then compile the registry (this will take some time when you are running it for the first time):
This should create a JAR file in the java/registry/target
folder.
Create _schemas/
folder in java/registry/src/main/resources/public/
Place all your schema files in the java/registry/src/main/resources/public/_schemas/
folder.
A sample set of schemas for a simple student-teacher registry can be found . You can learn how to write your own schemas by following .
Change directory to java
Run ./mvnw clean install
Use the required environment variables
These are the minimum required envs to run the application -
connectionInfo_uri, connectionInfo_username, connectionInfo_password, authentication_enabled
Check the registry service in docker-compose.yml file at the project folder for example and references
Rest of the environment variables depends on the features enabled
Run the spring boot application SunbirdRCApplication
in package dev.sunbirdrc.registry.app
, Use the IDE to configure and run or follow below steps -
cd to registry package
Export the environment variables
Run ../mvnw spring-boot:run
The feature services can be run anywhere and should be available to where we run. For local development, these can be run using docker-compose.yml file present in the project directory.
Encryption Service - encryption_enabled is true
Id Gen Service - idgen_enabled is true
All Credentials services -
When signature_enabled is set to true
Make sure to set did_enabled as true
certificate_enabled should be set to true to generate pdfs
signature_provider is set to dev.sunbirdrc.registry.service.impl.SignatureV2ServiceImpl
check the other envs starting with signature_v2_ and did_ in the configuration are set by default in the docker-compose.yml file
Old Credentialing services -
When signature is enabled and
signature_provider is set to dev.sunbirdrc.registry.service.impl.SignatureV2ServiceImpl
Keycloak Service -
check environment variables starts with sunbird_sso_ sunbird_keycloak and auth2_resource
ElasticSearch Service -
ElasticSearch version supported is v6
Required when search_providerName is set to dev.sunbirdrc.registry.service.ElasticSearchService
Use environment variables starting with elastic_search_ for custom configurations
Claims Service -
When claims_enabled is set to true
File Storage Service-
When filestorage_enabled is set as true
Check config starting with filestorage_ to configure
This uses minio, so it can be a cloud storage like s3 as well or a local minio service
Kafka & Zookeeper Service -
When using asynchronous features
async_enabled for creating entities asynchronously
Or when event_enabled for metrics service
Or when notification_enabled and notification_async_enabled are set to true
Metrics Service -
When event_enabled is set to true, check envs start with event_ to configure
Notification Service -
When notification_enabled is set to true, check envs start with notification_ to configure
Redis Service -
When using manager_type as DistributedDefinitionsManager
Check redis_ envs to configure
To download a minimal keycloak configuration, run the following:
Then start Keycloak (kc
), Postgres (db
), Elastic Search (es
) and the Claims Service (cs
) by running the following command:
Before we can start the registry, we need to regenerate and retrieve the client secret for the admin-api
client in Keycloak. To do that, follow these steps:
Go to http://localhost:8080/auth/admin/master/console/#/realms.
Login using the username admin
and password admin
.
Click Sunbird RC
.
Click Clients
in the panel on the left.
Click admin-api
.
Click the Credentials
tab.
Under Client Secret
, click Regenerate Secret
. Copy the secret that you see in the box and paste it in the docker-compose.yml
file in place of INSERT_SECRET_HERE
on line 42.
Let's say we use http://localhost:8080/auth to generate the token
Then use the above url to set as frontend url in keycloak and restart the registry service
Steps to set frontend url
Login to keycloak ui
Select realm sunbird-rc
Select general settings tab
Check for the field frontend url
Set as http://localhost:8080/auth
It should be changed when deploying as per DNS used to generate a token
Once you have completed all the above steps, run the registry using the following command:
It occurs due to prisma migration tables are not set and the database is not empty.
If it is possible to cleanup the database, then cleanup the database and then setup the identity service first.
Setup the Database and other
Environment variables starting with connectionInfo_ are for the database. Check the for more detailed environment variables description
Check the to configure environment variables for specific services. below are most of the services used and how they can be enabled and used -
When authentication_enabled is true and using in the schemas
Run the following in terminal to download Docker Compose file:
To fix in the production or where cleanup of the database is not possible, use this link to baseline the database and restart the identity, credential-schema, credential services.