machines do region :'us-east-1' do ami 'ami-212ccf48' # Stella Debian 5.0, 32-bit (US) end region :'eu-west-1' do ami 'ami-6ecde51a' # Alestic Debian 5.0, 32-bit (EU) end env :stage do role :app do positions 2 user :root size 'm1.small' end role :gen do user :root size 'm1.large' ami 'ami-7133d018' end role :demo do user :root size 'm1.small' end end end commands do allow :apt_get, "apt-get", :y, :q allow :gem_install, "/usr/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri" allow :gem_sources, "/usr/bin/gem", "sources" allow :gem_uninstall, "/usr/bin/gem", "uninstall", :V allow :update_rubygems allow :rake allow :thin allow :stella allow :rm allow :ulimit allow :ruby19, "/usr/local/bin/ruby" allow :gem19_install, "/usr/local/bin/gem", "install" allow :rackup_path do v = [Stella::VERSION::MAJOR, Stella::VERSION::MINOR, Stella::VERSION::TINY].join('.') "/usr/lib/ruby/gems/1.8/gems/stella-#{v}/support/sample_webapp/config.ru" end end routines do role :app do # rudy -r app -v start start do remote do #ulimit :n, '30000' #ulimit :n rm :f, 'thin.log' mkdir :p, 'stats' thin :d, :l, 'thin.log', :p, 3114, :R, rackup_path, '--stats', './stats', '--max-conns', 8192, 'start' end end # rudy -r app -v stop stop do remote do thin :R, rackup_path, 'stop' sleep 1 ps 'ux' end end end # rudy -v -r gen verify ip-10-251-27-245.ec2.internal:3114 verify do remote do |arg| file_upload 'examples/essentials/plan.rb' file_upload 'examples/essentials/search_terms.txt' file_upload 'examples/essentials/logo.png' stella :v, 'verify', :p, 'plan.rb', "#{arg.first}" end end # rudy -v -r gen generate ip-10-251-27-245.ec2.internal:3114 generate do remote do |arg| file_upload 'examples/essentials/plan.rb' file_upload 'examples/essentials/search_terms.txt' file_upload 'examples/essentials/logo.png' stella :v, 'generate', :p, 'plan.rb', :c, 1, :d, '1m', :W, "#{arg.first}" end end setup do after :sysupdate, :installdeps, :install_ruby19 end shutdown do end reboot do end install_netperf do #ftp://ftp.netperf.org/netperf/netperf-2.4.5.tar.bz2 end install_rubyforge do remote :root do gem19_install 'stella', :V gem_install 'stella', :V end end install_github do remote :root do gem_sources :a, "http://gems.github.com" gem_install 'solutious-stella' end end package_gem do local do rm :r, :f, 'pkg' rake 'package' end end remove_rudy do remote :root do gem_uninstall 'stella' rm :r, :f, '.stella' end end install_gem do before :package_gem remote :root do file_upload "pkg/stella-#{Stella::VERSION}.gem", "/tmp/" gem_install "/tmp/stella-#{Stella::VERSION}.gem" end end install_zlib do remote do wget "http://www.zlib.net/zlib-1.2.3.tar.gz" tar :x, :z, :f, "zlib-1.2.3.tar.gz" cd "zlib-1.2.3" configure '--prefix=/usr/local' make make "install" end end installdeps do remote :root do gem_install "test-spec", "rspec", "camping", "fcgi", "memcache-client" gem_install "mongrel" gem_install "ruby-openid", :v, "2.0.4" # thin requires 2.0.x gem_install "rack", "thin", "sinatra" end end install_jruby do remote do wget 'http://jruby.kenai.com/downloads/1.4.0RC2/jruby-bin-1.4.0RC2.tar.gz' tar :x, :z, :f, 'jruby-bin-1.4.0RC2.tar.gz' mv 'jruby-1.4.0RC2', '/usr/jruby' end end install_ruby19 do before :install_zlib remote do apt_get "install", "libssl-dev", "libreadline5-dev", "zlib1g-dev" #wget 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.bz2' rm :r, :f, 'ruby-1.9.1-p243' tar :x, :j, :v, :f, 'ruby-1.9.1-p243.tar.bz2' cd 'ruby-1.9.1-p243' configure '--prefix=/usr/local' make make 'install' end end sysupdate { remote { apt_get "update" apt_get "install", "libxml2-dev", "libxslt-dev" apt_get "install", "build-essential", "git-core" apt_get "install", "ruby1.8-dev", "rdoc", "libzlib-ruby", "rubygems" apt_get "install", "libfcgi-dev", "libfcgi-ruby1.8" apt_get "install", "joe", "siege", "httperf" gem_sources :a, "http://gems.github.com" mkdir :p, "/var/lib/gems/1.8/bin" # Doesn't get created, but causes Rubygems to fail gem_install "builder", "session" gem_install 'hoe-seattlerb' gem_install 'rubygems-update', "-v=1.3.4" update_rubygems gem_install 'hoe' } } end defaults do zone :'us-east-1a' environment :stage role :app color true user :root end