Discussion Forum: NodeBB setup
This document will help to setup, config and use NodeBB
Background
Discussion Forum library uses NodeBB for for DB related operations. So NodeBB needs to be installed for local development.
Local setup of Sunbird-Discussion-UI(playgroung application)
Refer NodeBB installation steps for more info.
Prerequisites
NodeJS should be installed (version 14+ recommended)
MongoDB should be installed
Steps to install NodeBB
create two users using mongo Shell
mongo
use admin
db.createUser( { user: "admin", pwd: "Test@321", roles: [ { role: "root", db: "admin" } ] } )
use nodebb
db.createUser( { user: "nodebb", pwd: "Test@321", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )
2. Clone the NodeBB repo in your local
git clone -b v1.16.x https://github.com/NodeBB/NodeBB.git nodebb
cd nodebb
3. run NodeBB setup and use admins username and password
./nodebb setup
4. start NodeBB
./nodebb start
5. build NodeBB
./nodebb build
6. You can see the NodeBB UI in:
http://localhost:4567
Nodebb setup using script
Create a
nodebb.sh
file and add the below snippet into file.
echo ">> Nodebb cloning..."
git clone -b v1.16.x https://github.com/NodeBB/NodeBB.git nodebb
echo ">> Nodebb clone completed!"
cd nodebb
echo ">> Nodebb setup..."
./nodebb setup
echo ">> Nodebb setup completed"
echo ">> Installing nodebb plugins....."
npm install https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-oidc.git#master
npm install https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-api.git#release-4.2.0
npm install https://github.com/NodeBB/nodebb-plugin-write-api.git#master
echo ">> Plugin instalation completed"
echo ">> Activating nodebb plugins..."
./nodebb activate nodebb-plugin-create-forum
./nodebb activate nodebb-plugin-sunbird-oidc
./nodebb activate nodebb-plugin-write-api
echo ">> Plugins are activated"
./nodebb start
./nodebb build
open http://localhost:4567
Run the script file using command
bash nodebb.sh
.While running the script, nodebb will ask below question for initial setup.
>> URL used to access this NodeBB (http://localhost:4567) : Press Enter >> Please enter a NodeBB secret (44abfc50-3d6a-4e6c-a258-9f551f9faa5a) : Press Enter >> Would you like to submit anonymous plugin usage to nbbpm? (yes) : Press Enter >> Which database to use (mongo) : redis Now configuring redis database: >> Host IP or address of your Redis instance (127.0.0.1) : Press Enter >> Host port of your Redis instance (6379) : Press Enter >> Password of your Redis database : Press Enter >> Which database to use (0..n) (0) : 3 (redis db number) Admin User details >> Administrator username : admin >> Administrator email address : admin@test.com >> Password : Your password >> Confirm Password : Your password
once setup completed, It will open browser with url http://localhost:4567.
you can login with admin credentials and setup got completed.