Skip to content

Instantly share code, notes, and snippets.

@threetee
Created June 15, 2011 22:03
Show Gist options
  • Save threetee/1028250 to your computer and use it in GitHub Desktop.
Save threetee/1028250 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