auser-poolparty-extensions 0.0.3 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +20 -11
- data/Rakefile +113 -0
- data/VERSION.yml +1 -1
- data/lib/extensions/bash_alias.rb +14 -0
- data/lib/extensions/development_gem_package.rb +68 -0
- data/lib/extensions/dynomite.rb +5 -2
- data/lib/extensions/lightcloud.rb +58 -0
- data/lib/extensions/nanite.rb +46 -0
- data/lib/extensions/tokyo_tyrant.rb +29 -0
- metadata +14 -10
- data/lib/extensions/rails_deploy.rb +0 -57
data/README.rdoc
CHANGED
@@ -12,20 +12,29 @@
|
|
12
12
|
|
13
13
|
== dynomite
|
14
14
|
Installs edge dynomite from the git repository
|
15
|
+
|
16
|
+
Usage:
|
17
|
+
enable :dynomite
|
18
|
+
|
19
|
+
== lightcloud
|
20
|
+
Installs tokyo tyrant, tokyo cabinet and lightcloud.
|
21
|
+
|
22
|
+
It creates a basic config.py file that should probably be updated and made "smarter"
|
23
|
+
|
24
|
+
Usage:
|
25
|
+
enable :lightcloud
|
26
|
+
|
27
|
+
== nanite
|
28
|
+
Install erlang, nanite, eventmachine, amqp, python and rabbitmq along with nanite
|
29
|
+
|
30
|
+
Usage:
|
31
|
+
enable :nanite
|
15
32
|
|
16
|
-
==
|
17
|
-
|
33
|
+
== tokyo_tyrant
|
34
|
+
Install tokyo tyrant
|
18
35
|
|
19
36
|
Usage:
|
20
|
-
|
21
|
-
dir "/var/www"
|
22
|
-
repo "git://github.com/auser/paparazzi.git"
|
23
|
-
user "www-data"
|
24
|
-
database_yml /path/to/database.yml
|
25
|
-
end
|
26
|
-
|
27
|
-
Sets up the filesystem structure (similar to capistrano deploy) and uses ezra's
|
28
|
-
chef-deploy to deploy the application
|
37
|
+
enable :tokyo_tyrant
|
29
38
|
|
30
39
|
|
31
40
|
== Copyright
|
data/Rakefile
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "poolparty-extensions"
|
8
|
+
gem.summary = %Q{Extensions on to of poolparty}
|
9
|
+
gem.email = "arilerner@mac.com"
|
10
|
+
gem.homepage = "http://github.com/auser/poolparty-extensions"
|
11
|
+
gem.authors = ["Ari Lerner"]
|
12
|
+
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = false
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
if File.exist?('VERSION.yml')
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
|
+
else
|
48
|
+
version = ""
|
49
|
+
end
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "poolparty-extensions #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Push to github with new gemspec and readme"
|
58
|
+
task :gh => [:readme, :gemspec] do
|
59
|
+
%x{git commit -a -m "Added new readme and gemspec for github" && git push origin master}
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Generate new readme"
|
63
|
+
task :readme do
|
64
|
+
base =<<-EOM
|
65
|
+
= poolparty-extensions
|
66
|
+
|
67
|
+
Extensions to PoolParty!
|
68
|
+
|
69
|
+
Just install and include in your clouds.rb
|
70
|
+
|
71
|
+
clouds.rb
|
72
|
+
require "poolparty"
|
73
|
+
require "poolparty-extensions"
|
74
|
+
EOM
|
75
|
+
|
76
|
+
footer =<<-EOF
|
77
|
+
== Copyright
|
78
|
+
|
79
|
+
Copyright (c) 2009 Ari Lerner. See LICENSE for details.
|
80
|
+
EOF
|
81
|
+
|
82
|
+
extensions = FileList["#{File.dirname(__FILE__)}/lib/extensions/*.rb"]
|
83
|
+
avail = extensions.inject([]) do |s,f|
|
84
|
+
desc = begin
|
85
|
+
str = open(f).read#[/\=begin rdoc(\n)*(.)*/].gsub(/\=begin rdoc\n/, '')
|
86
|
+
if str =~ /\A=begin\s+rdoc/i
|
87
|
+
str.sub!(/\A=begin.*\n/, '')
|
88
|
+
str.sub!(/^=end.*/m, '')
|
89
|
+
end
|
90
|
+
rescue Exception => e
|
91
|
+
"Installs #{::File.basename(f, ".rb")}"
|
92
|
+
end
|
93
|
+
|
94
|
+
s << {
|
95
|
+
:name => ::File.basename(f, ".rb"),
|
96
|
+
:desc => desc
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
File.open("README.rdoc", "w") do |f|
|
101
|
+
f << base
|
102
|
+
f << "\n= Available extensions\n\n"
|
103
|
+
f << avail.map do |h|
|
104
|
+
"== #{h[:name]}\n#{h[:desc]}"
|
105
|
+
end.join("\n")
|
106
|
+
f << "\n\n"
|
107
|
+
f << footer
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
task :gem => [:build] do
|
112
|
+
|
113
|
+
end
|
data/VERSION.yml
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
module PoolParty
|
2
|
+
module Plugin
|
3
|
+
class BashAlias < Plugin
|
4
|
+
dsl_methods :name, # the name of the cmd
|
5
|
+
:value, # the value of the alias
|
6
|
+
:user
|
7
|
+
|
8
|
+
def before_load(opts={}, &block)
|
9
|
+
# TODO, why does "has_" segfault
|
10
|
+
line_in_file :file => "/root/.profile", :line => "alias #{opts[:name]}='#{opts[:value]}'"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module PoolParty
|
2
|
+
=begin rdoc
|
3
|
+
== Development Gem
|
4
|
+
|
5
|
+
Deploy a and install a gem developed locally. This is useful when you are
|
6
|
+
developing an internal or forked gem and you want to deploy it to your cloud
|
7
|
+
|
8
|
+
|
9
|
+
== Usage
|
10
|
+
|
11
|
+
has_development_gem_package('jetty-rack',
|
12
|
+
:from => "~/path/to/my/site",
|
13
|
+
:git_pull_first => true) # git pull from before sending to server
|
14
|
+
|
15
|
+
=end
|
16
|
+
module Plugin
|
17
|
+
class DevelopmentGem < Plugin
|
18
|
+
|
19
|
+
dsl_methods :name, # Name of the gem
|
20
|
+
:from, # The *local* path to the src of the gem being deployed
|
21
|
+
:conflicts, # an array of strings specifying gems this conflicts with
|
22
|
+
:jruby, # use jruby?
|
23
|
+
:bin, # the binary cmd used to manage gems
|
24
|
+
:install_cmd, # the full cmd used to install the gems
|
25
|
+
:build_gem_task, # the task used to _build_ the gem
|
26
|
+
:to # where to put the gem to build it
|
27
|
+
|
28
|
+
default_options(
|
29
|
+
:build_gem_task => "gem",
|
30
|
+
:conflicts => []
|
31
|
+
)
|
32
|
+
|
33
|
+
def loaded(opts={}, &block)
|
34
|
+
bin opts[:bin] ? opts[:bin] : opts[:jruby] ? "jruby -S gem" : "gem"
|
35
|
+
install_cmd opts[:install_cmd] || "#{bin} install pkg/*.gem --no-rdoc --no-ri"
|
36
|
+
to opts[:to] ? opts[:to] : "/usr/local/src/#{name}"
|
37
|
+
|
38
|
+
has_deploy_directory(name + '-src', dsl_options)
|
39
|
+
[name, conflicts].flatten.compact.each {|c| remove_existing_gem(c)} # remove any gems that might conflict
|
40
|
+
add_gem_building
|
41
|
+
add_gem_installation
|
42
|
+
end
|
43
|
+
|
44
|
+
def remove_existing_gem(existing_name)
|
45
|
+
has_exec("rm-existing-gem-#{existing_name}",
|
46
|
+
:command => "#{bin} uninstall #{existing_name} --all",
|
47
|
+
:only_if => "#{bin} list --local #{existing_name} | grep ^#{existing_name}[[:space:]]")
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_gem_building
|
51
|
+
has_exec("build-development-gem-#{name}",
|
52
|
+
:command => "cd #{gem_root} && rake #{build_gem_task}")
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_gem_installation
|
56
|
+
has_exec("install-development-gem-#{name}",
|
57
|
+
:requires => get_exec("build-development-gem-#{name}"),
|
58
|
+
:command => "cd #{gem_root} && #{install_cmd}")
|
59
|
+
end
|
60
|
+
|
61
|
+
def gem_root
|
62
|
+
to
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
data/lib/extensions/dynomite.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Installs tokyo tyrant, tokyo cabinet and lightcloud.
|
3
|
+
|
4
|
+
It creates a basic config.py file that should probably be updated and made "smarter"
|
5
|
+
|
6
|
+
Usage:
|
7
|
+
enable :lightcloud
|
8
|
+
=end
|
9
|
+
module PoolParty
|
10
|
+
module Plugin
|
11
|
+
class LightCloud < Plugin
|
12
|
+
|
13
|
+
def loaded o={}, &block
|
14
|
+
enable
|
15
|
+
install_gem if o.has_key?(:install_gem)
|
16
|
+
end
|
17
|
+
def enable
|
18
|
+
enable :tokyo_tyrant
|
19
|
+
|
20
|
+
install_lightcloud
|
21
|
+
start_lightcloud
|
22
|
+
end
|
23
|
+
|
24
|
+
def install_lightcloud
|
25
|
+
has_exec "svn co http://opensource.plurk.com/svn/opensource/lightcloud_manager ~/lightcloud_manager && cd ~/lightcloud_manager"
|
26
|
+
|
27
|
+
has_file "~/lightcloud_manager/config.py" do
|
28
|
+
render :erb
|
29
|
+
content <<-EOC
|
30
|
+
DATA_DIR = '~/lightcloud_manager/data'
|
31
|
+
TOKYO_SERVER_PARMS = '#bnum=1000000#fpow=13#opts=ld'
|
32
|
+
|
33
|
+
USE_MASTER = True
|
34
|
+
|
35
|
+
<% %x[/usr/bin/server-list-active internal_ip].split("\t").each_with_index do |ip, index| %>
|
36
|
+
NODES = {
|
37
|
+
#Lookup nodes
|
38
|
+
'lookup1_<%= index -%>': { 'id': <%= index %>, 'host': '127.0.0.1:41201', 'master': '127.0.0.1:51201' },
|
39
|
+
|
40
|
+
#Storage nodes
|
41
|
+
'storage1_<%= index -%>': { 'id': <%= index + 1 %>, 'host': '127.0.0.1:41201', 'master': '127.0.0.1:51201' },
|
42
|
+
<% end %>
|
43
|
+
}
|
44
|
+
EOC
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def start_lightcloud
|
49
|
+
has_exec "python -m manager all start"
|
50
|
+
end
|
51
|
+
|
52
|
+
def install_gem
|
53
|
+
has_gem_package "mitchellh-lightcloud"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Install erlang, nanite, eventmachine, amqp, python and rabbitmq along with nanite
|
3
|
+
|
4
|
+
Usage:
|
5
|
+
enable :nanite
|
6
|
+
=end
|
7
|
+
module PoolParty
|
8
|
+
module Plugin
|
9
|
+
class Nanite < Plugin
|
10
|
+
|
11
|
+
def loaded(o={}, &block)
|
12
|
+
has_package "erlang"
|
13
|
+
|
14
|
+
# TODO: change this with has_gem_package
|
15
|
+
has_exec "install nanite rubygem" do
|
16
|
+
command "cd ~ && git clone git://github.com/ezmobius/nanite.git && cd nanite/ && rake gem && gem install pkg/nanite*.gem"
|
17
|
+
not_if "gem list -l | grep nanite"
|
18
|
+
end
|
19
|
+
|
20
|
+
has_gem_package "eventmachine"
|
21
|
+
has_gem_package "amqp"
|
22
|
+
|
23
|
+
has_package "python"
|
24
|
+
|
25
|
+
has_exec "install easy_install" do
|
26
|
+
command "cd ~ && wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg && sh setuptools-0.6c9-py2.5.egg"
|
27
|
+
not_if "which easy_install"
|
28
|
+
end
|
29
|
+
|
30
|
+
has_exec "install simplejson" do
|
31
|
+
command "cd ~ && easy_install simplejson"
|
32
|
+
end
|
33
|
+
|
34
|
+
has_exec "install rabbitmq" do
|
35
|
+
command "cd ~ && wget http://www.rabbitmq.com/releases/rabbitmq-server/v1.5.3/rabbitmq-server-1.5.3.tar.gz && cd /usr/local/lib/erlang/lib && tar -zxf ~/rabbitmq-server-1.5.3.tar.gz && cd rabbitmq-server-1.5.3 && make"
|
36
|
+
not_if "which easy_install"
|
37
|
+
end
|
38
|
+
|
39
|
+
has_gem_package "ezmobius-nanite"
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
Install tokyo tyrant
|
3
|
+
|
4
|
+
Usage:
|
5
|
+
enable :tokyo_tyrant
|
6
|
+
=end
|
7
|
+
module PoolParty
|
8
|
+
module Plugin
|
9
|
+
class TokyoTyrant < Plugin
|
10
|
+
|
11
|
+
def enable
|
12
|
+
has_package "build-essential"
|
13
|
+
has_package "zlib1g-dev"
|
14
|
+
has_package "libbz2-dev"
|
15
|
+
has_gem_package "rufus-tokyo"
|
16
|
+
|
17
|
+
has_exec "install tokyo-cabinet" do
|
18
|
+
command "cd ~ && git clone git://github.com/etrepum/tokyo-cabinet.git && cd tokyo-cabinet/ && ./configure && make && make install && cd ~"
|
19
|
+
not_if "which tcrtest"
|
20
|
+
end
|
21
|
+
has_exec "install tokyo-tyrant" do
|
22
|
+
command "cd ~ && git clone git://github.com/etrepum/tokyo-tyrant.git && cd tokyo-tyrant/ && ./configure && make && make install && cd ~"
|
23
|
+
not_if "which ttserver"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auser-poolparty-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Lerner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -20,25 +20,27 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
-
- README.rdoc
|
24
23
|
- LICENSE
|
24
|
+
- README.rdoc
|
25
25
|
files:
|
26
|
+
- LICENSE
|
26
27
|
- README.rdoc
|
28
|
+
- Rakefile
|
27
29
|
- VERSION.yml
|
28
|
-
- lib/extensions
|
30
|
+
- lib/extensions/bash_alias.rb
|
31
|
+
- lib/extensions/development_gem_package.rb
|
29
32
|
- lib/extensions/dynomite.rb
|
30
|
-
- lib/extensions/
|
33
|
+
- lib/extensions/lightcloud.rb
|
34
|
+
- lib/extensions/nanite.rb
|
35
|
+
- lib/extensions/tokyo_tyrant.rb
|
31
36
|
- lib/poolparty-extensions.rb
|
32
|
-
- test/extensions
|
33
37
|
- test/extensions/rails_deploy_test.rb
|
34
38
|
- test/poolparty_extensions_test.rb
|
35
39
|
- test/test_helper.rb
|
36
|
-
- LICENSE
|
37
40
|
has_rdoc: true
|
38
41
|
homepage: http://github.com/auser/poolparty-extensions
|
39
42
|
post_install_message:
|
40
43
|
rdoc_options:
|
41
|
-
- --inline-source
|
42
44
|
- --charset=UTF-8
|
43
45
|
require_paths:
|
44
46
|
- lib
|
@@ -61,5 +63,7 @@ rubygems_version: 1.2.0
|
|
61
63
|
signing_key:
|
62
64
|
specification_version: 3
|
63
65
|
summary: Extensions on to of poolparty
|
64
|
-
test_files:
|
65
|
-
|
66
|
+
test_files:
|
67
|
+
- test/extensions/rails_deploy_test.rb
|
68
|
+
- test/poolparty_extensions_test.rb
|
69
|
+
- test/test_helper.rb
|
@@ -1,57 +0,0 @@
|
|
1
|
-
=begin rdoc
|
2
|
-
Deploy a rails application using chef_deploy
|
3
|
-
|
4
|
-
Usage:
|
5
|
-
has_rails_deploy "app_name" do
|
6
|
-
dir "/var/www"
|
7
|
-
repo "git://github.com/auser/paparazzi.git"
|
8
|
-
user "www-data"
|
9
|
-
database_yml /path/to/database.yml # or a string
|
10
|
-
end
|
11
|
-
|
12
|
-
Sets up the filesystem structure (similar to capistrano deploy) and uses ezra's
|
13
|
-
chef-deploy to deploy the application
|
14
|
-
=end
|
15
|
-
module PoolParty
|
16
|
-
class Rails
|
17
|
-
|
18
|
-
plugin :rails_deploy do
|
19
|
-
|
20
|
-
default_options(
|
21
|
-
:dir => "/var/www",
|
22
|
-
:owner => "www-data"
|
23
|
-
)
|
24
|
-
|
25
|
-
def loaded(o={}, &block)
|
26
|
-
raise "You must include the directory to deploy the rails app" unless dir?
|
27
|
-
raise "You must include the repo to deploy the rails app" unless repo?
|
28
|
-
|
29
|
-
has_package "git-core"
|
30
|
-
has_directory dir
|
31
|
-
has_directory release_directory
|
32
|
-
has_directory "#{release_directory}/shared", :owner => owner
|
33
|
-
|
34
|
-
%w(config pids log).each do |d|
|
35
|
-
has_directory "#{release_directory}/shared/#{d}", :owner => owner
|
36
|
-
end
|
37
|
-
|
38
|
-
has_file "#{release_directory}/shared/config/database.yml", :owner => owner do
|
39
|
-
content ::File.file?(database_yml) ? open(database_yml).read : database_yml
|
40
|
-
end
|
41
|
-
|
42
|
-
# Should these be here?
|
43
|
-
has_chef_recipe "apache2"
|
44
|
-
has_chef_recipe "apache2::mod_rails"
|
45
|
-
|
46
|
-
dopts = options.choose {|k,v| [:repo, :user].include?(k)}
|
47
|
-
has_chef_deploy dopts.merge(:name => "#{release_directory}")
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def release_directory
|
52
|
-
"#{dir}/#{name}"
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|