Skip to content

Instantly share code, notes, and snippets.

Last active Jul 27, 2016
What would you like to do?
Upstart with Puma and chruby for a single app (single mode).
after "deploy:restart", "puma:restart"
namespace :puma do
task :restart, roles: :app do
run "cd #{current_path} && #{bundle_cmd} exec pumactl -S #{shared_path}/pids/puma.state restart"
upstream app_server {
server unix:///srv/deploy/app/shared/sockets/puma.sock fail_timeout=0;
server {
listen 80;
server_name _;
access_log /var/log/nginx/app-access.log combined;
keepalive_timeout 5;
root /srv/deploy/app/current/public;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
location ~ ^/assets/ {
root /srv/deploy/app/current/public;
gzip_static on;
expires 1y;
add_header Cache-Control "public";
add_header ETag "";
access_log off;
error_page 500 502 503 504 /500.html;
location = /500.html {
root /srv/deploy/app/current/public;
directory '/srv/deploy/app/current'
rackup '/srv/deploy/app/current/'
environment 'production'
daemonize false
pidfile '/srv/deploy/app/shared/pids/'
state_path '/srv/deploy/app/shared/pids/puma.state'
stdout_redirect '/srv/deploy/app/shared/log/puma-stdout.log', '/srv/deploy/app/shared/log/puma-stderr.log'
threads 0, 32
workers 0
bind 'unix:///srv/deploy/app/shared/sockets/puma.sock'
description "Puma Process Monitoring"
author "Vincent Durand <>"
start on runlevel [12]
stop on shutdown
respawn limit 5 15
setuid deploy
setgid deploy
exec /bin/bash << EOT
export HOME=/srv/deploy
source /usr/local/share/chruby/
source /usr/local/share/chruby/
cd /srv/deploy/app/current && exec bundle exec puma -C config/puma/production.rb
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment