我有一个rails应用程序,我尝试在aws EC2服务器上进行部署,但是当我开始部署它失败时,在日志中我知道它在捆绑完成后失败
这些是日志
Bundle complete! 34 Gemfile dependencies, 91 gems now installed.
Gems in the groups test and development were not installed.
Bundled gems are installed into /home/deploy/.bundler/jobzgo.
[2015-12-13T07:54:25+00:00] INFO: No database adapter specified for jobzgo, guessing
[2015-12-13T07:54:26+00:00] INFO: Looks like jobzgo uses mysql2 in its Gemfile
[2015-12-13T07:54:26+00:00] INFO: Processing template[/srv/www/jobzgo/shared/config/database.yml] action create (/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb line 115)
[2015-12-13T07:54:26+00:00] INFO: template[/srv/www/jobzgo/shared/config/database.yml] backed up to /root/.chef/local-mode-cache/backup/srv/www/jobzgo/shared/config/database.yml.chef-20151213075426.070328
[2015-12-13T07:54:26+00:00] INFO: template[/srv/www/jobzgo/shared/config/database.yml] updated file contents /srv/www/jobzgo/shared/config/database.yml
[2015-12-13T07:54:26+00:00] INFO: deploy[/srv/www/jobzgo] queueing checkdeploy hook /srv/www/jobzgo/releases/20151213075412/deploy/before_migrate.rb
[2015-12-13T07:54:26+00:00] INFO: Processing template[/srv/www/jobzgo/shared/config/database.yml] action create (/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb line 115)
[2015-12-13T07:54:26+00:00] INFO: deploy[/srv/www/jobzgo] made pre-migration symlinks
[2015-12-13T07:54:26+00:00] INFO: deploy[/srv/www/jobzgo] set user to deploy
[2015-12-13T07:54:26+00:00] INFO: deploy[/srv/www/jobzgo] set group to www-data
[2015-12-13T07:54:26+00:00] INFO: deploy[/srv/www/jobzgo] migrating deploy
================================================================================
Error executing action `deploy` on resource 'deploy[/srv/www/jobzgo]'
================================================================================
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/jobzgo") do
params {:deploy_data=>{"deploy_to"=>"/srv/www/jobzgo", "chef_provider"=>"Timestamped", "keep_releases"=>5, "current_path"=>"/srv/www/jobzgo/current", "document_root"=>"public", "ignore_bundler_groups"=>["test", "development"], "absolute_document_root"=>"/srv/www/jobzgo/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", "SECRET_KEY_BASE"=>"thisisthesecretkeybase"}, "environment_variables"=>{"SECRET_KEY_BASE"=>"thisisthesecretkeybase"}, "ssl_support"=>false, "auto_npm_install_on_deploy"=>true, "nodejs"=>{"restart_command"=>"monit restart node_web_app_jobzgo", "stop_command"=>"monit stop node_web_app_jobzgo", "port"=>80}, "application"=>"jobzgo", "application_type"=>"rails", "auto_bundle_on_deploy"=>true, "deploying_user"=>"arn:aws:iam::237093782558:root", "domains"=>["jobzgo"], "mounted_at"=>nil, "restart_command"=>nil, "ssl_certificate"=>nil, "ssl_certificate_key"=>nil, "ssl_certificate_ca"=>nil, "scm"=>{"scm_type"=>"git", "repository"=>"https://nishant4114@bitbucket.org/nishant4114/job_events.git", "revision"=>nil, "ssh_key"=>nil, "user"=>nil, "password"=>nil}, "database"=>{"host"=>"172.31.32.213", "database"=>"job_events_production", "port"=>3306, "username"=>"root", "password"=>"5edw50o1or", "reconnect"=>true, "data_source_provider"=>"stack", "type"=>"mysql"}, "memcached"=>{"host"=>nil, "port"=>11211}}, :app=>"jobzgo", :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/jobzgo"
environment {"RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy", "SECRET_KEY_BASE"=>"thisisthesecretkeybase", "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 "HEAD"
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 "https://nishant4114@bitbucket.org/nishant4114/job_events.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:0x007f58465ea8d0@/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:100>
shared_path "/srv/www/jobzgo/shared"
destination "/srv/www/jobzgo/shared/cached-copy"
current_path "/srv/www/jobzgo/current"
end
[2015-12-13T07:54:27+00:00] INFO: Running queued delayed notifications before re-raising exception
[2015-12-13T07:54:27+00:00] ERROR: Running exception handlers
[2015-12-13T07:54:27+00:00] ERROR: Exception handlers complete
[2015-12-13T07:54:27+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2015-12-13T07:54:27+00:00] ERROR: deploy[/srv/www/jobzgo] (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-12-13T07:54:27+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
我也给了mysql适配器的自定义json
{
"deploy":
{
"todoapp":
{
"database":
{
"adapter": "mysql2"
}
}
}
}
请帮助我,因为我被困了一天