将我的应用程序部署到 Amazon 的 Opsworks 时,我的资产预编译步骤经常失败。
厨师食谱如下所示:
node[:deploy].each do |application, deploy|
deploy deploy[:deploy_to] do
before_restart do
rails_env = deploy[:rails_env]
current_release = release_path
execute "rake assets:precompile" do
user deploy[:user]
cwd current_release
command "bundle exec rake assets:precompile"
environment "RAILS_ENV" => rails_env
end
end
end
end
...产生此错误:
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received ''
---- Begin output of bundle exec rake assets:precompile ----
STDOUT:
STDERR: I, [2014-07-15T02:05:30.399857 #12281] INFO -- : Writing <asset path>
...
...
...
---- End output of bundle exec rake assets:precompile ----
Ran bundle exec rake assets:precompile returned
编译步骤似乎成功了,为什么 Chef 会出错?