[Weekend Project] MongoDB Database Setup

I began this weekend hoping to finally start working on a bi-directional client/server setup. So far all I have been really doing is writing server software and only recently, with the CSV parser/spreadsheet, did I setup a client to actually do anything.

As usual my thoughts first went to a chat app. More and more I think it’d be such a fun and (relatively) simple project to setup a rudimentary Slack clone. Pretty much a glorified IRC chat with hashtags and private messages.

I explored many ways of implementing this. First I thought it’d be smart to use XMPP for the backbone of the messaging but quickly realized that everything I wanted XMPP to replace would have to be replicated by the server or I’d be doing nothing but designing an XMPP client. Then I decided maybe it’d be better to just design an XMPP gateway later, and instead create a custom server setup now to handle it all in Node.

This led me to have to start thinking about how I would store and save data. One of the drawbacks for XMPP for me was my initial impression that creating this kind of archived chat/IM service was more of a hack and I was pretty confused on how I’d achieve the ability to just load up rooms and save history without crazy server overhead. A database would need to be fast and well supported for use with Node. Obviously MongoDB showed up over and over.

I decided to give it a try and setup MongoDB on the Pi. Seems I already attempted this once or something because I had to uninstall an existing package. I tried to use this great tutorial by Andy Felong that, while I am sure is helpful to install MongoDB on a fresh install of Raspbian, was not helpful to me because I quickly realized that something was whack about my environment that caused it to pretty much crap out when following his instructions.

This ultimately led me to give Docker a try again. I already use a customized Docker image for my Cloud9 implementation (thanks hwegge2) and somehow managed to get it working perfectly. I had many issues, however, when I tried to setup a Eclipse Che environment on Docker though that probably had a lot to do with the simple fact that I was pretty much diving head first into Docker instead of learning with a more ‘ground up’ approach.

24 hours later, I finally got a MongoDB image setup that appears to work perfectly and accessible via node and outside of the local network. Fantastic. In the end, I just used the Raspbian library with a simple apt-get install. It was a crash course in learning how to use the VOLUME capabilities of Docker, the command line, and general Dockerfile syntax.

Feel free to checkout the Dockerfiles I made on my GitHub and give it a try yourself. Now to find the energy to actually start working on the server.

Like what you read? Give David a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.