Sha256: 64200eb25e71024ecabd6c8f8e9825ba56821cba013fea3d64a71556a7341b0b

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

=begin rdoc
  Installs tokyo tyrant, tokyo cabinet and lightcloud. 
  
  It creates a basic config.py file that should probably be updated and made "smarter"
  
  Usage:
    enable :lightcloud
=end
module PoolParty
  module Plugin
    class LightCloud < Plugin
      
      def loaded o={}, &block
        enable
        install_gem if o.has_key?(:install_gem)
      end
      def enable
        enable :tokyo_tyrant
        
        install_lightcloud
        start_lightcloud
      end
      
      def install_lightcloud
        has_exec "svn co http://opensource.plurk.com/svn/opensource/lightcloud_manager ~/lightcloud_manager && cd ~/lightcloud_manager"

        has_file "~/lightcloud_manager/config.py" do
          render :erb
          content <<-EOC
DATA_DIR = '~/lightcloud_manager/data'
TOKYO_SERVER_PARMS = '#bnum=1000000#fpow=13#opts=ld'

USE_MASTER = True

<% %x[/usr/bin/server-list-active internal_ip].split("\t").each_with_index do |ip, index| %>
NODES = {
    #Lookup nodes
    'lookup1_<%= index -%>': { 'id': <%= index %>, 'host': '127.0.0.1:41201', 'master': '127.0.0.1:51201' },

    #Storage nodes
    'storage1_<%= index -%>': { 'id': <%= index + 1 %>, 'host': '127.0.0.1:41201', 'master': '127.0.0.1:51201' },
<% end %>
}          
          EOC
end
      end
      
      def start_lightcloud
        has_exec "python -m manager all start"
      end
      
      def install_gem
        has_gem_package "mitchellh-lightcloud"
      end
      
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
auser-poolparty-extensions-0.0.7 lib/extensions/lightcloud.rb
auser-poolparty-extensions-0.1.1 lib/extensions/lightcloud.rb
jashmenn-poolparty-extensions-0.0.7 lib/extensions/lightcloud.rb
jashmenn-poolparty-extensions-0.1.0 lib/extensions/lightcloud.rb
jashmenn-poolparty-extensions-0.1.1 lib/extensions/lightcloud.rb