Class: PoolParty::Plugin::LightCloud

Inherits:
PoolParty::Plugin show all
Defined in:
lib/extensions/lightcloud.rb

Instance Method Summary collapse

Instance Method Details

#enableObject



17
18
19
20
21
22
# File 'lib/extensions/lightcloud.rb', line 17

def enable
  enable :tokyo_tyrant
  
  install_lightcloud
  start_lightcloud
end

#install_gemObject



52
53
54
# File 'lib/extensions/lightcloud.rb', line 52

def install_gem
  has_gem_package "mitchellh-lightcloud"
end

#install_lightcloudObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/extensions/lightcloud.rb', line 24

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 "DATA_DIR = '~/lightcloud_manager/data'\nTOKYO_SERVER_PARMS = '#bnum=1000000#fpow=13#opts=ld'\n\nUSE_MASTER = True\n\n<% %x[/usr/bin/server-list-active internal_ip].split(\"\\t\").each_with_index do |ip, index| %>\nNODES = {\n    #Lookup nodes\n    'lookup1_<%= index -%>': { 'id': <%= index %>, 'host': '127.0.0.1:41201', 'master': '127.0.0.1:51201' },\n\n    #Storage nodes\n    'storage1_<%= index -%>': { 'id': <%= index + 1 %>, 'host': '127.0.0.1:41201', 'master': '127.0.0.1:51201' },\n<% end %>\n}          \n    EOC\nend\nend\n"

#loaded(o = {}, &block) ⇒ Object



13
14
15
16
# File 'lib/extensions/lightcloud.rb', line 13

def loaded o={}, &block
  enable
  install_gem if o.has_key?(:install_gem)
end

#start_lightcloudObject



48
49
50
# File 'lib/extensions/lightcloud.rb', line 48

def start_lightcloud
  has_exec "python -m manager all start"
end