This cookbook installs and configures Nginx web server with Passenger application server. It is a customized implementation of the AWS OpsWorks Nginx cookbook.
You need to provide a nginx package that has passenger (and any other desired modules) compiled in.
This is developed and tested against Amazon linux and intended for use within OpsWorks.
Include this cookbook as a dependency, set package source and add recipes to run list.
Attributes of note:
node[:nginx][:custom_package][:source]
- URL to fetch Nginx package from compiled with passenger and any other custom modules.node[:passenger][:optimize_for]
- Set to 'processing' or 'blocking_io' to optimize min and max processes accordingly. Defaults toprocessing
.node[:nginx][:try_static_files]
- Have nginx serve static files for request before deferring to Passenger application. Defaults tofalse
.node[:passenger][:conf]
- String key based hash of name value pairs to write to passenger configuration for nginx. Pairs with nil value will be omitted.node[:nginx][:restart_on_deploy]
- Whether to restart/reload nginx on a deploy. Defaults to false for a rolling restart deploy strategy.
See attributes source for full list of configuration options.
setup
- Install and configure nginx and passenger. This should be run in OpsWorks setup event.deploy
- Add new passenger enabled nginx site. This should be run in OpsWorks deploy event.maintenance
- Toggle serving of temporary static maintenance page withnode[:nginx][:serve_maintenance_page]
.
Setup and enable a passenger enabled site in Nginx.
:create
- Create the Nginx configurations and enable that site. (Default)
deploy
- OpsWorks deploy hash.
node[:deploy].each do |application, deploy|
opsworks_passenger_nginx_app application do
deploy deploy
end
end
Create Nginx configuration included in the global http
context.
:create
- Create the Nginx configuration. (Default)
name
- Name of configuration file.source
- Path to template file in consuming cookbook.variables
- Hash of variables to pass to template.
opsworks_passenger_nginx_conf "tacos" do
source "tacos.conf.erb"
variables(
:cheese => node[:cheese]
)
end
Create Nginx configuration included in the passenger enabled site server
context.
:create
- Create the Nginx configuration. (Default)
name
- Name of configuration file.source
- Path to template file in consuming cookbook.variables
- Hash of variables to pass to template.scope
-shared
,http
, orssl
. Defaults toshared
.
opsworks_passenger_nginx_server_conf "tacos" do
source "tacos.conf.erb"
scope "http"
variables(
:cheese => node[:cheese]
)
end
Author:: Sport Ngin Platform Operations ([email protected])