在OpsWorks上启动其中一个实例时出现以下错误。有没有人对这个错误有任何想法?
这是在官方错误公告之前打印的(根据sethvargo的要求):
[2014-08-13T17:27:08+00:00] INFO: Processing directory[/srv/www/instance/shared/cached-copy] action
delete (opsworks_delayed_job::deploy line 48)
[2014-08-13T17:27:08+00:00] INFO: Processing ruby_block[change HOME to /home/deploy for source checkout] action run (opsworks_delayed_job::deploy line 56)
[2014-08-13T17:27:08+00:00] INFO: ruby_block[change HOME to /home/deploy for source checkout] called
[2014-08-13T17:27:08+00:00] INFO: Processing deploy[/srv/www/instance] action deploy (opsworks_delayed_job::deploy line 65)
[2014-08-13T17:27:09+00:00] INFO: deploy[/srv/www/instance] cloning repo git@github.com:xx/xx.git to /srv/www/instance/shared/cached-copy
[2014-08-13T17:27:17+00:00] INFO: deploy[/srv/www/instance] checked out branch: master onto: deploy reference: 714153bbb6a37f0484526cf4da3eda4fcd8df977
[2014-08-13T17:27:17+00:00] INFO: deploy[/srv/www/instance] synchronizing git submodules
[2014-08-13T17:27:17+00:00] INFO: deploy[/srv/www/instance] enabling git submodules
[2014-08-13T17:27:18+00:00] INFO: deploy[/srv/www/instance] set user to deploy
[2014-08-13T17:27:18+00:00] INFO: deploy[/srv/www/instance] set group to www-data
[2014-08-13T17:27:22+00:00] INFO: deploy[/srv/www/instance] copied the cached checkout to /srv/www/instance/releases/20140813172708
[2014-08-13T17:27:23+00:00] INFO: deploy[/srv/www/instance] set user to deploy
[2014-08-13T17:27:23+00:00] INFO: deploy[/srv/www/instance] set group to www-data
[2014-08-13T17:27:23+00:00] INFO: deploy[/srv/www/instance] running callback before_migrate
[2014-08-13T17:27:23+00:00] INFO: deploy[/srv/www/instance] created directories before symlinking: tmp,public,config
[2014-08-13T17:27:23+00:00] INFO: deploy[/srv/www/instance] linked shared paths into current release: system => public/system, pids => tmp/pids, log => log
[2014-08-13T17:27:23+00:00] INFO: deploy[/srv/www/instance] made pre-migration symlinks
[2014-08-13T17:27:24+00:00] INFO: deploy[/srv/www/instance] set user to deploy
[2014-08-13T17:27:24+00:00] INFO: deploy[/srv/www/instance] set group to www-data
[2014-08-13T17:27:24+00:00] INFO: Gemfile detected. Running bundle install.
[2014-08-13T17:27:24+00:00] INFO: sudo su - deploy -c 'cd /srv/www/instance/releases/20140813172708 && /usr/local/bin/bundle install --path /home/deploy/.bundler/instance --without=test development'
这是错误:
================================================================================
Error executing action `deploy` on resource 'deploy[/srv/www/instance]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
食谱追踪:
Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_commons/libraries/shellout.rb:8:in `shellout'
/var/lib/aws/opsworks/cache.stage2/cookbooks/rails/libraries/rails_configuration.rb:41:in `bundle'
/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:103:in `block (3 levels) in from_file'
资源声明是:
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb
65: deploy deploy[:deploy_to] do
66: provider Chef::Provider::Deploy.const_get(deploy[:chef_provider])
67: keep_releases deploy[:keep_releases]
68: repository deploy[:scm][:repository]
69: user deploy[:user]
70: group deploy[:group]
71: revision deploy[:scm][:revision]
72: migrate deploy[:migrate]
73: migration_command deploy[:migrate_command]
74: environment deploy[:environment].to_hash
75: create_dirs_before_symlink( deploy[:create_dirs_before_symlink] )
76: symlink_before_migrate( deploy[:symlink_before_migrate] )
77: action deploy[:action]
78:
79: if deploy[:application_type] == 'rails'
80: restart_command "sleep #{deploy[:sleep_before_restart]} && #{node[:opsworks][:rails_stack][:restart_command]}"
81: end
82:
答案 0 :(得分:1)
归功于Seth Vargo,问题在于OpsWorks没有安装捆绑器gem。 Chef版本是11.10。我们必须手动将bundler gem添加到默认的Chef安装文件中。
答案 1 :(得分:0)
在Opsworks下启动实例时遇到相同的问题。
调试后,发现问题的原因是:堆栈或层设置中的任何地方都未提及Chef版本。因此,在运行配方时,将选择某个默认版本的Chef,默认情况下未安装捆绑软件。因此,当配方尝试运行“运行捆绑包安装” 时,它退出并出现错误。
简单的解决方案是在堆栈或图层设置下,将厨师版本与其他设置(如果有)一起显式添加:
{
<other settings>
"opsworks_bundler": {
"manage_package": "true",
"version": "1.16.3"
}
}