gpt4 book ai didi

ruby-on-rails - 在 Heroku 上启动 sidekiq 时出错,缺少 sidekiq.log 文件崩溃

转载 作者:IT王子 更新时间:2023-10-29 06:03:09 28 4
gpt4 key购买 nike

我刚开始使用 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]

简介

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

我的变量.rb

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

我应该注意,我有一个 log/sidekiq.log 文件。另外,我之前一直在 gitignoring 日志文件,但现在我不是。我已经仔细检查过他们是否正在检查我的其他 gitrepo。 sidekiq.log 文件在那里……只是找不到。

最佳答案

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

关于ruby-on-rails - 在 Heroku 上启动 sidekiq 时出错,缺少 sidekiq.log 文件崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30017783/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com