Skip to content

Commit

Permalink
Working up stack for nginx and apache with some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
benschwarz committed May 16, 2009
1 parent 6f74a49 commit bad5223
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 51 deletions.
18 changes: 9 additions & 9 deletions config/install.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
$:<< File.join(File.dirname(__FILE__), 'stack')

# Require the stack base
%w(essential scm ruby_enterprise memcached postgresql mysql).each(&method(:require))

# ===============
# = Web servers =
# ===============
Expand All @@ -10,11 +13,8 @@
# These are enabled by default when you choose Apache, you can remove these dependencies within
# stack/apache.rb

# require 'apache'
require 'nginx'

# Require the rest of our stack
%w(essential scm ruby_enterprise memcached postgresql mysql).each(&method(:require))
require 'apache'
#require 'nginx'

# What we're installing to your server
# Take what you want, leave what you don't
Expand All @@ -23,10 +23,10 @@
requires :webserver # Apache or Nginx
requires :appserver # Passenger
requires :ruby_enterprise # Ruby Enterprise edition
requires :database # MySQL or Postgres, also installs rubygems for each
requires :scm # Git
requires :memcached # Memcached
requires :libmemcached # Libmemcached
#requires :database # MySQL or Postgres, also installs rubygems for each
#requires :scm # Git
#requires :memcached # Memcached
#requires :libmemcached # Libmemcached
end

deployment do
Expand Down
11 changes: 7 additions & 4 deletions config/stack/apache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

package :passenger, :provides => :appserver do
description 'Phusion Passenger (mod_rails)'
version '2.2.1'
version '2.2.2'
binaries = %w(passenger-config passenger-install-nginx-module passenger-install-apache2-module passenger-make-enterprisey passenger-memory-stats passenger-spawn-server passenger-status passenger-stress-test)

gem 'passenger', :version => version do
binaries.each {|bin| post :install, "ln -s #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}"}

post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module'

# Create the passenger conf file
Expand All @@ -41,12 +45,11 @@

verify do
has_file "/etc/apache2/extras/passenger.conf"
has_file "/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so"
has_directory "/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}"
has_file "#{REE_PATH}/ext/apache2/mod_passenger.so"
binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" }
end

requires :apache, :apache2_prefork_dev, :ruby_enterprise
recommends :passenger_binaries
end

# These "installers" are strictly optional, I believe
Expand Down
2 changes: 1 addition & 1 deletion config/stack/mysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
has_executable 'mysql'
end

recommends :mysql_driver
optional :mysql_driver
end

package :mysql_driver, :provides => :ruby_database_driver do
Expand Down
38 changes: 21 additions & 17 deletions config/stack/nginx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,36 @@
# be strange.

package :nginx, :provides => :webserver do
puts "Nginx installed by passenger"
puts "** Nginx installed by passenger gem **"
requires :passenger

push_text File.read(File.join(File.dirname(__FILE__), 'nginx', 'init.d')), "/etc/init.d/nginx", :sudo => true do
post :install, "sudo chmod +x /etc/init.d/nginx"
post :install, "sudo /usr/sbin/update-rc.d -f nginx defaults"
post :install, "sudo /etc/init.d/nginx start"
end

verify do
has_executable "/usr/local/nginx/sbin/nginx"
has_file "/etc/init.d/nginx"
end
end

package :passenger, :provides => :appserver do
description 'Phusion Passenger (mod_rails)'
version '2.2.3'
version '2.2.2'
binaries = %w(passenger-config passenger-install-nginx-module passenger-install-apache2-module passenger-make-enterprisey passenger-memory-stats passenger-spawn-server passenger-status passenger-stress-test)

gem 'passenger', :version => version do
gem 'passenger', :version => version do
# Install nginx and the module
binaries.each {|bin| post :install, "ln -s #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}"}
post :install, "sudo passenger-install-nginx-module --auto --auto-download --prefix=/usr/local/nginx"

post :install do
# Install nginx init.d script
#push_text File.read(File.join(File.dirname(__FILE__), 'nginx', 'init.d')), "/etc/init.d/nginx", :sudo => true
end

#post :install, "sudo chmod +x /etc/init.d/nginx"
#post :install, "sudo /usr/sbin/update-rc.d -f nginx defaults"
#post :install, "sudo /etc/init.d/nginx start"
end

requires :ruby_enterprise
recommends :passenger_binaries

#verify do
# has_executable "/usr/local/nginx/sbin/nginx"
# has_gem "passenger", version
#end
verify do
has_gem "passenger", version
binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" }
end
end
2 changes: 1 addition & 1 deletion config/stack/postgresql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
has_executable 'psql'
end

recommends :postgresql_driver
optional :postgresql_driver
end

package :postgresql_driver, :provides => :ruby_database_driver do
Expand Down
26 changes: 7 additions & 19 deletions config/stack/ruby_enterprise.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
package :ruby_enterprise do
description 'Ruby Enterprise Edition'
version '1.8.6-20090421'

install_path = "/usr/local/ruby-enterprise"
REE_PATH = "/usr/local/ruby-enterprise"

binaries = %w(erb gem irb rackup rails rake rdoc ree-version ri ruby testrb)
source "http://rubyforge.org/frs/download.php/55511/ruby-enterprise-#{version}.tar.gz" do
custom_install 'sudo ./installer --auto=/usr/local/ruby-enterprise'

binaries.each {|bin| post :install, "ln -s #{install_path}/bin/#{bin} /usr/local/bin/#{bin}" }
binaries.each {|bin| post :install, "ln -s #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}" }
end

verify do
has_directory install_path
has_executable "#{install_path}/bin/ruby"
binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{install_path}/bin/#{bin}" }
has_executable "#{REE_PATH}/bin/ruby"
binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" }
end

requires :ree_dependencies
end

package :ree_dependencies do
apt %w(zlib1g-dev libreadline5-dev libssl-dev)
# requires :build_essential
end

package :passenger_binaries do
description "Symlinks passenger binaries"
binaries = %w(passenger-config passenger-install-nginx-module passenger-install-apache2-module passenger-make-enterprisey passenger-memory-stats passenger-spawn-server passenger-status passenger-stress-test)
install_path = "/usr/local/ruby-enterprise"
binaries.each {|bin| post :install, "ln -s #{install_path}/bin/#{bin} /usr/local/bin/#{bin}" }

verify do
binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{install_path}/bin/#{bin}" }
end
end
requires :build_essential
end

0 comments on commit bad5223

Please sign in to comment.