Opsworks - 厨师:在运行sidekiq的opsworks厨师钩子里耙

问题描述 投票:0回答:1

我在opsworks中使用了before_restart.rb钩子,当它运行“rake i18n:js:export”时我遇到了问题。我不知道为什么用这个耙子运行sidekiq。它仅在opsworks的设置阶段失败。当我部署它时,错误消失。

[2015-01-09T18:52:17+00:00] INFO: deploy[/srv/www/XXX] queueing checkdeploy hook /srv/www/XXX/releases/20150109185157/deploy/before_restart.rb
[2015-01-09T18:52:17+00:00] INFO: Processing execute[rake i18n:js:export] action run (/srv/www/XXXX/releases/20150109185157/deploy/before_restart.rb line 3)


Error executing action `run` on resource 'execute[rake i18n:js:export]'


Mixlib::ShellOut::ShellCommandFailed

Expected process to exit with [0], but received '1'
---- Begin output of bundle exec rake i18n:js:export ----
STDOUT: 2015-01-09T18:52:30Z 1808 TID-92c6g INFO: Sidekiq client with redis options {}
STDERR: /home/deploy/.bundler/XXXX/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:309:in `rescue in establish_connection': Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED) (Redis::CannotConnectError)
ruby-on-rails chef aws-opsworks
1个回答
0
投票

Sidekiq客户端(不是sidekiq服务器)正在运行,因为它是在初始化程序中定义的。当rake运行时,它会加载整个rails应用程序环境。因此,要么允许环境变量在config/initializers/sidekiq.rb中禁用sidekiq客户端,要么确保在运行此实例的实例上正确配置了redis-server。

unless ENV['DISABLE_SIDEKIQ']
  # Sidekiq.configure...
end

DISABLE_SIDEKIQ=true bundle exec rake do:stuff
© www.soinside.com 2019 - 2024. All rights reserved.