Skip to content

Instantly share code, notes, and snippets.

View belinskidima's full-sized avatar

Belinski Dima belinskidima

  • Chisinau, Republic of Moldova
View GitHub Profile
### Unicorn ###
check process unicorn
with pidfile "/home/deploy/goodpolitics/shared/tmp/pids/unicorn.pid"
start program = "/bin/su - deploy -c 'cd /home/deploy/goodpolitics/current && ( export RAILS_ENV='production'; /usr/local/rvm/bin/rvm default do bundle exec unicorn -c /home/deploy/goodpolitics/current/config/unicorn/production.rb -E deployment -D )"
stop program = "/bin/su - deploy -c 'cd /home/deploy/goodpolitics/current && /usr/bin/env kill -s QUIT`cat /home/deploy/goodpolitics/current/tmp/pids/unicorn.pid`'"
if memory usage > 90% for 3 cycles then restart
if cpu > 90% for 2 cycles then restart
if 5 restarts within 5 cycles then timeout
> eval $(ssh-agent)
> ssh-add
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
kill -9 $(lsof -i tcp:3000 -t)
source src1
{
type = mysql
#####################################################################
## SQL settings (for 'mysql' and 'pgsql' types)
#####################################################################
# some straightforward parameters for SQL source types
sql_host = localhost