Skip to content

Instantly share code, notes, and snippets.

@jalaziz
Last active December 14, 2015 19:49
Show Gist options
  • Save jalaziz/5139257 to your computer and use it in GitHub Desktop.
Save jalaziz/5139257 to your computer and use it in GitHub Desktop.
Graphiti Upstart + Unicorn + Nginx
description "Graphiti"
start on runlevel [2345]
stop on runlevel [06]
respawn limit 10 5
chdir /opt/graphiti
kill signal QUIT
exec bundle exec unicorn -c config/unicorn.rb -E production
*/5 * * * * cd /opt/graphiti && PATH=$PATH:/usr/local/bin bundle exec rake graphiti:metrics
server {
listen 80 default_server deferred;
charset utf-8;
access_log /var/log/nginx/graphiti.access.log;
error_log /var/log/nginx/graphiti.error.log;
root /opt/graphiti/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:5001;
}
}
listen 5001 # by default Unicorn listens on port 8080
worker_processes 2 # this should be >= nr_cpus
pid "/var/run/graphiti.pid"
stderr_path "/opt/graphiti/shared/log/unicorn.log"
stdout_path "/opt/graphiti/shared/log/unicorn.log"
user "graphite", "graphite"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment