Getting NodeBB and plugins setup with Heroku (and MongoDB)

Trying to setup NodeBB with Heroku

Originally I had a lot of problems trying to get NodeBB as a Heroku app running, so I thought I would make a guide on how I did it in case anyone else runs into the same issues I faced.
Full disclosure: Running Windows 8.1 Pro and I am inexperienced with Heroku, NodeJS, git and all this. But this is what I had to do to get my setup working, I hope it can help someone.

Step 6) If you have a mongoDB already you can use that information instead
But if you don't have one and still want to try out NodeBB with Heroku (and if you MUST use Heroku with MongoDB, I'd say it seems there are easier alternatives) you can setup a Sandbox MongoLab DB for now:Step 6.a) In command prompt while logged into Heroku with the right appheroku addons:create mongolabStep 6.b) After it has been created, check your config variables:heroku configIf your MongoLab addon got added correctly it will show you your MongoDB informationMONGODB_URI => mongodb://mongoDB_username:mongoDB_password@mongoDB_host:mongoDB_port/mongoDB_dbSince this is pulled from your Heroku config variables there might be an easier way of getting your DB information from there into NodeBB, and it would make it a lot easier if your mongoDB host or information changes for whatever reason.

Step 7) If everything has gone through without error, it's time to setup nodeBBnode app --setupThis is where you will tell NodeBB what Heroku App URL and database to useURL: https://appname.herokuapp.com/HOST IP / Address: mongoDB_hostPort: mongoDB_portMongoDB Username: mongoDB_usernamePassword: mongoDB_passwordDatabase to use: mongoDB_db

Step 8.) Create the Procfile for Herokuecho web: node app.js > Procfile
The documentation tells you to type echo "web: node loader.js --no daemon", but this didn't work for me.
Repeatedly crashed on trying to start up, and so this workaround allowed me to start it and run it fine.However, it prevents the use of the Restart app functionality in the Admin API!(Reload still seems to work))Having to restart the Heroku app manually every time you want to install a plugin will also cause some issues as covered under the Plugins section.

Installing Plugins

Now to install plugins on a NodeBB running on Heroku seems to be a bit different since you can't do it through their Admin API.
Your plugin will gone on restart because Heroku doesn't save your generated files permanently!
So instead you will have to install a plugin as a dependency so it gets included with the build, for this example I will use the Gravatar plugin, because as you might have guessed, Heroku wont save your avatars that are uploaded either. (NodeBB will save the URL reference to database, resulting in broken images)

Step 1) Install the nodebb-plugin-gravatar as a dependency and save it to the package.jsonnpm install nodebb-plugin-gravatar --save
Step 2) Commit the package.json to the next pushgit add -f package.json && git commit -am "updating package.json"
Step 3) If you've installed all your desired plugins then you can push it to Heroku again and then activate your plugins through the NodeBB Admin APIgit push heroku v1.x.x:master

You will have to locally add the images to the appropriate folders such as the site logo for example (upload/system/site-logo.png) because if you upload them through the Admin API they will also disappear due to how Heroku stores files