Skip to content

NodeBB setup without Open edX

HamzaIbnFarooq edited this page Jan 27, 2020 · 5 revisions

NodeBB setup without open edX

Sometimes, developers need to use this NodeBB-Plugin along with NodeBB without setting up open edX, this guide helps them to do so.

Prerequisites:

  • node version 8.12
  • MongoDB version 4.0

Installation:

Configuring MongoDB:

mongo # You may need root user to login
use nodebb
db.createUser({user:"nodebb",pwd:"<ENTER-A-SECURE-PASSWORD eg: password>",roles:[{role:"readWrite",db:"nodebb"},{role:"clusterMonitor",db:"admin"}]})
quit()

Create a directory (let's say nodebb):

mkdir nodebb_devstack
cd nodebb_devstack

Clone NodeBB and nodebb-plugin-openedx-discussion:

git clone [email protected]:NodeBB/NodeBB.git
git clone [email protected]:edly-io/nodebb-plugin-openedx-discussion.git

cd NodeBB
git checkout v1.12.x
cd ..

Configure NodeBB with MongoDB by placing following json in config.json at root of NodeBB directory:

{
    "url": "<IP-TO-RUN-NODEBB eg: http://127.0.0.1:4567 >", 
    "secret": "<APP-SECRET eg: aaaa8662-bb9a-4f8b-b4bb-e1ffe88fecda >",
    "database": "mongo",
    "port": "<NODEBB-PORT eg: 4567 >",
    "mongo": {
        "host": "<MONGODB-IP eg: 127.0.0.1 >",
        "port": "<MONGODB-PORT eg: 27017 >",
        "username": "<MONGODB-USERNAME eg: nodebb >",
        "password": "<PASSWORD-OF-USER eg: password >",
        "database": "nodebb",
        "uri": ""
    }
}

Setup NodeBB and create Admin user:

ADMIN_USER=$(cat  << EOF
    {
        "admin:username":"admin",
        "admin:password":"admin1234",
        "admin:password:confirm":"admin1234",
        "admin:email":"[email protected]"
    }
EOF
)

cd NodeBB
./nodebb upgrade
./nodebb setup "$ADMIN_USER"
./nodebb build
cd ..

Link nodebb-plugin-openedx-discussion:

cd nodebb-plugin-openedx-discussion
npm link

cd ..
cd NodeBB
npm link nodebb-plugin-openedx-discussion

cd node_modules/nodebb-plugin-openedx-discussion
npm i
npm i module-alias
npm i winston

cd ../..
./nodebb activate nodebb-plugin-openedx-discussion

./nodebb build

Now run Nodebb:

npm i grunt-cli
npx grunt