Monday, March 23, 2015

Stackato: Installing Elasticsearch on Stackato v.3.4.2

Stackato: Installing Elasticsearch on Stackato v3.4.2

I am working on Stackato CloudFoundry support on OpenStack cloud.This is my daily job to bring more applications to the OpenStack clouds and I like it. I never used CloudFoundry and other PaaSes so I took a chance to play with Stackato version of CloudFoundry and tried to use it in my home project. I have a good library of  electronic books in different formats, so I decided to create a library with search capabilities. For that I decided to use another cool technology called Elasticsearch. There is no Elasticsearch service in Stackato distribution, but there is a repository with Elasticserarch service here: https://github.com/ActiveState/stackato-service-elasticsearch

I decided to use this repository to install a new Elasticserach service to my single node Stackato and a new adventure began.

I cloned the stackato-service-elasticsearch repository and executed two command I found in the documentation. It failed. Apparently, this repo contains the code which worked on the previous Stackato version but it does not work on the version  3.4.2. I dug into the logs and it looked like that the main problem is in Gemfile which asks for some old versions of components required.

I am not Ruby expert at all and all my knowledge of Ruby is actually bound to the knowledge of the fact that it exists. So I decided to go straight and just remove Gemfile.lock file which is commited to the repository and modify Gemfile by updating components versions to the version I saw in other Stackato services I found under /s/code/services/. After couple tries I did this successfully, so I had to recover the node from the backup only once :-)

You can find fixed version of Stackato Elasticsearch service here: https://github.com/gokrokvertskhov/stackato-service-elasticsearch.git 
I added tag to the version of the code which is working on Stackato v.3.4.2

Here is a quick step by step instructions for installation:
  1.  git clone https://github.com/gokrokvertskhov/stackato-service-elasticsearch.git
  2. cd  stackato-service-elasticsearch
  3. nano config/node.yml  Change mbus address here.
  4. nano config/gateway.yml  
    • Change cloud_controller_uri to proper domain name of your target. 
    • Change ip_route to ip address where elasticsearch will be exposed. 
    • Change mbus  ip address
  5. sudo ./scripts/install-elasticsearch.sh
  6. ./scripts/bootstrap.sh
  7. kato config get elasticsearch_gateway token 
    • copy the token
  8. stackato create-service-auth-token elasticsearch core --auth-token <PasteTokenHere>
  9. kato restart elasticsearch
  10. stackato services
    • verify that elasticsearch is in a list of available plans
Hope this helps!

Follow me on twitter: @gokrokve


No comments:

Post a Comment