Awesome
passenger_apache2 Cookbook
Installs Phusion Passenger Ruby application server for Apache 2.
Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.
Requirements
Platforms
- Debian/Ubuntu
- RHEL/CentOS/Scientific/Amazon/Oracle
- Fedora
- openSUSE/SLES
Chef
- Chef 14+
Cookbooks
- apache2 >= 2.0.0
Attributes
-
node['passenger']['version']
- Specify the version of passenger to install. -
node['passenger']['max_pool_size']
- Sets PassengerMaxPoolSize in the Apache module config. -
node['passenger']['root_path']
- The location of the passenger gem. -
node['passenger']['ruby_bin']
- Sets PassengerRuby in the Apache module config and is used for passenger module configuration. Defaults tonode['languages']['ruby']['ruby_bin']
. -
node['passenger']['module_path']
- The location of the compiled passenger apache module. -
node['passenger']['install_method']
- Includes the "source" (gem install) or "package" recipe. Default "source." -
node['passenger']['apache_mpm']
- Override with an "override_attribute" (in a role, environment or with node.override) to "worker" or "threaded" to use apache2-threaded-dev package. Otherwise this assumes prefork. -
node['passenger']['package']['name']
- Name of the package for passenger, default is nil, so this must be set before using the "package" install method/recipe. -
node['passenger']['install_module']
- Specify the boolean value which decides installing Passenger. Defaults to true, and setting to false skips the installation -
node['passenger']['package']['version']
- Specify the version of the passenger package to install. Usesversion
attribute above by default. To install the version available by default (latest, usually), delete the attribute in a recipe with this line:node.normal['passenger']['package'].delete('version')
Recipes
default
Installs passenger from gem (source) or package depending on the value of the install_method
attribute.
mod_rails
Installs the passenger gem and enables the module in Apache2.
source
Installs passenger as a RubyGem.
package
Installs passenger as a Package.
Set the install_method
attribute to package, then set the package['name']
attribute to the correct package for your platform. The recipe does not yet handle adding yum repositories for RHEL platforms, so that should be done in another recipe until COOK-2414 is resolved.
Set the node['passenger']['package']['version']
attribute to the correct value for your system's available package repository if necessary. By default the value is nil which will install the latest package version from the distribution package manager.
Usage
For example, to run a Rails application on passenger:
include_recipe "rails"
include_recipe "passenger_apache2"
web_app "myproj" do
docroot "/srv/myproj/public"
server_name "myproj.#{node[:domain]}"
server_aliases [ "myproj", node[:hostname] ]
rails_env "production"
end
A sample config template is provided, web_app.conf.erb
. If this is suitable for your application, add 'cookbook "passenger_apache2"' to the define above to use that template. Otherwise, copy the template to the cookbook where you're using web_app
, and modify as needed. The cookbook parameter is optional, if omitted it will search the cookbook where the define is used.
Example:
web_app "myproj" do
# ...
cookbook "passenger_apache2"
# ...
end
Known Issues
When run as a daemonized process under init on linux, using https://github.com/opscode-cookbooks/chef-client/blob/master/recipes/init_service.rb for example, the /sbin/service script scrubs the environment, including the HOME environment variable. In some versions, Passenger depends on the HOME environment variable to be present. This can be worked around by setting the necessary environment variables directly in your recipes.
Contributors
This project exists thanks to all the people who contribute.
Backers
Thank you to all our backers!
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.