Sha256: f15259b877f54b7a8496347cad984b2a9aeddf4d01cd7b8e86084f74a7e225e6

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

namespace :rubber do
  
  namespace :zookeeper do
    
    rubber.allow_optional_tasks(self)
    
    after "rubber:install_packages", "rubber:zookeeper:install"
  
    task :install, :roles => :zookeeper do
      rubber.sudo_script 'install_zookeeper', <<-ENDSCRIPT
        if [[ ! -d "#{rubber_env.zookeeper_install_dir}" ]]; then
          # Fetch the sources.
          wget -qNP /tmp #{rubber_env.zookeeper_package_url}
          tar -C #{File.dirname rubber_env.zookeeper_install_dir} -zxf /tmp/#{File.basename rubber_env.zookeeper_package_url}

          rm -f /tmp/#{File.basename rubber_env.zookeeper_package_url}
        fi
      ENDSCRIPT
    end

    after "rubber:bootstrap", "rubber:zookeeper:bootstrap"

    task :bootstrap, :roles => :zookeeper do
      exists = capture("echo $(ls #{rubber_env.zookeeper_data_dir} 2> /dev/null)")
      if exists.strip.size == 0
        rubber.update_code_for_bootstrap
        rubber.run_config(:file => "role/zookeeper/", :force => true, :deploy_path => release_path)

        restart
      end
    end
    
    desc <<-DESC
      Starts the zookeeper daemon
    DESC
    task :start, :roles => :zookeeper do
      rsudo "service zookeeper start"
    end
    
    desc <<-DESC
      Stops the zookeeper daemon
    DESC
    task :stop, :roles => :zookeeper do
      rsudo "service zookeeper stop || true"
    end
    
    desc <<-DESC
      Restarts the zookeeper daemon
    DESC
    task :restart, :roles => :zookeeper do
      stop
      start
    end
    
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubber-2.2.2 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.2.1 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.2.0 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.1.2 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.1.1 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.1.0 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.0.8 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.0.7 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.0.6 templates/zookeeper/config/rubber/deploy-zookeeper.rb
rubber-2.0.5 templates/zookeeper/config/rubber/deploy-zookeeper.rb