Skip to content
Browse files

[app_passenger] Review fix:

split install passenger and setup vhost to separate recipes
updated license info
certs - stored in cb
logrotate - add size limit
php support option - removed
sqlite3 recipe - removed
minor fixes in code style and conditionals
fqdn check - removed
  • Loading branch information...
1 parent a753fb7 commit 295ceaebfdefa222034384b86949b629fbd4b962 NS committed Dec 5, 2011
View
11 .gitignore
@@ -1,3 +1,8 @@
-.DS_Store
-*.swp
-*.swo
+.DS_Store
+*.swp
+*.swo
+.idea
+/.git
+.DEV_TEMP
+.gitignore
+chefignore
View
3,376 cookbooks/app_passenger/files/default/cacert.pem
3,376 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN cookbooks/app_passenger/files/default/sqlite-3.7.0.1.tgz
Binary file not shown.
View
23 cookbooks/app_passenger/metadata.json
@@ -1,6 +1,6 @@
{
"name": "app_passenger",
- "description": "Installs/Configures app_passenger",
+ "description": "Installs/Configures Apache Passenger Rails application server",
"long_description": "== DESCRIPTION:\n\n* Installs and configures, apache+passenger application server.\n\n== REQUIREMENTS:\n\n* Requires a VM launched from a RightScale managed RightImage\n\n* Tested on CentOS 5.6 RightImage\n* Tested on Ubuntu RightImage\n\n== SETUP:\n\n* Place app_passenger::default recipe into your runlist to setup the application server. When\n using a RightScale ServerTemplate, this will also automatically add the\n common attributes to your ServerTemplate inputs.\n\n== USAGE:\n\n* Template con be combined in two modes:\n 1 For apps with bundler support\n You have to add \"install_required app gems\" recipe, and \"run_custom_rails_commands\" for migration commands\n 2 For apps without bundler support\n Y have to add \"install_custom_gems\" recipe, and \"run_custom_rails_commands\" for migration commands\n Anyway you can mix these recipes to fit needs of your project\n\n== KNOWN LIMITATIONS\n\n* none\n",
"maintainer": "RightScale, Inc.",
"maintainer_email": "support@rightscale.com",
@@ -31,7 +31,7 @@
"description": "Apache port number for your application Ex: 8000",
"default": "8000",
"recipes": [
- "app_passenger::svn_code_update_and_db_config"
+ "app_passenger::install_apache_rails_passenger_http_only_vhost"
],
"choice": [
@@ -70,21 +70,6 @@
"type": "string",
"required": "optional"
},
- "app_passenger/apache/php_enable": {
- "display_name": "Apache PHP Support",
- "description": "Enables PHP support for Apache by enabling PHP module. Required to execute PHP scripts.",
- "choice": [
- "true",
- "false"
- ],
- "required": "optional",
- "default": "false",
- "recipes": [
- "app_passenger::install_apache_rails_passenger_http_only_vhost"
- ],
- "calculated": false,
- "type": "string"
- },
"app_passenger/apache/serve_local_files": {
"display_name": "Apache serve local Files",
"description": "This option tells Apache whether it should serve the (static) content itself. Currently, it will omit PHP and TomCat dynamic content, such as *.php, *.action, *.jsp, and *.do Ex: true",
@@ -301,10 +286,10 @@
"app_passenger::default": "default cookbook recipe",
"app_passenger::install_custom_gems": "Custom gems install.",
"app_passenger::install_required_app_gems": "Bundler gems Install. Gemfile must be present in app directory.",
- "app_passenger::install_apache_rails_passenger_http_only_vhost": "Install and configure passenger module",
+ "app_passenger::install_apache_passenger": "Install and apache passenger module",
+ "app_passenger::setup_apache_passenger_vhost": "Configure apache passenger vhost",
"app_passenger::install_ruby_enterprise_edition": "Install Ruby EE",
"app_passenger::svn_code_update_and_db_config": "Configures rails deploy environment",
- "app_passenger::install_sqlite3_gem": "Recipe created to fix problems with installation of sqlite3 gem on RHEL based systems.",
"app_passenger::run_custom_rails_commands": "Run specific user defined commands Commands will be executed in the app directory. Command path ../rails/bin/",
"app_passenger::rhel_apache_fix": "Temporary recipe for fixing apache bug on red hat image"
},
View
15 cookbooks/app_passenger/metadata.rb
@@ -1,7 +1,7 @@
maintainer "RightScale, Inc."
maintainer_email "support@rightscale.com"
license "All rights reserved"
-description "Installs/Configures app_passenger"
+description "Installs/Configures Apache Passenger Rails application server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.0.1"
@@ -15,10 +15,11 @@
recipe "app_passenger::default", "default cookbook recipe"
recipe "app_passenger::install_custom_gems", "Custom gems install."
recipe "app_passenger::install_required_app_gems", "Bundler gems Install. Gemfile must be present in app directory."
-recipe "app_passenger::install_apache_rails_passenger_http_only_vhost", "Install and configure passenger module"
+recipe "app_passenger::install_apache_passenger", "Install and apache passenger module"
+recipe "app_passenger::setup_apache_passenger_vhost", "Configure apache passenger vhost"
recipe "app_passenger::install_ruby_enterprise_edition", "Install Ruby EE"
recipe "app_passenger::svn_code_update_and_db_config", "Configures rails deploy environment"
-recipe "app_passenger::install_sqlite3_gem", "Recipe created to fix problems with installation of sqlite3 gem on RHEL based systems."
+
recipe "app_passenger::run_custom_rails_commands", "Run specific user defined commands Commands will be executed in the app directory. Command path ../rails/bin/"
recipe "app_passenger::rhel_apache_fix", "Temporary recipe for fixing apache bug on red hat image"
@@ -42,14 +43,6 @@
:default => "",
:recipes => ["app_passenger::install_apache_rails_passenger_http_only_vhost"]
-attribute "app_passenger/apache/php_enable",
- :display_name => "Apache PHP Support",
- :description => "Enables PHP support for Apache by enabling PHP module. Required to execute PHP scripts.",
- :choice => ["true", "false"],
- :required => false,
- :default => "false",
- :recipes => ["app_passenger::install_apache_rails_passenger_http_only_vhost"]
-
attribute "app_passenger/apache/serve_local_files",
:display_name => "Apache serve local Files",
:description => "This option tells Apache whether it should serve the (static) content itself. Currently, it will omit PHP and TomCat dynamic content, such as *.php, *.action, *.jsp, and *.do Ex: true",
View
3 cookbooks/app_passenger/recipes/default.rb
@@ -1,3 +1,6 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
View
36 cookbooks/app_passenger/recipes/install_apache_passenger.rb
@@ -0,0 +1,36 @@
+#
+# Cookbook Name::app_passenger
+#
+# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
+# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
+# if applicable, other agreements such as a RightScale Master Subscription Agreement.
+
+rs_utils_marker :begin
+
+# Installing passenger module
+log"INFO: Installing passenger"
+bash "Install apache passenger gem" do
+ code <<-EOH
+/opt/ruby-enterprise/bin/gem install passenger -q --no-rdoc --no-ri
+ EOH
+ not_if do (File.exists?("/opt/ruby-enterprise/bin/passenger-install-apache2-module")) end
+end
+
+
+bash "Install_apache_passenger_module" do
+ code <<-EOH
+ /opt/ruby-enterprise/bin/passenger-install-apache2-module --auto
+ EOH
+ not_if "test -e #{node[:app_passenger][:ruby_gem_base_dir].chomp}/gems/passenger*/ext/apache2/mod_passenger.so"
+end
+
+rs_utils_marker :end
+
+
+
+
+
+
+
+
+
View
3 cookbooks/app_passenger/recipes/install_custom_gems.rb
@@ -1,3 +1,6 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
View
3 cookbooks/app_passenger/recipes/install_required_app_gems.rb
@@ -1,3 +1,6 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
View
3 cookbooks/app_passenger/recipes/install_ruby_enterprise_edition.rb
@@ -1,3 +1,6 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
View
60 cookbooks/app_passenger/recipes/install_sqlite3_gem.rb
@@ -1,60 +0,0 @@
-# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
-# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
-# if applicable, other agreements such as a RightScale Master Subscription Agreement.
-
-
-rs_utils_marker :begin
-
-#
-# For normal installation of sqlite3 gem we need to install sqlite 3.6.6+ instead sqlite 3.3.+ bundled with CentOS
-#
-case node[:platform]
- when "centos","redhat","redhatenterpriseserver","fedora","suse"
- node[:app_passenger][:sqlite_packages_install]= ["zlib-devel", "sqlite-devel"]
- #installing packages required foe compilation
- node[:app_passenger][:sqlite_packages_install].each do |p|
- package p
- end
-
- #Extracting cookbook file
- cookbook_file "/tmp/sqlite-3.7.0.1.tgz" do
- source "sqlite-3.7.0.1.tgz"
- mode "0644"
- end
-
- #Unpacking
- bash "unpack sqlite3" do
- code <<-EOH
- tar xzf /tmp/sqlite-3.7.0.1.tgz -C /tmp/
- EOH
- only_if do File.exists?("/tmp/sqlite-3.7.0.1.tgz") end
- end
-
- #Compiling sqlite3
- bash "compile sqlite3" do
- cwd "/tmp/sqlite-3.7.0.1/"
- code <<-EOH
- make install
- EOH
- only_if do File.exists?("/tmp/sqlite-3.7.0.1/configure") end
- end
-
- #Installing sqlite3 gem
- log"INFO: Installing sqlite3 gem"
- gem_package "sqlite3" do
- options " -- --with-sqlite3-dir=/opt/local/sqlite-3.7.0.1 -v 1.3.4"
- gem_binary node[:app_passenger][:gem_bin]
- end
-
-log "Gem reload forced with Gem.clear_paths"
-
-
- when "ubuntu","debian"
-
- gem_package "sqlite3" do
- gem_binary node[:app_passenger][:gem_bin]
- end
-
-end
-
-rs_utils_marker :end
View
49 cookbooks/app_passenger/recipes/rhel_apache_fix.rb
@@ -1,41 +1,48 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
rs_utils_marker :begin
-
#Recipe created to fix some issues in Centos / RHEL images
+node[:app_passenger][:mysql_packages_install]= ["mysql", "mysql-devel","mysqlclient15", "mysqlclient15-devel"]
-#Fixing centos root certificate authority issues
-bash "fix certs" do
- code <<-EOH
- cp /etc/pki/tls/certs/ca-bundle.crt /root/
- curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
- EOH
- only_if do (node[:platform]=="redhat" || node[:platform]=="centos") end
-end
-
-# removing preinstalled apache ssl.conf as it conflicts with ports.conf of web:apache
-file "/etc/httpd/conf.d/ssl.conf" do
- action :delete
- backup false
- only_if do (node[:platform]=="redhat" || node[:platform]=="centos") end
-end
-
-
-#installing packages required for mysql gem installation until db recipe on rhel will be fixed
- node[:app_passenger][:mysql_packages_install]= ["mysql", "mysql-devel","mysqlclient15", "mysqlclient15-devel"]
- #installing packages required for compilation
case node[:platform]
when "redhat","redhatenterpriseserver", "centos"
+ #Installing packages required for mysql gem installation until db recipe on rhel will be fixed
node[:app_passenger][:mysql_packages_install].each do |p|
package p
end
+ #Fixing centos root certificate authority issues
+ #Backup old certs
+ bash "fix certs" do
+ code <<-EOH
+ cp /etc/pki/tls/certs/ca-bundle.crt /root/
+ EOH
+ end
+
+ #Replacing old certs
+ cookbook_file "/etc/pki/tls/certs/ca-bundle.crt" do
+ source "cacert.pem"
+ mode "0644"
+ end
+
+ #Removing preinstalled apache ssl.conf as it conflicts with ports.conf of web:apache
+ file "/etc/httpd/conf.d/ssl.conf" do
+ action :delete
+ backup false
+ end
+
+
when "ubuntu","debian"
log "Nothing to do!"
+
end
+
rs_utils_marker :end
View
3 cookbooks/app_passenger/recipes/run_custom_rails_commands.rb
@@ -1,3 +1,6 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
View
32 ...apache_rails_passenger_http_only_vhost.rb → ...r/recipes/setup_apache_passenger_vhost.rb
@@ -1,3 +1,6 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
@@ -8,35 +11,6 @@
action :nothing
end
-# Checking for user FQDN
-if (node[:web_apache][:server_name] == "")
- log("Your FQDN is not set. Now it will be changed to :www.mydomain.com Please set DMS name manually, when you start this instance."){ level :warn }
- node[:web_apache][:server_name] = "www.mydomain.com"
-end
-
-# Installing passenger module
-log"INFO: Installing passenger"
-#gem_package "passenger" do
-# gem_binary node[:app_passenger][:gem_bin]
-# not_if do (File.exists?("/opt/ruby-enterprise/bin/passenger-install-apache2-module")) end
-#end
-
-bash "Install apache passenger gem" do
- code <<-EOH
-/opt/ruby-enterprise/bin/gem install passenger -q --no-rdoc --no-ri
- EOH
- not_if do (File.exists?("/opt/ruby-enterprise/bin/passenger-install-apache2-module")) end
-end
-
-
-
-bash "install_apache_passenger_module" do
- code <<-EOH
- /opt/ruby-enterprise/bin/passenger-install-apache2-module --auto
- EOH
- not_if "test -e #{node[:app_passenger][:ruby_gem_base_dir].chomp}/gems/passenger*/ext/apache2/mod_passenger.so"
-end
-
# Generation of new apache ports.conf, based on user prefs
template "#{node[:app_passenger][:apache][:install_dir]}/ports.conf" do
source "ports.conf.erb"
View
12 cookbooks/app_passenger/recipes/svn_code_update_and_db_config.rb
@@ -1,12 +1,12 @@
+#
+# Cookbook Name::app_passenger
+#
# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
# if applicable, other agreements such as a RightScale Master Subscription Agreement.
rs_utils_marker :begin
-#to initialize DB: inputs when we run recipe on operational instance
-include_recipe "db::default"
-
# Preparing dirs, required for apache+passenger
log "INFO: Creating directory for project deployment - #{node[:app_passenger][:deploy_dir]}"
directory node[:app_passenger][:deploy_dir] do
@@ -59,7 +59,7 @@
recursive true
end
#Creating subversion config for run without promts
-log "Creating subversion config"
+log "INFO: Creating subversion config"
template "/root/.subversion/servers" do
source "svn_servers.erb"
end
@@ -107,7 +107,7 @@
end
#creating database template
-log "Generating database.yml"
+log "INFO: Generating database.yml"
template "#{node[:app_passenger][:deploy_dir].chomp}/current/config/database.yml" do
owner node[:app_passenger][:apache][:user]
source "database.yml.erb"
@@ -118,7 +118,7 @@
ENV['RAILS_ENV'] = node[:app_passenger][:project][:environment]
#Creating bash file for manual $RAILS_ENV setup
-log "Creating bash file for manual $RAILS_ENV setup"
+log "INFO: Creating bash file for manual $RAILS_ENV setup"
template "/etc/profile.d/rails_env.sh" do
mode '0744'
source "rails_env.erb"
View
11 cookbooks/app_passenger/templates/default/basic_vhost.erb
@@ -43,17 +43,6 @@ RailsEnv <%= @params[:rails_env] %>
PassengerAppRoot <%="#{node[:app_passenger][:deploy_dir].chomp}/current"%>
-<% if (File.exists?("#{node[:app_passenger][:apache][:install_dir]}/modules/libphp5.so"))||(node[:app_passenger][:apache][:php_enable]=="true") %>
-# Load (if necessary) and bind the PHP interpreter to handle files with a .php extension.
-<IfModule !mod_php5.c>
- LoadModule php5_module modules/libphp5.so
-</IfModule>
-DirectoryIndex default.php index.php
-AddHandler php5-script .php
-AddType text/html .ph
-<% end %>
-
-
# Enable status page for monitoring purposes
RewriteCond %{REMOTE_ADDR} ^(127.0.0.1)
RewriteRule ^(/server-status) $1 [H=server-status,L]
View
2 cookbooks/app_passenger/templates/default/logrotate_rails.erb
@@ -7,6 +7,8 @@
#
/var/log/rails/*log {
+ size 10M
+ rotate 4
missingok
notifempty
nocompress

0 comments on commit 295ceae

Please sign in to comment.
Something went wrong with that request. Please try again.