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.
This readme file contains the instruction to set up and run the Sunbird-notification-service in your development environment.
- Java 11
- Latest Docker
- Latest Maven (Only For Mac m1 users use 3.8.8 Maven version)
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
- 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
- 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
- To verify the setup, run the following command, which will show the status of Cassandra as up and running:
docker ps -a | grep 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.
- 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
To set up the notification service, follow the steps below:
- Clone the latest branch of the notification service using the following command:
git clone https://github.com/Sunbird-Lern/sunbird-notification-service
- 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
- 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.
- Run the netty server using the following maven command in the path
<project-base-path>/sunbird-notification-service/service
:
mvn play2:run
- 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.