Sha256: 37cb8c7dcc2afc03ec2fc91aadb677afbb72f85047823d083e98fbf467d9a907

Contents?: true

Size: 1.65 KB

Versions: 2

Compression:

Stored size: 1.65 KB

Contents

namespace :rubber do

  namespace :elasticsearch do

    rubber.allow_optional_tasks(self)

    after "rubber:install_packages", "rubber:elasticsearch:install"

    task :install, :roles => :elasticsearch do
      rubber.sudo_script 'install_elasticsearch', <<-ENDSCRIPT
        if [[ ! -d "#{rubber_env.elasticsearch_dir}" ]]; then
          wget --no-check-certificate -qNP /tmp http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-#{rubber_env.elasticsearch_version}.zip
          unzip -d #{rubber_env.elasticsearch_prefix} /tmp/elasticsearch-#{rubber_env.elasticsearch_version}.zip
          rm /tmp/elasticsearch-#{rubber_env.elasticsearch_version}.zip

          #{rubber_env.elasticsearch_dir}/bin/plugin -install mobz/elasticsearch-head
          
        fi
      ENDSCRIPT
    end

    after "rubber:bootstrap", "rubber:elasticsearch:bootstrap"

    task :bootstrap, :roles => :elasticsearch do
      exists = capture("echo $(ls /etc/init/elasticsearch.conf 2> /dev/null)")
      if exists.strip.size == 0
        # After everything installed on machines, we need the source tree
        # on hosts in order to run rubber:config for bootstrapping the db
        rubber.update_code_for_bootstrap
        rubber.run_config(:file => "role/elasticsearch/", :force => true, :deploy_path => release_path)

        restart
      end
    end

    task :start, :roles => :elasticsearch do
      rsudo "service elasticsearch status || service elasticsearch start"
    end

    task :stop, :roles => :elasticsearch do
      rsudo "service elasticsearch stop || true"
    end

    task :restart, :roles => :elasticsearch do
      stop
      start
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubber-2.2.4 templates/elasticsearch/config/rubber/deploy-elasticsearch.rb
rubber-2.2.3 templates/elasticsearch/config/rubber/deploy-elasticsearch.rb