Backendless. Hipsterless. Painful.
You’d better RTFM and consider my story as a set of comments on my adventures with that manual in June of 2017.
The Usergrid Stack is a Java EE web application that runs on Tomcat, uses the Cassandra database for storage and the ElasticSearch search-engine for queries.
Before installing the Usegrid Stack into Tomcat, you’ll start by setting up the database and search engine nodes.
First of all you’ll need Cassandra.
For storage purposes I setup a separate Ubuntu instance that will become a Cassandra single node cluster.
The setup is simple and described in Cassandra official docs or in digital ocean tutorials(they seem more hipster-friendly)
Next step is Elastic Search
And again, I used Digital Ocean tutorials
The same thing with Tomcat.
Usergrid seems to need Tomcat 7 or later that’s why I decided to try 8 and see what will happen.
And immediately I faced a problem with usergrid config. It seemed not to pick up config file usergrid-deployment.propertiesduring deployment to tomcat. No matter if I put them where docs said or followed various advices from internet. It was not connecting neither to elasticsearch nor to cassandra.
There were several issues in the internet concerning this problem and a couple of possible solutions:
- Build from sources yourself and usergrid may begin to pickup configs.
- Build from sources yourself and replace default config file.
God bless java developers, building from sources wasn’t painful. Except 4 lines that were not mentioned in building docs:
cd ~\usergrid\sdks\javamvn installcd ..\..\stackmvn install -DskipTests=true
Well. More detailed look at logs showed that it Did pick up configs if they were in …./tomcat/lib/ even before my rebuilds. =(
My Cassandra node and usergrid backend were on different instances and after more logs smoking it turned out that the problem was in Cassandra configs and it’s bind address.
But nevertheless I learned how to build usergrid and now it was time for taking off!
Not yet. Again usergrid couldn’t start under Tomcat. And I decided to wipe Tomcat8 and try Tomcat7. And It worked (!)
The next problem was in Elastic Search. Logs showed an exception on connection attempt. I reinstalled the same version of ES that was in usergrid docs : 1.7.2 instead of the newest 5.4.x о_О
And it finally worked!
Now I possibly had the best backend for my apps in the whole world.
This dreamteam of Java Usergrid Monster with Cassandra seems to be rather hungry.
Thanks to my previous season’salgo-trading project I had a heritage, consisting of a dedicated host with 64 GB of RAM, huge ssd and vivid CPU.
It has been a good bargain one day, so it’s pretty sorrowful for me just to let it go. I decided to utilise it for my later adventures.
I’ve already had a virtualisation setup that I decided to use.
It allows to have more or less separated virtual hosts, living on one instance and share resources between them in automatic or manual manner.
Previously, that setup fitted all my needs like a charm.
- I could guarantee RAM resources for more critical processes.
- I could create new hosts with limited access rights and share them with some other people. I was using this option for creating brokerage account login instances that were running on Ubuntu with GUI. For Research, trading algos and data storage I was using gui-less *nix instances.
I’ve spent some time on ESXi hypervisor and that was pretty unpleasant. It turned out to be just one more *nix based hypervisor and, unfortunately, hardware-fastidious. I couldn’t use up-to-date version of it because my network card hardware just wasn’t supported in latest versions. ESXi also doesn’t support network routing, so I had to setup a separate virtual host that routed traffic to other virtual hosts. So much pain.
Then I moved to Proxmox VE and that was great.
If you are suddenly diving into that special kind of hipster-developer hell, I strongly recommend hetznermanuals. And this special great manualof configuring network for virtual hosts behind NAT with ports forwarding and DHCP. That was enough to setup everything and saved weeks of googling.
Pros and cons of having your own host comparing to AWS or digital ocean are obvious.
Anyway, it’s pretty cool exercise with rather satisfying aftertaste, when everything works at last.