Helper files for the https://gist.github.com/2050769 gist
This repository contains files tailored for bootstrapping, installing and configuring ElasticSearch with Chef Solo on the Ubuntu operating system.
After you have downloaded the files, edit the node configuration:
$EDITOR node_ubuntu.json
Set up the SSH connection properly:
HOST=<REPLACE WITH YOUR SERVER IP>
KEY=<REPLACE WITH PATH TO YOUR SSH KEY>
USER=ubuntu
PORT=22
SSH_OPTIONS="-o User=$USER -o IdentityFile=$KEY -o Port=$PORT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
And test that it's working:
ssh $SSH_OPTIONS $HOST "date"
Now, copy the files to the machine and execute the bootstrap script:
scp $SSH_OPTIONS bootstrap_ubuntu.sh node_ubuntu.json solo.rb $HOST:/tmp
time ssh -t $SSH_OPTIONS $HOST "sudo bash /tmp/bootstrap_ubuntu.sh"
Execute the Chef Solo run:
time ssh -t $SSH_OPTIONS $HOST "sudo su - root -c 'chef-solo --node-name elasticsearch-test-ubuntu -j /tmp/node_ubuntu.json'"
Check that the installation and configuration succeeded (you may need to wait couple of minutes until Monit starts):
ssh -t $SSH_OPTIONS $HOST "sudo service elasticsearch status -v"
ssh -t $SSH_OPTIONS $HOST "sudo monit reload && sudo monit status -v"
curl http://USERNAME:PASSWORD@$HOST:8080
Now, you can eg. test that Monit is, in fact, working. Kill the ElasticSearch process:
ssh -t $SSH_OPTIONS $HOST "cat '/usr/local/var/run/elasticsearch/elasticsearch_test_ubuntu.pid' | xargs -0 sudo kill -9"
Wait couple of minutes and check the status:
ssh -t $SSH_OPTIONS $HOST "sudo monit reload && sudo monit status -v"
See the original gist for more information.
It would be best to use https://www.opscode.com/chef/install.sh on line 29 of bootstrap_ubuntu.sh.