Skip to content

Latest commit

 

History

History
126 lines (92 loc) · 4.83 KB

README.md

File metadata and controls

126 lines (92 loc) · 4.83 KB

Sunbird-notification-service

Codacy Badge

This is the repository for notification service micro-service. It provides the APIs for notification service functionality of Sunbird.

The code in this repository is licensed under MIT License unless otherwise noted. Please see the LICENSE file for details. This readme file describes how to install and start groups-service in your development environment.

Sunbird-notification-service development environment setup:

This readme file contains the instruction to set up and run the Sunbird-notification-service in your development environment.

System Requirements

Prerequisites

  • Java 11
  • Latest Docker
  • Latest Maven (Only For Mac m1 users use 3.8.8 Maven version)

Prepare folders for database data and logs

To prepare folders for database data and logs, run the following command:

mkdir -p ~/sunbird-dbs/cassandra ~/sunbird-dbs/es 
export sunbird_dbs_path=~/sunbird-dbs

To verify the creation of folders, run:

echo $sunbird_dbs_path

Cassandra database setup in Docker

  1. To get the Cassandra image, use the following command:
docker pull cassandra:3.11.6 

For Mac M1 users follow the bellow command:

docker pull --platform=linux/amd64 cassandra:3.11.6 

For the network, you can either use an existing network or create a new one by executing the following command:

docker network create sunbird_db_network
  1. To create the Cassandra instance, run the following command:
docker run -p 9042:9042 --name sunbird_cassandra \
 -v $sunbird_dbs_path/cassandra/data:/var/lib/cassandra \
 -v $sunbird_dbs_path/cassandra/logs:/opt/cassandra/logs \
 -v $sunbird_dbs_path/cassandra/backups:/mnt/backups \
 --network sunbird_db_network -d cassandra:3.11.6 

For Mac M1 users follow the below command:

docker run --platform=linux/amd64 -p 9042:9042 --name sunbird_cassandra \
 -v $sunbird_dbs_path/cassandra/data:/var/lib/cassandra \
 -v $sunbird_dbs_path/cassandra/logs:/opt/cassandra/logs \
 -v $sunbird_dbs_path/cassandra/backups:/mnt/backups \
 --network sunbird_db_network -d cassandra:3.11.6 
  1. To verify the setup, run the following command, which will show the status of Cassandra as up and running:
docker ps -a | grep cassandra

To create/load keyspaces and tables to Cassandra

Click the link sunbird-utils-cassandra-setup and follow the steps for creating/loading the Cassandra keyspaces and tables to your development environment.

Note: It is mandatory to follow the instructions provided in the link.

  1. To verify the creation of keyspaces and tables, connect to the Cassandra Docker container using SSH and run the following command:
docker exec -it sunbird_cassandra /bin/bash

Sunbird-notification-service Setup

To set up the notification service, follow the steps below:

  1. Clone the latest branch of the notification service using the following command:
git clone https://github.com/Sunbird-Lern/sunbird-notification-service
  1. Set up the necessary environment variables by running the following script in the path <project-base-path>/sunbird-notification-service:
./scripts/notification-service-config.sh
  1. Build the application using the following maven command in the path <project-base-path>/sunbird-notification-service:
mvn clean install -DskipTests

Make sure the build is successful before proceeding to the next step. If the build is not successful, fix any configuration issues and rebuild the application.

  1. Run the netty server using the following maven command in the path <project-base-path>/sunbird-notification-service/service:
mvn play2:run
  1. Verify the database connections by running the following command:
curl --location --request GET 'http://localhost:9000/health’

If all connections are established successfully, the health status will be shown as 'true', otherwise it will be 'false'.

Currently, the sunbird-notification-service service is dependent on User org service for getting user and organisation information. We are planning to implement a mock service soon for these dependencies.

To make the notification service completely working, some pre-required configuration setup is mandatory. Follow the steps given in the link pre-required configuration setup to complete the setup.