Skip to content

Instantly share code, notes, and snippets.

@kazuph
Created April 26, 2014 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuph/11313429 to your computer and use it in GitHub Desktop.
Save kazuph/11313429 to your computer and use it in GitHub Desktop.
supervisord + unicornでhot restart (deploy) する ref: http://qiita.com/kazuph/items/55a5f74b9dca2d17bd65
pip install git+https://github.com/kazuph/unicornherder.git
[web]
command=bash -lc 'bundle exec unicornherder -u unicorn_rails -p tmp/pids/unicorn.pid -- -c config/unicorn.rb -E production'
numprocs=1
autostart=true
autorestart=true
stopsignal=QUIT
startsecs=1
user=yourname
redirect_stderr=true
stdout_logfile=/var/log/appname/app/app.log
stdout_logfile_maxbytes=0
stdout_logfile_backups=0
stderr_logfile=/var/log/appname/app/app.log
stderr_logfile_maxbytes=0
stderr_logfile_backups=0
environment=HOME="/home/app",USER="app"
directory=/home/yourname/appname
$ cd /path/yourname/appname
$ kill -USR2 `cat tmp/pids/unicorn.pid`
Use of --pid/-P is strongly discouraged
Use the 'pid' directive in the Unicorn config file instead
opts.on("-P PATH", "DEPRECATED") do |v|
warn %q{Use of -P is ambiguous and discouraged}
warn %q{Use --path or RAILS_RELATIVE_URL_ROOT instead}
ENV['RAILS_RELATIVE_URL_ROOT'] = v
end
- 'unicorn': 'unicorn -D -P "{pidfile}" {args}',
- 'unicorn_rails': 'unicorn_rails -D -P "{pidfile}" {args}',
- 'unicorn_bin': '{unicorn_bin} -D -P "{pidfile}" {args}',
+ 'unicorn': 'unicorn -D {args}',
+ 'unicorn_rails': 'unicorn_rails -D {args}',
+ 'unicorn_bin': '{unicorn_bin} -D {args}',
COMMANDS = {
'unicorn': 'unicorn -D -P "{pidfile}" {args}',
'unicorn_rails': 'unicorn_rails -D -P "{pidfile}" {args}',
'unicorn_bin': '{unicorn_bin} -D -P "{pidfile}" {args}',
'gunicorn': 'gunicorn -D -p "{pidfile}" {args}',
'gunicorn_django': 'gunicorn_django -D -p "{pidfile}" {args}',
'gunicorn_bin': '{gunicorn_bin} -D -p "{pidfile}" {args}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment