Skip to content

Instantly share code, notes, and snippets.

@pulkitsinghal
Forked from karmi/.gitignore
Created May 29, 2012 00:14
Show Gist options
  • Save pulkitsinghal/2821820 to your computer and use it in GitHub Desktop.
Save pulkitsinghal/2821820 to your computer and use it in GitHub Desktop.
Bootstrap, install and configure ElasticSearch with Chef Solo
echo -e "\nInstalling development dependencies and essential tools..." \
"\n===============================================================================\n"
yum install gcc gcc-c++ make automake install ruby-devel libcurl-devel libxml2-devel libxslt-devel vim tree curl git -y
echo -e "\nInstalling Rubygems..." \
"\n===============================================================================\n"
yum install rubygems -y
echo -e "\nInstalling and bootstrapping Chef..." \
"\n===============================================================================\n"
if ! which chef-solo 2>&1 > /dev/null; then gem install chef --version 0.10.8 --no-rdoc --no-ri; fi
mkdir -p /etc/chef/
mkdir -p /var/chef-solo/site-cookbooks
mkdir -p /var/chef-solo/cookbooks
if test -f /tmp/solo.rb; then mv /tmp/solo.rb /etc/chef/solo.rb; fi
echo -e "\nDownloading cookbooks..." \
"\n===============================================================================\n"
if ! test -d /var/chef-solo/site-cookbooks/monit; then
curl -# -L -k http://s3.amazonaws.com/community-files.opscode.com/cookbook_versions/tarballs/915/original/monit.tgz | tar xz -C /var/chef-solo/site-cookbooks/
fi
if ! test -d /var/chef-solo/cookbooks/elasticsearch; then
git clone git://github.com/pulkitsinghal/cookbook-elasticsearch.git /var/chef-solo/cookbooks/elasticsearch
else
cd /var/chef-solo/cookbooks/elasticsearch
git fetch
git reset origin/master --hard
fi
echo -e "\n*******************************************************************************\n" \
"Bootstrap finished" \
"\n*******************************************************************************\n"
# Patch Monit cookbook problems
mkdir -p /etc/monit/conf.d/
rm -f /etc/monit.conf
touch /etc/monit/monitrc
chmod 700 /etc/monit/monitrc
ln -nfs /etc/monit/monitrc /etc/monit.conf
{
"run_list": [
"recipe[monit]",
"recipe[elasticsearch]",
"recipe[elasticsearch::plugin_couchdb]",
"recipe[elasticsearch::plugin_aws]"
],
"elasticsearch" : {
"cluster_name" : "elasticsearch_test_with_chef",
"discovery" : {
"type": "ec2"
},
"gateway" : {
"type" : "s3",
"s3" : {
"bucket": "REPLACE-elasticsearch-test-with-chef"
}
},
"cloud" : {
"aws" : {
"access_key": "REPLACE",
"secret_key": "REPLACE"
},
"ec2" : {
"security_group": "elasticsearch-test"
}
}
},
"monit" : {
"notify_email" : "REPLACE@mail.com",
"mail_format" : {
"from" : "monit@amazonaws.com",
"subject" : "[monit] $SERVICE $EVENT on $HOST",
"message" : "$SERVICE $ACTION: $DESCRIPTION"
}
}
}
{
"run_list": [
"recipe[elasticsearch::plugin_head]"
],
"elasticsearch" : {
"cluster_name" : "elasticsearch_test_with_chef"
}
}
{
"run_list": [
"recipe[elasticsearch::plugin_jetty]"
],
"elasticsearch" : {
"cluster_name" : "elasticsearch_test_with_chef"
}
}
{
"run_list": [
"recipe[elasticsearch::plugin_couchdb_config]"
],
"elasticsearch" : {
"cluster_name" : "elasticsearch_test_with_chef",
"adminUsername" : "REPLACE",
"adminPassword" : "REPLACE",
"plugin" : {
"river" : {
"couchdb" : {
"protocol" : "https",
"host" : "REPLACE.REPLACE.com",
"port" : 443,
"no_verify" : true,
"user" : "REPLACE",
"password" : "REPLACE",
"db" : "REPLACE",
"ignore_attachments" : true,
"index" : "REPLACE_index",
"type" : "REPLACE_type",
"bulk_size" : 100,
"bulk_timeout" : "10ms"
}
}
}
}
}
file_cache_path "/var/chef-solo"
cookbook_path ["/var/chef-solo/site-cookbooks", "/var/chef-solo/cookbooks"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment