Skip to content

Instantly share code, notes, and snippets.

@rberger
Forked from threetee/nginx_unicorn.rb
Created June 15, 2011 22:06
Show Gist options
  • Save rberger/1028259 to your computer and use it in GitHub Desktop.
Save rberger/1028259 to your computer and use it in GitHub Desktop.
chef nginx_unicorn recipe (part of modified application cookbook)
app = node.run_state[:current_app]
#unicorn
include_recipe "application::unicorn"
#nginx
include_recipe "nginx::source"
#nginx/unicorn proxy
socket = "/tmp/unicorn_#{app['id']}.sock"
template "#{node[:nginx][:dir]}/sites-available/#{app['id']}" do
source "unicorn_nginx_site.erb"
owner "root"
group "root"
cookbook "#{app['id']}"
mode 0644
variables(
:docroot => File.join(app['deploy_to'], 'current', 'public'),
:socket => socket,
:opts => app['nginx'],
:server_domain => app['server_domain'][node.app_environment],
)
notifies :restart, resources(:service => "nginx")
end
nginx_site app['id']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment