簡體   English   中英

Sidekiq在較舊的Capistrano版本中尋找en.yml文件

[英]Sidekiq looking for en.yml file in older capistrano release

我正在生產中運行sidekiq ,並使用capistrano部署了我的應用程序。 處理后台作業時,出現以下錯誤

I18n::InvalidLocaleData: can not load translations from /path/to/folder/releases/20160904153949/config/locales/en.yml: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /path/to/folder/releases/20160904153949/config/locales/en.yml>

發行版20160904153949是舊的,已被刪除。 我想知道為什么sidekiq仍在研究舊版本。

下面是我的deploy.rb文件的外觀:

# config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'app_name'
set :repo_url, 'git@github.com:reboot/app_name.git'

# Default branch is :master
set :branch, 'master'

# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/path/to/app'

set :use_sudo, false
set :bundle_binstubs, nil

# Default value for :scm is :git
set :scm, :git

# Default value for :format is :pretty
set :format, :pretty

# Default value for :log_level is :debug
set :log_level, :debug

# Default value for :pty is false
set :pty, true

# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')

# Default value for linked_dirs is []
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/assets')

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
set :keep_releases, 5
set :keep_assets, 3

after 'deploy:publishing', 'deploy:restart'

namespace :deploy do
  task :restart do
    on roles(:app) do
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end
end

以下是我的Capfile外觀

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'

require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/sidekiq'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

sidekiq停止/啟動由capistrano/sidekiq gem處理。 我的應用程序部署良好。 問題是sidekiq正在尋找所需文件的錯誤版本。

另外,我目前沒有sidekiq.yml文件。 我的應用很小,因此從未為其創建yml文件。

Ruby:2.3.0p0,Rails:4.2.5,nginx /乘客組合,Capistrano 3.4

更新

以下是完整的錯誤消息:

2016-09-07T19:33:22.349Z 3262 TID-md1a4 ContactUsEmailJob JID-fb18ad450d73ed857fe66aee INFO: fail: 0.069 sec

2016-09-07T19:33:22.350Z 3262 TID-md1a4 WARN: {"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ContactUsEmailJob","queue":"default","args":[{"job_class":"ContactUsEmailJob","job_id":"e30dfe20-89b2-49a9-833c-8e479bdb8a2d","queue_name":"default","arguments":[{"utf8":"✓","authenticity_token":"i+OuDyC2c243UvC0FRWk1esASnUhQ2jKbfvZnoX2GZLela+mPCcOU6qtpU3OZhxr0wTCYUpmFXD6623Q==","name":"Test","message":"test","controller":"static_pages","action":"email_us","_aj_hash_with_indifferent_access":true}],"locale":"en"}],"retry":true,"jid":"fb18ad450d73ed857fe66aee","created_at":1473276802.277088,"enqueued_at":1473276802.2773373,"error_message":"can not load translations from /path/to/app/releases/20160904153949/config/locales/en.yml: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /path/to/app/releases/20160904153949/config/locales/en.yml>","error_class":"I18n::InvalidLocaleData","failed_at":1473276802.3480363,"retry_count":0}

2016-09-07T19:33:22.350Z 3262 TID-md1a4 WARN: I18n::InvalidLocaleData: can not load translations from /path/to/app/releases/20160904153949/config/locales/en.yml: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /path/to/app/releases/20160904153949/config/locales/en.yml>

2016-09-07T19:33:22.350Z 3262 TID-md1a4 WARN: /path/to/app/shared/bundle/ruby/2.3.0/gems/i18n-0.7.0/lib/i18n/backend/base.rb:184:in `rescue in load_yml'

好的,所以我按照以下步驟解決了這個問題:

  • 殺死sidekiq的過程pkill sidekiq
  • /path/to/app/current/tmp/pid/刪除了sidekiq pid文件
  • 使用cap sidekiq:start ,這將創建pid文件
  • 最終部署我的應用程序(此過程將再次重新啟動sidekiq)

在那之后,一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM