OpsWorks 部署错误 - Chef::Exceptions::ChildConvergeError

Posted

技术标签:

【中文标题】OpsWorks 部署错误 - Chef::Exceptions::ChildConvergeError【英文标题】:OpsWorks deploy error - Chef::Exceptions::ChildConvergeError 【发布时间】:2015-03-18 10:40:57 【问题描述】:

我正在尝试使用 OpsWorks 和 mysql 部署第一个 RailsApp 4,遵循本教程:http://ruby.awsblog.com/post/Tx7FQMT084INCR/Deploying-Ruby-on-Rails-Applications-to-AWS-OpsWorks

我按照他们在教程中提到的所有内容进行操作,但是当我尝试部署应用程序时出现此错误:

    [2015-01-20T13:36:41+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current
    One version per cookbook
    data_bags at /var/lib/aws/opsworks/data/data_bags
    nodes at /var/lib/aws/opsworks/data/nodes

    [2015-01-20T13:36:41+00:00] INFO: Forking chef instance to converge...
    [2015-01-20T13:36:41+00:00] INFO: *** Chef 11.10.4 ***
    [2015-01-20T13:36:41+00:00] INFO: Chef-client pid: 2367
    [2015-01-20T13:36:41+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
    [2015-01-20T13:36:41+00:00] WARN: Run List override has been provided.
    [2015-01-20T13:36:41+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
    [2015-01-20T13:36:41+00:00] WARN: Overridden Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
    [2015-01-20T13:36:41+00:00] INFO: Run List is [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
    [2015-01-20T13:36:41+00:00] INFO: Run List expands to [opsworks_custom_cookbooks::load, opsworks_custom_cookbooks::execute]
    [2015-01-20T13:36:41+00:00] INFO: Starting Chef Run for rails-app.localdomain
    [2015-01-20T13:36:41+00:00] INFO: Running start handlers
    [2015-01-20T13:36:41+00:00] INFO: Start handlers complete.
    [2015-01-20T13:36:41+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rails-app.localdomain/runs
    [2015-01-20T13:36:46+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_berkshelf, opsworks_bundler, opsworks_commons, opsworks_custom_cookbooks, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, unicorn]
    [2015-01-20T13:36:47+00:00] INFO: Not needed with Chef 11.x (x >= 8) anymore.
    [2015-01-20T13:36:47+00:00] INFO: Processing directory[/opt/aws/opsworks/current/site-cookbooks] action delete (opsworks_custom_cookbooks::load line 4)
    [2015-01-20T13:36:47+00:00] INFO: Processing ruby_block[merge all cookbooks sources] action run (opsworks_custom_cookbooks::load line 12)
    [2015-01-20T13:36:47+00:00] INFO: ruby_block[merge all cookbooks sources] called
    [2015-01-20T13:36:47+00:00] WARN: Skipping final node save because override_runlist was given
    [2015-01-20T13:36:47+00:00] INFO: Chef Run complete in 5.208526833 seconds
    [2015-01-20T13:36:47+00:00] INFO: Running report handlers
    [2015-01-20T13:36:47+00:00] INFO: Report handlers complete

    ---

    [2015-01-20T13:36:47+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current
    One version per cookbook
    data_bags at /var/lib/aws/opsworks/data/data_bags
    nodes at /var/lib/aws/opsworks/data/nodes

    [2015-01-20T13:36:47+00:00] INFO: Forking chef instance to converge...
    [2015-01-20T13:36:47+00:00] INFO: *** Chef 11.10.4 ***
    [2015-01-20T13:36:47+00:00] INFO: Chef-client pid: 2507
    [2015-01-20T13:36:48+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
    [2015-01-20T13:36:48+00:00] WARN: Run List override has been provided.
    [2015-01-20T13:36:48+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
    [2015-01-20T13:36:48+00:00] WARN: Overridden Run List: [recipe[deploy::default], recipe[opsworks_stack_state_sync], recipe[deploy::rails], recipe[test_suite], recipe[opsworks_cleanup]]
    [2015-01-20T13:36:48+00:00] INFO: Run List is [recipe[deploy::default], recipe[opsworks_stack_state_sync], recipe[deploy::rails], recipe[test_suite], recipe[opsworks_cleanup]]
    [2015-01-20T13:36:48+00:00] INFO: Run List expands to [deploy::default, opsworks_stack_state_sync, deploy::rails, test_suite, opsworks_cleanup]
    [2015-01-20T13:36:48+00:00] INFO: Starting Chef Run for rails-app.localdomain
    [2015-01-20T13:36:48+00:00] INFO: Running start handlers
    [2015-01-20T13:36:48+00:00] INFO: Start handlers complete.
    [2015-01-20T13:36:48+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rails-app.localdomain/runs
    [2015-01-20T13:36:53+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_bundler, opsworks_cleanup, opsworks_commons, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, opsworks_stack_state_sync, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, test_suite, unicorn]
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/templates/default/TARGET_VERSION.erb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/recipes/default.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/attributes/default.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/attributes/customize.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/metadata.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/monitor-mysql.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/configure-client.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/monitor-haproxy.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/views.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/monitor-fd-and-sockets.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/server.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/bind-mount-data.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/deploy.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/configure-server.rb from the cache; its cookbook is no longer needed on this client.
    [2015-01-20T13:36:53+00:00] INFO: Removing 

..... removed some code for *** body limitation 

file[/home/deploy/.ssh/config] action touch (deploy::rails line 16)
    [2015-01-20T13:36:54+00:00] INFO: file[/home/deploy/.ssh/config] updated atime and mtime to 2015-01-20 13:36:54 +0000
    [2015-01-20T13:36:54+00:00] INFO: Processing execute[echo 'StrictHostKeyChecking no' > /home/deploy/.ssh/config] action run (deploy::rails line 23)
    [2015-01-20T13:36:54+00:00] INFO: Processing template[/home/deploy/.ssh/id_dsa] action create (deploy::rails line 27)
    [2015-01-20T13:36:54+00:00] INFO: Processing directory[/srv/www/ariadna/shared/cached-copy] action delete (deploy::rails line 48)
    [2015-01-20T13:36:54+00:00] INFO: directory[/srv/www/ariadna/shared/cached-copy] deleted /srv/www/ariadna/shared/cached-copy recursively
    [2015-01-20T13:36:54+00:00] INFO: Processing ruby_block[change HOME to /home/deploy for source checkout] action run (deploy::rails line 56)
    [2015-01-20T13:36:54+00:00] INFO: ruby_block[change HOME to /home/deploy for source checkout] called
    [2015-01-20T13:36:54+00:00] INFO: Processing deploy[/srv/www/ariadna] action deploy (deploy::rails line 65)
    [2015-01-20T13:36:56+00:00] INFO: deploy[/srv/www/ariadna] cloning repo git@bitbucket.org:viktorpr7/ariadna.git to /srv/www/ariadna/shared/cached-copy
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] checked out branch: master onto: deploy reference: 438d556fa34ec3590ba1fecca64fd31241379516
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] synchronizing git submodules
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] enabling git submodules
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] copied the cached checkout to /srv/www/ariadna/releases/20150120133654
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] running callback before_migrate
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] created directories before symlinking: tmp,public,config
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] linked shared paths into current release: system => public/system, pids => tmp/pids, log => log
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] made pre-migration symlinks
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
    [2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
    [2015-01-20T13:36:59+00:00] INFO: Gemfile detected. Running bundle install.
    [2015-01-20T13:36:59+00:00] INFO: sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150120133654 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development'
    [2015-01-20T13:37:00+00:00] INFO: 
    Using rake (10.4.2)
    Using i18n (0.7.0)
    Using minitest (4.7.5)
    Using multi_json (1.10.1)
    Using thread_safe (0.3.4)
    Using tzinfo (0.3.42)
    Using activesupport (4.0.1)
    Using builder (3.1.4)
    Using erubis (2.7.0)
    Using rack (1.5.2)
    Using rack-test (0.6.3)
    Using actionpack (4.0.1)
    Using mime-types (1.25.1)
    Using polyglot (0.3.5)
    Using treetop (1.4.15)
    Using mail (2.5.4)
    Using actionmailer (4.0.1)
    Using activemodel (4.0.1)
    Using activerecord-deprecated_finders (1.0.3)
    Using arel (4.0.2)
    Using activerecord (4.0.1)
    Using acts_as_tree (2.1.0)
    Using addressable (2.3.6)
    Using bcrypt (3.1.7)
    Using bcrypt-ruby (3.1.5)
    Using coffee-script-source (1.8.0)
    Using execjs (2.2.2)
    Using coffee-script (2.3.0)
    Using thor (0.19.1)
    Using railties (4.0.1)
    Using coffee-rails (4.0.1)
    Using orm_adapter (0.5.0)
    Using warden (1.2.3)
    Using devise (3.2.3)
    Using dragonfly (1.0.7)
    Using json (1.8.2)
    Using rdoc (4.2.0)
    Using rest-client (1.6.8)
    Using geo_ip (0.5.0)
    Using tilt (1.4.1)
    Using haml (4.0.5)
    Using haml-rails (0.5.3)
    Using hike (1.2.3)
    Using jbuilder (1.5.3)
    Using jquery-rails (3.1.2)
    Using kgio (2.9.2)
    Using mysql2 (0.3.14)
    Using nprogress-rails (0.1.6.5)
    Using paranoia (2.0.4)
    Using bundler (1.5.3)
    Using sprockets (2.12.3)
    Using sprockets-rails (2.0.1)
    Using rails (4.0.1)
    Using raindrops (0.13.0)
    Using sass (3.2.19)
    Using sass-rails (4.0.5)
    Using sdoc (0.4.1)
    Using simple_form (3.1.0)
    Using stringex (2.5.2)
    Using themes_on_rails (0.3.0)
    Using turbolinks (2.5.3)
    Using uglifier (2.7.0)
    Using unicorn (4.8.3)
    Your bundle is complete!
    Gems in the groups test and development were not installed.
    It was installed into /home/deploy/.bundler/ariadna

    [2015-01-20T13:37:00+00:00] INFO: Processing template[/srv/www/ariadna/shared/config/database.yml] action create (/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb line 115)
    [2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] queueing checkdeploy hook /srv/www/ariadna/releases/20150120133654/deploy/before_migrate.rb
    [2015-01-20T13:37:00+00:00] INFO: Processing template[/srv/www/ariadna/shared/config/database.yml] action create (/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb line 115)
    [2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] made pre-migration symlinks
    [2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
    [2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
    [2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] migrating deploy

    ================================================================================
    Error executing action `deploy` on resource 'deploy[/srv/www/ariadna]'
    ================================================================================


    Chef::Exceptions::Exec
    ----------------------
    if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0


    Cookbook Trace:
    ---------------
    /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_commons/libraries/monkey_patch_deploy_provider.rb:45:in `block in migrate'
    /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_commons/libraries/monkey_patch_deploy_provider.rb:39:in `migrate'


    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:       purge_before_symlink(deploy[:purge_before_symlink]) unless deploy[:purge_before_symlink].nil?
    76:       create_dirs_before_symlink(deploy[:create_dirs_before_symlink])
    77:       symlink_before_migrate(deploy[:symlink_before_migrate])
    78:       symlinks(deploy[:symlinks]) unless deploy[:symlinks].nil?
    79:       action deploy[:action]
    80: 
    81:       if deploy[:application_type] == 'rails' && node[:opsworks][:instance][:layers].include?('rails-app')
    82:         restart_command "sleep #deploy[:sleep_before_restart] && #node[:opsworks][:rails_stack][:restart_command]"
    83:       end
    84: 



    Compiled Resource:
    ------------------
    # Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:65:in `block in from_file'

    deploy("/srv/www/ariadna") do
    params :deploy_data=>"deploy_to"=>"/srv/www/ariadna", "chef_provider"=>"Timestamped", "keep_releases"=>5, "current_path"=>"/srv/www/ariadna/current", "document_root"=>"public", "ignore_bundler_groups"=>["test", "development"], "absolute_document_root"=>"/srv/www/ariadna/current/public/", "rake"=>"/usr/local/bin/rake", "migrate"=>true, "migrate_command"=>"if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi", "rails_env"=>"production", "action"=>"deploy", "user"=>"deploy", "group"=>"www-data", "shell"=>"/bin/bash", "home"=>"/home/deploy", "sleep_before_restart"=>0, "stack"=>"needs_reload"=>true, "enable_submodules"=>true, "shallow_clone"=>false, "delete_cached_copy"=>true, "purge_before_symlink"=>["log", "tmp/pids", "public/system"], "create_dirs_before_symlink"=>["tmp", "public", "config"], "symlink_before_migrate"=>"config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml", "symlinks"=>"system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log", "environment"=>"RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy", "environment_variables"=>, "ssl_support"=>false, "auto_npm_install_on_deploy"=>true, "nodejs"=>"restart_command"=>"monit restart node_web_app_ariadna", "stop_command"=>"monit stop node_web_app_ariadna", "port"=>80, "application"=>"ariadna", "application_type"=>"rails", "auto_bundle_on_deploy"=>true, "deploying_user"=>"arn:aws:iam::673556511701:root", "domains"=>["ariadna"], "mounted_at"=>nil, "restart_command"=>nil, "ssl_certificate"=>nil, "ssl_certificate_key"=>nil, "ssl_certificate_ca"=>nil, "scm"=>"scm_type"=>"git", "repository"=>"git@bitbucket.org:viktorpr7/ariadna.git", "revision"=>"master", "ssh_key"=>"...................", "user"=>nil, "password"=>nil, "database"=>"host"=>"172.31.23.102", "database"=>"ariadna_production", "port"=>3306, "username"=>"root", "password"=>"13m3i60f6r", "reconnect"=>true, "data_source_provider"=>"stack", "type"=>"mysql", "adapter"=>"mysql2", "memcached"=>"host"=>nil, "port"=>11211, :app=>"ariadna", :name=>nil
    provider Chef::Provider::Deploy::Timestamped
    action [:deploy]
    updated true
    updated_by_last_action true
    retries 0
    retry_delay 2
    deploy_to "/srv/www/ariadna"
    environment "RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy", "LC_ALL"=>"C"
    repository_cache "cached-copy"
    purge_before_symlink ["log", "tmp/pids", "public/system"]
    create_dirs_before_symlink ["tmp", "public", "config"]
    symlink_before_migrate "config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml"
    symlinks "system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log"
    revision "master"
    migrate true
    remote "origin"
    enable_submodules true
    scm_provider Chef::Provider::Git
    keep_releases 5
    enable_checkout true
    checkout_branch "deploy"
    cookbook_name "deploy"
    recipe_name "rails"
    repo "git@bitbucket.org:viktorpr7/ariadna.git"
    user "deploy"
    group "www-data"
    migration_command "if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi"
    restart_command "sleep 0 && ../../shared/scripts/unicorn clean-restart"
    before_migrate #<Proc:0x007ff79d1c63c0@/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:100>
    shared_path "/srv/www/ariadna/shared"
    destination "/srv/www/ariadna/shared/cached-copy"
    current_path "/srv/www/ariadna/current"
    end



    [2015-01-20T13:37:01+00:00] INFO: Running queued delayed notifications before re-raising exception
    [2015-01-20T13:37:01+00:00] ERROR: Running exception handlers
    [2015-01-20T13:37:01+00:00] ERROR: Exception handlers complete
    [2015-01-20T13:37:01+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
    [2015-01-20T13:37:01+00:00] ERROR: deploy[/srv/www/ariadna] (deploy::rails line 65) had an error: Chef::Exceptions::Exec: if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0
    [2015-01-20T13:37:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

有人知道这个错误的根源吗?

【问题讨论】:

粘贴上面的编译资源,你没有在那里显示错误,只是错误后给出的一部分信息以帮助缩小范围,但没有错误,我们无法分辨是什么错了。 我高度怀疑你的 migration_command 是罪魁祸首,厨师执行资源并不总是使用 shell,你的 if [ -f Gemfile ] 是一个 shell 内部,所以并不总是可用。 我已经添加了完整的完整文件日志 docs.aws.amazon.com/opsworks/latest/userguide/… 声称亚马逊也存储调试日志。请找到并粘贴它们。这应该包括实际的命令输出。 +1 也发生在我身上。我有多个堆栈,这仅发生在一个堆栈上。我不知道它为什么会这样。 【参考方案1】:
Chef::Exceptions::Exec
    ----------------------
    if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0

错误是由于迁移命令引起的,所以里面出了点问题。

【讨论】:

Ruby 已经在 exec 上添加了 sh -c,除非您使用数组形式。 @coderanger 对,刚刚注意到日志。但是这里没有 stout /stderr 输出,是由于 opswork 猴子路径还是输出是在 11.10 之后出现的? (在这种情况下无法理解为什么 bundle exec 会失败) 我尝试添加migration_command %Q 和更多内容,但错误仍然存​​在 @darkcode 尝试使用登录调试级别运行(厨师命令行上的-l 调试) 说实话我不知道如何使用 OpsWorks 在调试级别运行日志【参考方案2】:

我有这个确切的问题。

本着treating servers as cattle instead of pets 的精神,前进的最佳方式是杀死现有服务器,并从您的层中创建一个新实例。它将消除您的厨师食谱之外的任何因素(外面的任何事情都不应该是您真正关心的 - 它应该是亚马逊的!)

大多数时候对我有用。如果这不起作用,那么您 100% 确定它在您的食谱中。

【讨论】:

【参考方案3】:

遇到了由包含某些字符 ('\\') 的环境变量引起的类似问题。在部署期间通过 run_command 传递给 bundle exec 时,这些似乎没有正确转义。

迁移命令失败,出现以下错误:

/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Psych::SyntaxError: (<unknown>): found unknown escape character while parsing a quoted scalar at line 230 column 22
/home/deploy/.bundler/optisure_staging/ruby/2.3.0/gems/config-1.0.0/lib/config/sources/yaml_source.rb:16:in `load'
/home/deploy/.bundler/optisure_staging/ruby/2.3.0/gems/config-1.0.0/lib/config/options.rb:50:in `block in reload!'
/home/deploy/.bundler/optisure_staging/ruby/2.3.0/gems/config-1.0.0/lib/config/options.rb:49:in `each'

识别此问题的痛苦在于让 opsworks/chef 记录此信息。最终编辑了机器上说明书缓存中的 monkey_patch_deploy_provider.rb 以设置日志级别。

【讨论】:

以上是关于OpsWorks 部署错误 - Chef::Exceptions::ChildConvergeError的主要内容,如果未能解决你的问题,请参考以下文章

尽管在 Opsworks 中成功部署了 php 应用程序,但仍出现“未找到”错误。其他 php 应用程序运行良好

如何增加 AWS Opsworks 的部署超时限制?

在 AWS opsworks 部署应用程序。为啥随机部署失败?

使用 unicorn 将 Rails 应用程序部署到 Opsworks 时出错

AWS OpsWorks:成功的 Ruby on Rails 默认层部署在浏览器中显示 404 错误

Opsworks 安装作曲家错误