在Heroku上启动sidekiq时出错,缺少sidekiq.log文件崩溃(Error starting sidekiq on Heroku, missing sidekiq.log file cr

编程入门 行业动态 更新时间:2024-10-26 14:38:06
在Heroku上启动sidekiq时出错,缺少sidekiq.log文件崩溃(Error starting sidekiq on Heroku, missing sidekiq.log file crash)

我是使用sidekiq&redis的新手,并试图让sidekiq在Heroku上运行,但每次部署Rails 4应用程序时似乎都崩溃了。 我在Papertrail中遇到这个错误:

May 03 11:16:37 myapp app/worker.1: No such file or directory @ rb_sysopen - ./log/sidekiq.log May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:636:in `initialize' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:636:in `open' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:636:in `create_logfile' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:630:in `rescue in open_logfile' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:627:in `open_logfile' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:584:in `initialize' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:318:in `new' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:318:in `initialize' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/logging.rb:31:in `new' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/logging.rb:31:in `initialize_logger' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:344:in `initialize_logger' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:39:in `parse' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/bin/sidekiq:7:in `<top (required)>' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `load' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `<main>' May 03 11:16:38 myapp heroku/worker.1: State changed from up to crashed May 03 11:16:38 myapp heroku/worker.1: Process exited with status 1

我正在使用RedisToGo添加。 这是我的配置:

sidekiq.yaml

--- development: :concurrency: 10 production: :concurrency: 20 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default - mailers - [high_priority, 2]

Procfile

worker: bundle exec sidekiq -c 2 -v config/sidekiq.yml web: bundle exec puma -p $PORT

sidekiq.rb

require 'sidekiq' ENV["REDISTOGO_URL"] ||= "redis://localhost:6379" Sidekiq.configure_server do |config| config.redis = { url: ENV["REDISTOGO_URL"], :size => 4 } database_url = ENV['MYAPP_DATABASE_URL'] if database_url ENV['MYAPP_DATABASE_URL'] = "#{database_url}?pool=50" ActiveRecord::Base.establish_connection end end Sidekiq.configure_client do |config| config.redis = { url: ENV["REDISTOGO_URL"], :size => 1 } end

my_var.rb

ENV['REDISTOGO_URL'] = 'redis:/myredistogourl/' ENV['PROVIDER_URL'] = ENV['REDISTOGO_URL']

我应该注意到,我有一个log / sidekiq.log文件。 另外,我之前一直在gitignoring日志文件,但现在我没有。 我仔细检查了他们正在检查我的其他gitrepo。 sidekiq.log文件在那里...它只是没有被发现。

I'm new to using sidekiq & redis and am trying to get sidekiq to run on Heroku, but it seems to crash each time I deploy my Rails 4 app. I get this error in Papertrail:

May 03 11:16:37 myapp app/worker.1: No such file or directory @ rb_sysopen - ./log/sidekiq.log May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:636:in `initialize' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:636:in `open' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:636:in `create_logfile' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:630:in `rescue in open_logfile' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:627:in `open_logfile' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:584:in `initialize' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:318:in `new' May 03 11:16:37 myapp app/worker.1: /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/logger.rb:318:in `initialize' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/logging.rb:31:in `new' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/logging.rb:31:in `initialize_logger' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:344:in `initialize_logger' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/lib/sidekiq/cli.rb:39:in `parse' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/gems/sidekiq-3.3.4/bin/sidekiq:7:in `<top (required)>' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `load' May 03 11:16:37 myapp app/worker.1: /app/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `<main>' May 03 11:16:38 myapp heroku/worker.1: State changed from up to crashed May 03 11:16:38 myapp heroku/worker.1: Process exited with status 1

I am using the RedisToGo add on. Here are my configurations:

sidekiq.yaml

--- development: :concurrency: 10 production: :concurrency: 20 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default - mailers - [high_priority, 2]

Procfile

worker: bundle exec sidekiq -c 2 -v config/sidekiq.yml web: bundle exec puma -p $PORT

sidekiq.rb

require 'sidekiq' ENV["REDISTOGO_URL"] ||= "redis://localhost:6379" Sidekiq.configure_server do |config| config.redis = { url: ENV["REDISTOGO_URL"], :size => 4 } database_url = ENV['MYAPP_DATABASE_URL'] if database_url ENV['MYAPP_DATABASE_URL'] = "#{database_url}?pool=50" ActiveRecord::Base.establish_connection end end Sidekiq.configure_client do |config| config.redis = { url: ENV["REDISTOGO_URL"], :size => 1 } end

my_var.rb

ENV['REDISTOGO_URL'] = 'redis:/myredistogourl/' ENV['PROVIDER_URL'] = ENV['REDISTOGO_URL']

I should note, I DO have a log/sidekiq.log file. Also, I had been gitignoring log files before, but now I'm not. I've double checked that they are checking into my other gitrepo. The sidekiq.log file is there...it's just not being found.

最满意答案

从config.yml中删除pidfile和logfile行。 你在Heroku上运行,他们没有任何意义。

Remove the pidfile and logfile lines from your config.yml. You're running on Heroku, they don't make any sense.

更多推荐

本文发布于:2023-08-03 13:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390148.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   log   Heroku   sidekiq   Error

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!