hw-cookbooks/graphite — pull request #61 by gansbrest (2013-05-01 22:43:06+00:00)
Title: Uwsgi support, so you are not limited to apache option

Here is the summary of changes I've made:

- you can install uwsgi using pip and we have it available since graphite cookbook relies on python support.

- adjusted sv-graphite-web-run.erb template, so it actually works now and autostarts with runit

- made bitmap packages installation optional, some rehl system don't need them (you have them by default, but there is a new attribute to remove those if you need to )

- default recipe should just work as it used to be, with apache server by default

----------------------------------------

After you merge this changes you can configure graphite with nginx pretty easily, we may want to integrate nginx support to the cookbook in the future I just didn't want to create huge pull request. Here is what I do to enable nginx support:

attributes file:

default['nginx']['port'] = 80

recipe:

include_recipe "nginx"

template "#{node['nginx']['dir']}/sites-available/graphite" do
source "graphite/graphite_nginx.conf"
variables({
:nginx_port => node['nginx']['port'],
:graphite_base_dir => node['graphite']['base_dir'],
:uwsgi_socket => node['graphite']['uwsgi_socket']
})
mode 0755
end

nginx_site "graphite"

and here is nginx site config:

server {
listen <%= @nginx_port %>;
server_name graphite.*;

# Your project's static media.
location /content/ {
alias <%= @graphite_base_dir %>/webapp/content/;
}

# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include uwsgi_params;
}
}

upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server <%= @uwsgi_socket %>;
}