Sidekiq server not loading configuration file

流过昼夜 提交于 2019-12-10 13:55:30

问题


I'm trying to setup sidekiq with my sinatra application, and I'm having trouble starting up the sidekiq workers to run in the daemon mode, with a configuration file.

My project has the following structure:

project
- config
-- sidekiq.yml #Sidekiq Config File
- app
-- app.rb #Sinatra Application File
- Rakefile
- Gemfile
- etc.

The ultimate goal is to create some rake tasks to handle all sidekiq tasks.

For now, I'm just trying to the get things to work correctly via the command line, and then I'll get it working via rake.

sidekiq.yml

# Sidekiq Configuration
---
development:
  logile: ./log/sidekiq_development.log
  verbose: true
  pidfile: ./tmp/pids/sidekiq.pid
  concurrency: 1
  queues:
    - [household_import, 7]

When I run this command in the project directory:

bundle exec sidekiq -C './config/sidekiq.yml' -e 'development' -d

I get the following:

You really should set a logfile if you're going to daemonize
/Users/gutter007/git/webapps/project/vendor/bundle/gems/sidekiq-2.16.1/lib/sidekiq/cli.rb:141:in
 `daemonize'
 /Users/gutter007/git/webapps/project/vendor/bundle/gems/sidekiq-2.16.1/lib/sidekiq/cli.rb:39:in
 `parse'
 /Users/gutter007/git/webapps/project/vendor/bundle/gems/sidekiq-2.16.1/bin/sidekiq:7:in
 `<top (required)>'
 /Users/gutter007/git/webapps/project/vendor/bundle/bin/sidekiq:23:in
 `load'
 /Users/gutter007/git/webapps/project/vendor/bundle/bin/sidekiq:23:in
 `<main>'

My confusion is that I have the logfile set in the config file. My assumption is that it's not picking up or reading the cofig file correctly.

I tried tweaking the paths, and using full paths with the config file, but it did not seem to change anything the error message. I've also tweaked the config file itself, assuming the format might be off, but no dice.

Does anyone see what I'm doing wrong here?

Please let me know if you need any more information.

thanks.


回答1:


I dug into the sidekiq code, and debugged my config file issues.

There were two issues:

  1. I spelled logfile incorrectly ... doh!
  2. You need to setup each row with a colon(:) to symbolize the value. It pulls the yaml file into a hash, and without the symbol it won't recognize the key

So

development:
  logfile: ./log/sidekiq_development.log

won't work, but

development:
  :logfile: ./log/sidekiq_development.log
#notice the ':' infront of the logfile

does!

Here is my updated working logfile.

# Sidekiq Configuration
---
development:
  :logfile: ./log/sidekiq_development.log
  :verbose: true
  :pidfile: ./log/tmp/pids/sidekiq.pid
  :concurrency: 1
  :queues:
    - [household_import, 7]



回答2:


Following command helped me,

sidekiq -d -q carrierwave -l sidekiq.log

you can omit "-q carrierwave" part, if yuo're not using 'carrierwave'



来源:https://stackoverflow.com/questions/20058417/sidekiq-server-not-loading-configuration-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!