Nodebb setup
Before using the discussion forum we have to do below configurations.
Nodebb:
NodeBB is an open source project which can be forked on GitHub (Link). It have plugin support. We can create new plugins for our requirement and link to nodebb.
How to setup nodebb in local environment
Note: Before staring nodebb setup in local. check redis is up and running. If not start redis first and do the setup.
Step:1
Clone the nodebb repo
git clone -b v1.18.x https://github.com/NodeBB/NodeBB.git nodebbStep:2
Navigate to nodebb folder and do setup of nodebb using below command
./nodebb setupWhile running the setup, 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 : [email protected]
>> Password : Your password
>> Confirm Password : Your passwordStep:3
Now start the nodebb, Using below command.
./nodebb startStep:4
Build the nodebb using the below command.
If there is any code change, any admin pannel change or activating/deactivating of plugins then run the below command then your changes will apply.
./nodebb buildStep:5
Open the browser with fallowing link http://localhost:4567
Use full commands
./nodebb log -> To see the logs
./nodebb status -> To check is nodebb running or not
./nodebb activate plugin-name -> To activate the plugin
./nodebb reset -p plugin-name -> To reset/disable the plugin
./nodebb stop -> To stop nodebbMandatory Plugins
We have built our own plugins based on our need. We need to enable those plugins.
nodebb-plugin-create-forum
Contains all custom api
nodebb-plugin-sunbird-oidc
User login api
Activating Plugins
In this plugins, We added our own apis. Like User login, Enable discussion, read discussion context, disable discussion, user read based on sunbird id …. etc.
To activate plugin. Use below command.
Note: If you want to add any new api or modifing existing api go for plugin setup for local.
a. Using repo as a npm module.
npm install https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-api.git
./nodebb activate nodebb-plugin-create-forumb. Using from local
clone the repo
https://github.com/Sunbird-Ed/nodebb-plugin-sunbird-api.git`Execute command
npm installExecute command
npm linkGo to nodebb terminal and execute command
npm link nodebb-plugin-create-forumExecute command
./nodebb activate nodebb-plugin-create-forumAnd execute command
./nodebb build
Note: When you enable or disable any plugin, You have to rebuild and restart your nodebb. Then only the changes will reflects.
Do the same thing for other plugin.
Write api plugin
This in an important plugin, By using this we can do all write operation in nodebb. Like create category/topic/post, updating topic/post, delete topic/post…..etc.
Install nodebb-plugin-write-api
Login to nodebb as a admin user.
Go to admin pannel.
Go to
EXTEND => PLUGINS => FIND PLUGINSSearch for
nodebb-plugin-write-apiClick on
InstallRebuild and restart nodebb.
Reload the admin panel.
Go to
EXTEND => PLUGINS => INSTALLEDSearch for
nodebb-plugin-write-apiClick on
ActivateRebuild and restart nodebb.
What is Master token
To perform any write operations in nodebb we need write api plugin. And this plugin provides apis to do those write operations but If you want to use this apis we have to pass a master token (in request headers as Authorization token) and nodebb user id(add _uid as query param or with in request body ).
How to create master
Login to nodebb as a admin user.
Go to admin pannel.
Go to
PLUGINS => WRITE APILeft side panel you can see
MASTER TOKENSSection.Click on
CREATE TOKEN
Refer this link also: Nodebb Plugins.
Last updated
Was this helpful?