Instead of specifying the lib/workers/
directory as the -r
option for sidekiq, it's necessary to point it to some file which will deal with the necessary requires and setup for your workers. For example, you might have an environment.rb
file in the root of your project, requiring all the workers within the lib/workers/
directory; you'd specify this with Sidekiq by using -r ./environment.rb
. It might perhaps be useful to note that Sidekiq won't load your config.ru
file by itself as it doesn't use Rackup; instead, you might like to extract anything necessary to an environment.rb
file or similar, and require that from within config.ru
.
Sidekiq error on required ruby file
문제
I'm trying to start my application. Is a unicorn + foreman + sinatra application.
This is my config.ru file:
require "rubygems"
require "sinatra"
Bundler.require
require File.expand_path '../twitter_module.rb', __FILE__
run TwitterModule
require File.expand_path '../lib/tweet_streamer.rb', __FILE__
require 'sidekiq/web'
run Rack::URLMap.new('/' => Sinatra::Application, '/sidekiq' => Sidekiq::Web)
this is my sidekiq.yml:
---
:pidfile: tmp/pids/sidekiq.pid
development:
:verbose: true
:logfile: log/sidekiq_development.log
and this is my Procfile:
unicorn: bundle exec unicorn -c config/unicorn.rb
sidekiq: bundle exec sidekiq -C config/sidekiq.yml -e development -r lib/workers
The problem now is that I always give this error:
2013-10-12T15:30:23Z 28234 TID-ov4rh38wo INFO: Please point sidekiq to a Rails 3/4 application or a Ruby file
2013-10-12T15:30:23Z 28234 TID-ov4rh38wo INFO: to load your worker classes with -r [DIR|FILE].
What am I missing?
해결책
제휴하지 않습니다 StackOverflow