我是rails的新手以及使用capistrano部署到生产(AWS)。
超过一天发现这个错误并尝试了所有的建议,没有什么对我有用。
配置我的deploy.rb, capfile, production.rb and staging.rb
后,我运行了三个命令
1. cap deploy:setup
- 成功
2.'上限部署:检查' - 成功
3.'cap deploy:cold' - 问题(下面提到的日志)
没有角色“ubuntu”存在,这究竟意味着什么?我应该在任何文件中创建新角色或更改名称?
** transaction: commit
* 2014-07-11 17:18:07 executing `deploy:migrate'
* executing "cd /home/ubuntu/apps/releases/20140711221716 && bundle exec rake RAILS_ENV=production db:migrate"
servers: ["ec2-54-88-174-150.compute-1.amazonaws.com"]
[ec2-54-88-174-150.compute-1.amazonaws.com] executing command
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] rake aborted!
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] FATAL: role "ubuntu" does not exist
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `new'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `connect'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:326:in `initialize'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/g
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] ems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:308:in `clear_cache!'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in `_run__2201146833457417766__prepare__1495654531503866598__callbacks'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/app
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] s/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/releases/20140711221716/config/environment.rb:5:in `<top (required)>'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] /home/ubuntu/apps/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] Tasks: TOP => db:migrate => environment
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com] (See full trace by running task with --trace)
** [out :: ec2-54-88-174-150.compute-1.amazonaws.com]
command finished in 6635ms
failed: "sh -c 'cd /home/ubuntu/apps/releases/20140711221716 && bundle exec rake RAILS_ENV=production db:migrate'" on ec2-54-88-174-150.compute-1.amazonaws.com