From 2bf8534d56e68ee4e7a7c81c66c57cbdebf66796 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 21 Dec 2011 22:32:28 -0500 Subject: [PATCH 01/20] Improve idempotency by allowing ln to run if recipe is executed a second time. --- config/stack/apache.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index d133453..83eca9c 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -23,7 +23,7 @@ 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}"} + binaries.each {|bin| post :install, "ln -s -f #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}"} # The -f forces the operation, so it doesn't fail the second time you run it. post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module' From f74b4b82970edc2c4fdb0893792d174722f0826d Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 21 Dec 2011 22:32:58 -0500 Subject: [PATCH 02/20] Switch to a version of git that doesn't 404. --- config/stack/scm.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/stack/scm.rb b/config/stack/scm.rb index b6631e6..b0d5d35 100644 --- a/config/stack/scm.rb +++ b/config/stack/scm.rb @@ -1,7 +1,7 @@ package :git, :provides => :scm do description 'Git Distributed Version Control' - version '1.6.1' - source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz" + version '1.7.7.5' + source "http://git-core.googlecode.com/files/git-#{version}.tar.gz" requires :git_dependencies verify do From 5a2aaa6096918062ec57b054110f6d7b42dec2c1 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 21 Dec 2011 22:33:45 -0500 Subject: [PATCH 03/20] Add compilation dependency for apache2 module. --- config/stack/apache.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index 83eca9c..fa6bffe 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -25,6 +25,7 @@ gem 'passenger', :version => version do binaries.each {|bin| post :install, "ln -s -f #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}"} # The -f forces the operation, so it doesn't fail the second time you run it. + post :install, 'apt-get install -y libcurl4-gnutls-dev' # Compilation dependency for apache module post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module' # Create the passenger conf file From 0f281a6f58f46e249512dfb556b5b5e077ba2844 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 21 Dec 2011 22:34:25 -0500 Subject: [PATCH 04/20] Backup and recreate passenger.conf --- config/stack/apache.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index fa6bffe..e9c5f6c 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -28,8 +28,13 @@ post :install, 'apt-get install -y libcurl4-gnutls-dev' # Compilation dependency for apache module post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module' - # Create the passenger conf file + # SET UP CONFIG FILE + # set up directory post :install, 'mkdir -p /etc/apache2/extras' + # move old file out of the way + post :install, 'rm -rf /etc/apache2/extras/passenger.conf.moved_by_sprinkle' + post :install, 'mv /etc/apache2/extras/passenger.conf /etc/apache2/extras/passenger.conf.moved_by_sprinkle' + # recreate file post :install, 'touch /etc/apache2/extras/passenger.conf' post :install, 'echo "Include /etc/apache2/extras/passenger.conf"|sudo tee -a /etc/apache2/apache2.conf' From 772e88bd6edd9ca0bc99bbf0590baf5438491ac5 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 21 Dec 2011 22:35:06 -0500 Subject: [PATCH 05/20] Changed path of validated location of apache2 module to match where it actually gets installed. --- config/stack/apache.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index e9c5f6c..eba4aeb 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -51,7 +51,7 @@ verify do has_file "/etc/apache2/extras/passenger.conf" - has_file "#{REE_PATH}/ext/apache2/mod_passenger.so" + has_file "/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so" binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" } end From 92588ea198c14f42e0e550d9a7a5637374e07a3e Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 21 Dec 2011 23:36:31 -0500 Subject: [PATCH 06/20] Fix the way I replace passenger.conf --- config/stack/apache.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index eba4aeb..7bf1b58 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -31,9 +31,8 @@ # SET UP CONFIG FILE # set up directory post :install, 'mkdir -p /etc/apache2/extras' - # move old file out of the way - post :install, 'rm -rf /etc/apache2/extras/passenger.conf.moved_by_sprinkle' - post :install, 'mv /etc/apache2/extras/passenger.conf /etc/apache2/extras/passenger.conf.moved_by_sprinkle' + # blast old file (I should back it up, but oh well) + post :install, 'rm -rf /etc/apache2/extras/passenger.conf' # recreate file post :install, 'touch /etc/apache2/extras/passenger.conf' post :install, 'echo "Include /etc/apache2/extras/passenger.conf"|sudo tee -a /etc/apache2/apache2.conf' From e75a8ab2c556a12838d7dd99230b62f7e7e2e1b7 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Thu, 22 Dec 2011 12:09:44 -0500 Subject: [PATCH 07/20] Updated passenger version to one that currently gets downloaded. This will break when they release a new version. Moved modification of main Apache config. --- config/stack/apache.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index 7bf1b58..72eb87c 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -19,7 +19,7 @@ package :passenger, :provides => :appserver do description 'Phusion Passenger (mod_rails)' - version '2.2.4' + version '3.0.11' # I don't think this version is necessarily installed, as I had to update this the version of passenger it had gotten me. 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 @@ -35,7 +35,6 @@ post :install, 'rm -rf /etc/apache2/extras/passenger.conf' # recreate file post :install, 'touch /etc/apache2/extras/passenger.conf' - post :install, 'echo "Include /etc/apache2/extras/passenger.conf"|sudo tee -a /etc/apache2/apache2.conf' [%Q(LoadModule passenger_module /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so), %Q(PassengerRoot /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}), @@ -44,6 +43,8 @@ post :install, "echo '#{line}' |sudo tee -a /etc/apache2/extras/passenger.conf" end + # Tell apache to use new config file + post :install, 'echo "Include /etc/apache2/extras/passenger.conf"|sudo tee -a /etc/apache2/apache2.conf' # Restart apache to note changes post :install, '/etc/init.d/apache2 restart' end From 81e51aff385255623594bd008f970edf1268f563 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Thu, 22 Dec 2011 22:06:47 -0500 Subject: [PATCH 08/20] Sorry for the big commit! This includes many things: - REE patch to fix SSLv2 issue on Oneiric - "export" RUBY_PATH instead of REE_PATH to make apache.rb more compatible with other Rubies - cleanup of repeated file paths - fix package names to make compatible with Oneiric This is all tested with Lucid (32-bit) and Oneiric (64-bit) --- config/stack/apache.rb | 33 +++++++++++++++--------- config/stack/nginx.rb | 4 +-- config/stack/ruby_enterprise.rb | 20 ++++++++------ config/stack/ruby_enterprise/sslv2_patch | 8 ++++++ 4 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 config/stack/ruby_enterprise/sslv2_patch diff --git a/config/stack/apache.rb b/config/stack/apache.rb index 72eb87c..c78affd 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -21,38 +21,47 @@ description 'Phusion Passenger (mod_rails)' version '3.0.11' # I don't think this version is necessarily installed, as I had to update this the version of passenger it had gotten me. 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) - + + passenger_config = '/etc/apache2/extras/passenger.conf' + passenger_gem_path = "#{RUBY_PATH}/lib/ruby/gems/1.8/gems/passenger-#{version}" + passenger_module = "#{passenger_gem_path}/ext/apache2/mod_passenger.so" + + apt 'libcurl4-gnutls-dev' # Compilation dependency for apache module + gem 'passenger', :version => version do - binaries.each {|bin| post :install, "ln -s -f #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}"} # The -f forces the operation, so it doesn't fail the second time you run it. + binaries.each {|bin| post :install, "ln -s -f #{RUBY_PATH}/bin/#{bin} /usr/local/bin/#{bin}"} # The -f forces the operation, so it doesn't fail the second time you run it. - post :install, 'apt-get install -y libcurl4-gnutls-dev' # Compilation dependency for apache module post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module' # SET UP CONFIG FILE # set up directory post :install, 'mkdir -p /etc/apache2/extras' # blast old file (I should back it up, but oh well) - post :install, 'rm -rf /etc/apache2/extras/passenger.conf' + post :install, "rm -rf #{passenger_config}" # recreate file - post :install, 'touch /etc/apache2/extras/passenger.conf' + post :install, "touch #{passenger_config}" - [%Q(LoadModule passenger_module /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so), - %Q(PassengerRoot /usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{version}), + [%Q(LoadModule passenger_module #{passenger_module}), + %Q(PassengerRoot #{passenger_gem_path}), %q(PassengerRuby /usr/local/bin/ruby), %q(RailsEnv production)].each do |line| - post :install, "echo '#{line}' |sudo tee -a /etc/apache2/extras/passenger.conf" + post :install, "echo '#{line}' |sudo tee -a #{passenger_config}" end # Tell apache to use new config file - post :install, 'echo "Include /etc/apache2/extras/passenger.conf"|sudo tee -a /etc/apache2/apache2.conf' + post :install, "echo 'Include #{passenger_config}'|sudo tee -a /etc/apache2/apache2.conf" # Restart apache to note changes post :install, '/etc/init.d/apache2 restart' end 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" - binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" } + has_gem 'passenger', version + has_file passenger_config + has_file passenger_module + binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{RUBY_PATH}/bin/#{bin}" } + # This should work, but on Ubuntu Lucid Lynx (10.04), apache2 doesn't start automatically + # and needs to be started manually. + #has_process "apache2" end requires :apache, :apache2_prefork_dev, :ruby_enterprise diff --git a/config/stack/nginx.rb b/config/stack/nginx.rb index f9ca4c8..5123b05 100644 --- a/config/stack/nginx.rb +++ b/config/stack/nginx.rb @@ -31,7 +31,7 @@ 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}"} + binaries.each {|bin| post :install, "ln -s #{RUBY_PATH}/bin/#{bin} /usr/local/bin/#{bin}"} post :install, "sudo passenger-install-nginx-module --auto --auto-download --prefix=/usr/local/nginx" end @@ -39,6 +39,6 @@ verify do has_gem "passenger", version - binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" } + binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{RUBY_PATH}/bin/#{bin}" } end end \ No newline at end of file diff --git a/config/stack/ruby_enterprise.rb b/config/stack/ruby_enterprise.rb index f6b638e..15ef36a 100644 --- a/config/stack/ruby_enterprise.rb +++ b/config/stack/ruby_enterprise.rb @@ -1,24 +1,28 @@ package :ruby_enterprise do description 'Ruby Enterprise Edition' - version '1.8.7-2010.01' - REE_PATH = "/usr/local/ruby-enterprise" + version '1.8.7-2011.03' + ree_path = "/opt/ruby-enterprise-#{version}" + # Other packages may reference this + RUBY_PATH = ree_path binaries = %w(erb gem irb rackup rails rake rdoc ree-version ri ruby testrb) - source "http://rubyforge.org/frs/download.php/68719/ruby-enterprise-#{version}.tar.gz" do - custom_install 'sudo ./installer --auto=/usr/local/ruby-enterprise' - binaries.each {|bin| post :install, "ln -s #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}" } + push_text File.read(File.join(File.dirname(__FILE__), 'ruby_enterprise', 'sslv2_patch')), "/tmp/sslv2_patch", :sudo => true + source "http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-#{version}.tar.gz" do + post :extract, "patch /usr/local/build/ruby-enterprise-1.8.7-2011.03/source/ext/openssl/ossl_ssl.c < /tmp/sslv2_patch" + custom_install "sudo ./installer --auto=#{ree_path} --dont-install-useful-gems --no-dev-docs" + binaries.each {|bin| post :install, "ln -s #{ree_path}/bin/#{bin} /usr/local/bin/#{bin}" } end verify do has_directory install_path - has_executable "#{REE_PATH}/bin/ruby" - binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_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) + apt %w(zlib1g-dev libreadline-dev libssl-dev) requires :build_essential end \ No newline at end of file diff --git a/config/stack/ruby_enterprise/sslv2_patch b/config/stack/ruby_enterprise/sslv2_patch new file mode 100644 index 0000000..7b14e40 --- /dev/null +++ b/config/stack/ruby_enterprise/sslv2_patch @@ -0,0 +1,8 @@ +104,106c104,106 +< OSSL_SSL_METHOD_ENTRY(SSLv2), +< OSSL_SSL_METHOD_ENTRY(SSLv2_server), +< OSSL_SSL_METHOD_ENTRY(SSLv2_client), +--- +> // OSSL_SSL_METHOD_ENTRY(SSLv2), +> // OSSL_SSL_METHOD_ENTRY(SSLv2_server), +> // OSSL_SSL_METHOD_ENTRY(SSLv2_client), From 37937d5d603d933527d229d1e1a3d15aafd91d2c Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 20:46:35 -0500 Subject: [PATCH 09/20] Comment pre-install SSLv2 patch. --- config/stack/ruby_enterprise.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/stack/ruby_enterprise.rb b/config/stack/ruby_enterprise.rb index 15ef36a..a6845e2 100644 --- a/config/stack/ruby_enterprise.rb +++ b/config/stack/ruby_enterprise.rb @@ -6,6 +6,7 @@ RUBY_PATH = ree_path binaries = %w(erb gem irb rackup rails rake rdoc ree-version ri ruby testrb) + # Apply patch to remove SSLv2 support, which is no longer present in Ubuntu 11.10 and OpenSSL >1.0 push_text File.read(File.join(File.dirname(__FILE__), 'ruby_enterprise', 'sslv2_patch')), "/tmp/sslv2_patch", :sudo => true source "http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-#{version}.tar.gz" do post :extract, "patch /usr/local/build/ruby-enterprise-1.8.7-2011.03/source/ext/openssl/ossl_ssl.c < /tmp/sslv2_patch" From e0fd59c6ed0bf35e671e8ba39d164a746e1f7050 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 20:48:57 -0500 Subject: [PATCH 10/20] Switched from using "ruby_enterprise" as a dependency in favor of just "ruby", so it can adapt to different Ruby implementations. --- config/stack/apache.rb | 2 +- config/stack/mysql.rb | 2 +- config/stack/nginx.rb | 2 +- config/stack/postgresql.rb | 2 +- config/stack/ruby_enterprise.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index c78affd..be2aac8 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -64,7 +64,7 @@ #has_process "apache2" end - requires :apache, :apache2_prefork_dev, :ruby_enterprise + requires :apache, :apache2_prefork_dev, :ruby end # These "installers" are strictly optional, I believe diff --git a/config/stack/mysql.rb b/config/stack/mysql.rb index bb509c1..6d1ffc0 100644 --- a/config/stack/mysql.rb +++ b/config/stack/mysql.rb @@ -17,5 +17,5 @@ has_gem 'mysql' end - requires :ruby_enterprise + requires :ruby end diff --git a/config/stack/nginx.rb b/config/stack/nginx.rb index 5123b05..2e8ddd5 100644 --- a/config/stack/nginx.rb +++ b/config/stack/nginx.rb @@ -35,7 +35,7 @@ post :install, "sudo passenger-install-nginx-module --auto --auto-download --prefix=/usr/local/nginx" end - requires :ruby_enterprise + requires :ruby, :nginx verify do has_gem "passenger", version diff --git a/config/stack/postgresql.rb b/config/stack/postgresql.rb index 343c462..1440387 100644 --- a/config/stack/postgresql.rb +++ b/config/stack/postgresql.rb @@ -17,5 +17,5 @@ has_gem 'postgres' end - requires :ruby_enterprise + requires :ruby end diff --git a/config/stack/ruby_enterprise.rb b/config/stack/ruby_enterprise.rb index a6845e2..bd40592 100644 --- a/config/stack/ruby_enterprise.rb +++ b/config/stack/ruby_enterprise.rb @@ -1,4 +1,4 @@ -package :ruby_enterprise do +package :ruby_enterprise, :provides => :ruby do description 'Ruby Enterprise Edition' version '1.8.7-2011.03' ree_path = "/opt/ruby-enterprise-#{version}" From ae7c44d78b370ed0ea6441481e73300549ca771f Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 20:52:06 -0500 Subject: [PATCH 11/20] Switch to generic 'ruby' metapackage name instead of specifying ruby_enterprise. --- config/install.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/install.rb b/config/install.rb index 0a9b722..70f0069 100644 --- a/config/install.rb +++ b/config/install.rb @@ -1,7 +1,7 @@ $:<< File.join(File.dirname(__FILE__), 'stack') # Require the stack base -%w(essential scm ruby_enterprise memcached postgresql mysql).each do |lib| +%w(essential scm ruby memcached postgresql mysql).each do |lib| require lib end @@ -24,7 +24,7 @@ policy :stack, :roles => :app do requires :webserver # Apache or Nginx requires :appserver # Passenger - requires :ruby_enterprise # Ruby Enterprise edition + requires :ruby # Ruby Enterprise edition requires :database # MySQL or Postgres, also installs rubygems for each requires :scm # Git #requires :memcached # Memcached From 7879c53d8963d4e1a9393feb8c26199a9f45057b Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 21:00:43 -0500 Subject: [PATCH 12/20] Whoops! Shouldn't have changed that one "ruby_enterprise" in the require to "ruby". --- config/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/install.rb b/config/install.rb index 70f0069..974c557 100644 --- a/config/install.rb +++ b/config/install.rb @@ -1,7 +1,7 @@ $:<< File.join(File.dirname(__FILE__), 'stack') # Require the stack base -%w(essential scm ruby memcached postgresql mysql).each do |lib| +%w(essential scm ruby_enterprise memcached postgresql mysql).each do |lib| require lib end From 9be58ff2a497624d4ece8cd8e22306b7dab1da35 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 21:57:24 -0500 Subject: [PATCH 13/20] Clean up dependencies, avoiding double "installing" message. --- config/stack/apache.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index be2aac8..ddf564b 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -26,8 +26,6 @@ passenger_gem_path = "#{RUBY_PATH}/lib/ruby/gems/1.8/gems/passenger-#{version}" passenger_module = "#{passenger_gem_path}/ext/apache2/mod_passenger.so" - apt 'libcurl4-gnutls-dev' # Compilation dependency for apache module - gem 'passenger', :version => version do binaries.each {|bin| post :install, "ln -s -f #{RUBY_PATH}/bin/#{bin} /usr/local/bin/#{bin}"} # The -f forces the operation, so it doesn't fail the second time you run it. @@ -64,7 +62,11 @@ #has_process "apache2" end - requires :apache, :apache2_prefork_dev, :ruby + requires :apache, :apache2_prefork_dev, :ruby, :passenger_dependencies +end + +package :passenger_dependencies do + apt 'libcurl4-gnutls-dev' # Compilation dependency for apache module end # These "installers" are strictly optional, I believe From 74f585f23d7ea1bb0098fdfa37e67aef624190a8 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 22:05:04 -0500 Subject: [PATCH 14/20] Rename "scm" file to "git" so it's clear what it is. --- config/install.rb | 2 +- config/stack/{scm.rb => git.rb} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename config/stack/{scm.rb => git.rb} (100%) diff --git a/config/install.rb b/config/install.rb index 974c557..b87213a 100644 --- a/config/install.rb +++ b/config/install.rb @@ -1,7 +1,7 @@ $:<< File.join(File.dirname(__FILE__), 'stack') # Require the stack base -%w(essential scm ruby_enterprise memcached postgresql mysql).each do |lib| +%w(essential git ruby_enterprise memcached postgresql mysql).each do |lib| require lib end diff --git a/config/stack/scm.rb b/config/stack/git.rb similarity index 100% rename from config/stack/scm.rb rename to config/stack/git.rb From 706586ebe3b674c999b46c51e6fe727340761680 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Sun, 25 Dec 2011 22:20:24 -0500 Subject: [PATCH 15/20] Add github ssh keys for all users on system Conflicts: config/stack/git.rb --- config/stack/git.rb | 10 ++++++++-- config/stack/git/github_key.txt | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 config/stack/git/github_key.txt diff --git a/config/stack/git.rb b/config/stack/git.rb index b0d5d35..f322000 100644 --- a/config/stack/git.rb +++ b/config/stack/git.rb @@ -2,8 +2,8 @@ description 'Git Distributed Version Control' version '1.7.7.5' source "http://git-core.googlecode.com/files/git-#{version}.tar.gz" - requires :git_dependencies - + requires :git_dependencies, :github_keys + verify do has_file '/usr/local/bin/git' end @@ -13,3 +13,9 @@ description 'Git Build Dependencies' apt 'git-core', :dependencies_only => true end + +package :github_keys do + github_key = File.read(File.join(File.dirname(__FILE__), 'git', 'github_key.txt')) + # Don't require verification of github's ssh fingerprint for anyone on the system + push_text github_key, '/etc/ssh/ssh_known_hosts', :sudo => true +end diff --git a/config/stack/git/github_key.txt b/config/stack/git/github_key.txt new file mode 100644 index 0000000..de142d2 --- /dev/null +++ b/config/stack/git/github_key.txt @@ -0,0 +1 @@ +github.com,207.97.227.239 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== From dfeb63591f95fc831d7d1f9159d1b01500d09cfa Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Mon, 26 Dec 2011 21:49:36 -0500 Subject: [PATCH 16/20] Added some gems --- config/stack/gems/about_gem_packages.md | 13 +++++++++++++ config/stack/gems/bundler_gem.rb | 12 ++++++++++++ config/stack/gems/curb_gem.rb | 16 ++++++++++++++++ config/stack/gems/nokogiri_gem.rb | 16 ++++++++++++++++ config/stack/gems/rmagick_gem.rb | 18 ++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 config/stack/gems/about_gem_packages.md create mode 100644 config/stack/gems/bundler_gem.rb create mode 100644 config/stack/gems/curb_gem.rb create mode 100644 config/stack/gems/nokogiri_gem.rb create mode 100644 config/stack/gems/rmagick_gem.rb diff --git a/config/stack/gems/about_gem_packages.md b/config/stack/gems/about_gem_packages.md new file mode 100644 index 0000000..7fb1d57 --- /dev/null +++ b/config/stack/gems/about_gem_packages.md @@ -0,0 +1,13 @@ +Sprinkle packages for gems +-------------------------- + +**Why write packages for gems, which are themselves packages?** +Because they often have system-level dependencies, which the gemspec doesn't +document. This lets us document them and install their dependencies during +the initial stack install. + +**Why do they have names like *_gem.rb?** +This differentiates them from the gem's own files. If you try to require +something like "bundler", you'll get a warning about it not +having a package definition for "bundler", because it's loaded the Bundler +class, not your package file. \ No newline at end of file diff --git a/config/stack/gems/bundler_gem.rb b/config/stack/gems/bundler_gem.rb new file mode 100644 index 0000000..17e2e7a --- /dev/null +++ b/config/stack/gems/bundler_gem.rb @@ -0,0 +1,12 @@ +package :bundler_gem do + description "Bundler gem" + requires :ruby + + gem 'bundler' do + post :install, "ln -s -f #{RUBY_PATH}/bin/bundle /usr/local/bin/bundle" + end + + verify do + has_gem 'bundler' + end +end \ No newline at end of file diff --git a/config/stack/gems/curb_gem.rb b/config/stack/gems/curb_gem.rb new file mode 100644 index 0000000..584edf8 --- /dev/null +++ b/config/stack/gems/curb_gem.rb @@ -0,0 +1,16 @@ +package :curb_gem do + description "The curb gem, a curl interface in ruby" + + requires :curb_dependencies + + gem 'curb' + + verify do + has_gem 'curb' + end +end + +package :curb_dependencies do + requires :build_essential + apt %w(libcurl3 libcurl3-gnutls libcurl4-openssl-dev) +end \ No newline at end of file diff --git a/config/stack/gems/nokogiri_gem.rb b/config/stack/gems/nokogiri_gem.rb new file mode 100644 index 0000000..ec9c55e --- /dev/null +++ b/config/stack/gems/nokogiri_gem.rb @@ -0,0 +1,16 @@ +package :nokogiri_gem do + description "nokogiri gem (xml library)" + + requires :nokogiri_dependencies, :ruby + + gem 'nokogiri' + + verify do + has_gem 'nokogiri' + end +end + +package :nokogiri_dependencies do + requires :build_essential + apt %w(libxslt-dev libxml2-dev) +end \ No newline at end of file diff --git a/config/stack/gems/rmagick_gem.rb b/config/stack/gems/rmagick_gem.rb new file mode 100644 index 0000000..8e9a83c --- /dev/null +++ b/config/stack/gems/rmagick_gem.rb @@ -0,0 +1,18 @@ +package :rmagick_gem do + description "The rmagick gem, an image manipulation library" + + requires :rmagick_dependencies + + gem 'rmagick' + + verify do + has_gem 'rmagick' + end +end + +package :rmagick_dependencies do + requires :build_essential + # TODO: This package requires 179MB of disk on my Ubuntu Oneiric server. A binary + # installation of RMagick would be really nice! + apt 'libmagick9-dev' +end \ No newline at end of file From 1484587e56618c14113b8b9c7262a50b2ed816b6 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Tue, 27 Dec 2011 08:43:34 -0500 Subject: [PATCH 17/20] Moved Mysql gem into its own package and file so it can be installed separately and live with other gems. --- config/stack/gems/mysql_gem.rb | 12 ++++++++++++ config/stack/mysql.rb | 13 ------------- 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 config/stack/gems/mysql_gem.rb diff --git a/config/stack/gems/mysql_gem.rb b/config/stack/gems/mysql_gem.rb new file mode 100644 index 0000000..63d068e --- /dev/null +++ b/config/stack/gems/mysql_gem.rb @@ -0,0 +1,12 @@ +package :mysql_gem, :provides => :ruby_database_driver do + description 'Ruby MySQL gem' + apt 'libmysqlclient-dev' + + gem 'mysql' + + verify do + has_gem 'mysql' + end + + requires :ruby +end diff --git a/config/stack/mysql.rb b/config/stack/mysql.rb index 6d1ffc0..3b4e5cf 100644 --- a/config/stack/mysql.rb +++ b/config/stack/mysql.rb @@ -5,17 +5,4 @@ verify do has_executable 'mysql' end - - optional :mysql_driver -end - -package :mysql_driver, :provides => :ruby_database_driver do - description 'Ruby MySQL database driver' - gem 'mysql' - - verify do - has_gem 'mysql' - end - - requires :ruby end From 10c667b86ee80d69533fc4ca7daf0d040b6dfcb0 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 28 Dec 2011 12:15:07 -0500 Subject: [PATCH 18/20] Added mysql2 gem --- config/stack/gems/mysql2_gem.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 config/stack/gems/mysql2_gem.rb diff --git a/config/stack/gems/mysql2_gem.rb b/config/stack/gems/mysql2_gem.rb new file mode 100644 index 0000000..8ef6224 --- /dev/null +++ b/config/stack/gems/mysql2_gem.rb @@ -0,0 +1,12 @@ +package :mysql2_gem, :provides => :ruby_database_driver do + description 'Ruby MySQL2 gem' + apt 'libmysqlclient-dev' + + gem 'mysql2' + + verify do + has_gem 'mysql2' + end + + requires :ruby +end From 7c0ddad48d6ed009a9e2c80575de6362c065f8ab Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 28 Dec 2011 21:22:37 -0500 Subject: [PATCH 19/20] Added some missing verifiers. Standardized on gnutls SSL packages (instead of openssl). --- config/stack/apache.rb | 9 +++++++++ config/stack/essential.rb | 4 ++++ config/stack/gems/curb_gem.rb | 8 +++++++- config/stack/git.rb | 4 ++++ config/stack/ruby_enterprise.rb | 7 +++++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/config/stack/apache.rb b/config/stack/apache.rb index ddf564b..9094f54 100644 --- a/config/stack/apache.rb +++ b/config/stack/apache.rb @@ -5,6 +5,7 @@ end verify do + has_apt 'apache2' has_executable '/usr/sbin/apache2' end @@ -15,6 +16,10 @@ package :apache2_prefork_dev do description 'A dependency required by some packages.' apt 'apache2-prefork-dev' + + verify do + has_apt 'apache2-prefork-dev' + end end package :passenger, :provides => :appserver do @@ -67,6 +72,10 @@ package :passenger_dependencies do apt 'libcurl4-gnutls-dev' # Compilation dependency for apache module + + verify do + has_apt 'libcurl4-gnutls-dev' + end end # These "installers" are strictly optional, I believe diff --git a/config/stack/essential.rb b/config/stack/essential.rb index 104c081..e36e96c 100644 --- a/config/stack/essential.rb +++ b/config/stack/essential.rb @@ -3,4 +3,8 @@ apt 'build-essential' do pre :install, 'apt-get update' end + + verify do + has_apt 'build-essential' + end end diff --git a/config/stack/gems/curb_gem.rb b/config/stack/gems/curb_gem.rb index 584edf8..787bb01 100644 --- a/config/stack/gems/curb_gem.rb +++ b/config/stack/gems/curb_gem.rb @@ -12,5 +12,11 @@ package :curb_dependencies do requires :build_essential - apt %w(libcurl3 libcurl3-gnutls libcurl4-openssl-dev) + apt %w(libcurl3 libcurl3-gnutls libcurl4-gnutls-dev) + + verify do + has_apt 'libcurl3' + has_apt 'libcurl3-gnutls' + has_apt 'libcurl4-gnutls-dev' + end end \ No newline at end of file diff --git a/config/stack/git.rb b/config/stack/git.rb index f322000..2db70e0 100644 --- a/config/stack/git.rb +++ b/config/stack/git.rb @@ -18,4 +18,8 @@ github_key = File.read(File.join(File.dirname(__FILE__), 'git', 'github_key.txt')) # Don't require verification of github's ssh fingerprint for anyone on the system push_text github_key, '/etc/ssh/ssh_known_hosts', :sudo => true + + verify do + file_contains '/etc/ssh/ssh_known_hosts', 'github.com' + end end diff --git a/config/stack/ruby_enterprise.rb b/config/stack/ruby_enterprise.rb index bd40592..688a0ae 100644 --- a/config/stack/ruby_enterprise.rb +++ b/config/stack/ruby_enterprise.rb @@ -26,4 +26,11 @@ package :ree_dependencies do apt %w(zlib1g-dev libreadline-dev libssl-dev) requires :build_essential + + verify do + has_apt 'zlib1g-dev' + has_apt 'libreadline-dev' + has_apt 'libssl-dev' + has_apt 'curl' + end end \ No newline at end of file From 79e318579dddb3aab825d3920bcfef71ef2897d6 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Tue, 3 Jan 2012 15:28:16 -0500 Subject: [PATCH 20/20] Added postfix mail server --- config/stack/postfix.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 config/stack/postfix.rb diff --git a/config/stack/postfix.rb b/config/stack/postfix.rb new file mode 100644 index 0000000..b006193 --- /dev/null +++ b/config/stack/postfix.rb @@ -0,0 +1,9 @@ +package :postfix, :provides => :smtp do + description "Postfix SMTP server for outgoing mail" + + apt 'postfix' + + verify do + has_apt 'postfix' + end +end \ No newline at end of file