Monit unable to start sidekiq on Opsworks server

Posted by webdevtom on Server Fault See other posts from Server Fault or by webdevtom
Published on 2013-10-17T21:06:36Z Indexed on 2013/10/17 21:58 UTC
Read the original article Hit count: 494

Filed under:
|

I have used AWS Opsworks to create some servers. I have Sidekiq running as part of my Rails application. When I deploy Sidekiq restarts nicely.

I am configuring Monit to watch the pid and start and stop Sidekiq if there are any issues. However when Monit trys to start Sidekiq I see that the wrong Ruby looks to be used.

Oct 17 13:52:43 daitengu sidekiq:  /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/definition.rb:361:in `validate_ruby!': Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
Oct 17 13:52:43 daitengu sidekiq:   from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler.rb:116:in `setup'
Oct 17 13:52:43 daitengu sidekiq:   from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/setup.rb:17

When I run the command from the cli Sidekiq launches correctly.

$> cd /srv/www/myapp/current && RAILS_ENV=production nohup /usr/local/bin/bundle exec sidekiq -C config/sidekiq.yml >> /srv/www/myapp/shared/log/sidekiq.log 2>&1 &
$> ps -aef |grep sidekiq
root      1236  1235  8 20:54 pts/0    00:00:50 sidekiq 2.11.0 myapp [0 of 25 busy]

My sidekiq.monitrc file

check process unicorn with pidfile /srv/www/myapp/shared/pids/unicorn.pid
    start program = "/bin/bash -c 'cd /srv/www/myapp/current && /usr/local/bin/bundle exec unicorn_rails --env production --daemonize -c /srv/www/myapp/shared/config/unicorn.conf'"
    stop program = "/bin/bash -c 'kill -QUIT `cat /srv/www/myapp/shared/pids/unicorn.pid`'"

© Server Fault or respective owner

Related posts about amazon-web-services

Related posts about monit