Installing Usergrid in production on Ubuntu Trusty
Usergrid doesn’t have to have a HUGE amount of documentation just yet.
In particular, I noticed that most articles specify that the instructions are for local development or testing only, so it’s kind of weird because you have no idea what do if you want to use the software in production (or at least I didn’t).
I first looked here: http://usergrid.incubator.apache.org/docs/deploy-local/, but like I was saying it doesn’t even mention running Usergrid in production.
I also stumbled upon this: https://groups.google.com/forum/#!topic/usergrid/PMTWd16oPVk. It’s a great list of instructions to do exactly what I want—install Usergrid in production. It’s pretty recent, and provide a series of steps you can follow.
There are also solutions that use Vagrant, Apache Brooklyn, etc., but I wanted to install everything by hand to learn more about the stack and what the moving parts are.
Eventually, I was able to get it working by looking at the source code and with a few hours of trial and error.
Both on Usergrid’s website and in the repository READMEs there are lots of broken links, and instructions are vague and sometimes outdated (many times they refer to files and directories that aren’t there anymore, or at least I couldn’t find them), so that complicated things somewhat.
I started with this: https://github.com/apache/incubator-usergrid and http://usergrid.incubator.apache.org/docs/deploy-local/. Then, just kept trying things, googling if I couldn’t figure it out (there seem to be a few folks that are having difficulties with deploying to production).
Here is what worked for me.
Distribution/ server setup
For my project, I settled with Linux—of course, and more specifically Ubuntu Trusty.
From my limited experience on Ubuntu things seem to be easier to configure than on RHEL. Compared to Debian, things seem to work out of the box more often.
I also picked Trusty because it just came out, and it’s LTS (Long Term Support).
I’m probably wrong and it’s personal preference anyway, but that’s what I got. Everything I’ve tried on Trusty 64 only. Things should work in a similar fashion on Debian, and probably completely differently on RHEL/CentOS.
I did the initial server setup, ready to roll.
1. install Cassandra (cluster)
Usergrid is based the awesome NoSQL distributed databases Cassandra.
So, first you have to install Cassandra.
2. install Tomcat
Tomcat is very easy to install on Trusty. You can get it setup in seconds using apt-get, although creating a cluster is a little more complicated.
I decided to start with a single instance (instructions here).
3. build the app
You have to configure and build the application with Maven: instructions here.