Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails cap部署:未配置冷生产数据库-Postgresql_Ruby On Rails_Ruby_Ruby On Rails 3_Postgresql_Deployment - Fatal编程技术网

Ruby on rails cap部署:未配置冷生产数据库-Postgresql

Ruby on rails cap部署:未配置冷生产数据库-Postgresql,ruby-on-rails,ruby,ruby-on-rails-3,postgresql,deployment,Ruby On Rails,Ruby,Ruby On Rails 3,Postgresql,Deployment,我正在尝试运行cap deploy:cold来安装带有postgresql的rails应用程序,但我无法理解“未配置生产数据库”或其他任何内容的含义 * 2013-01-03 08:23:26 executing `deploy:assets:precompile' * executing "cd /home/deployer/apps/opedio/releases/20130103132324 && bundle exec rake RAILS_ENV=production

我正在尝试运行cap deploy:cold来安装带有postgresql的rails应用程序,但我无法理解“未配置生产数据库”或其他任何内容的含义

* 2013-01-03 08:23:26 executing `deploy:assets:precompile'
* executing "cd /home/deployer/apps/opedio/releases/20130103132324 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
** [out :: 192.155.89.30] rake aborted!
** [out :: 192.155.89.30] production database is not configured
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:25:in `each'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/railtie.rb:74:in `block in <class:Railtie>'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/releases/20130103131459/config/environment.rb:4:in `<top (required)>'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:103:in `require_environment!'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
** [out :: 192.155.89.30] /home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
** [out :: 192.155.89.30] Tasks: TOP => environment
** [out :: 192.155.89.30] (See full trace by running task with --trace)
command finished in 5983ms
*** [deploy:update_code] rolling back
*2013-01-03 08:23:26执行“部署:资产:预编译”
*执行“cd/home/deployer/apps/opedio/releases/20130103132324&&bundle exec rake RAILS\u ENV=production RAILS\u GROUPS=assets资产:预编译”
**[输出:192.155.89.30]rake中止!
**[out::192.155.89.30]未配置生产数据库
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active\u record/connection\u adapters/abstract/connection\u specification.rb:39:in“解析字符串\u连接”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active\u record/connection\u adapters/abstract/connection\u specification.rb:25:in'spec'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active\u record/connection\u adapters/abstract/connection\u specification.rb:130:in“建立连接”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/railtie.rb:82:in“block(2层)in”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:36:in'instance\u eval'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hook.rb:36:in'execute\u hook'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u-support/lazy\u-load\u-hooks.rb:26:in'block-in-on\u-load'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:25:in'each'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/lazy\u load\u hooks.rb:25:in'on\u load'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/railtie.rb:74:in'block-in'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in'instance_exec'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in'run'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:55:in“block-in-run_initializer”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in'each'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in'run_initializer'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:136:in'initialize!'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in'method_missing'
**[out::192.155.89.30]/home/deployer/apps/opedio/releases/20130103131459/config/environment.rb:4:in`'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:251:in'require'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:251:in'block in require'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:236:in'load\u dependenciency'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.9/lib/active\u support/dependencies.rb:251:in'require'
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:103:in“require_环境!”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:297:在“初始化_任务中的块(2个级别)”中
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:93:in“block(2层)in”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:60:in“block(3层)in”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:23:in“调用”或“重新启动”\rake\u任务”
**[out::192.155.89.30]/home/deployer/apps/opedio/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.9/lib/sprockets/assets.rake:29:in“block(2层)in”
**[out::192.155.89.30]任务:TOP=>环境
**[输出::192.155.89.30](通过使用--trace运行任务查看完整跟踪)
命令在5983毫秒内完成
***[部署:更新\u代码]正在回滚
*执行“rm-rf/home/deployer/apps/opedio/releases/20130103131459;真” 服务器:[“192.155.89.30”] [192.155.89.30]执行命令 命令在319ms内完成
失败:192.155.89.30上的“sh-c'cd/home/deployer/apps/opedio/releases/20130103131459&&bundle exec-rake-rake-RAILS\u ENV=production-RAILS\u GROUPS=assets-assets:precompile”

错误消息表示您没有在database.yml中配置生产数据库

查看远程服务器上的
数据库.yml

它应该类似于这样:

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: database_name
  pool: 5
  username: database_user
  password: th3p4ssw0rd
  socket: /path/to/mysql.sock
我建议采取以下措施:

1.)不要在版本控制下存储
数据库.yml
。 使用git时,只需将
/config/database.yml
添加到
.gitignore
文件(或创建该文件)中
# /config/deploy.rb:
after 'deploy:finalize_update', 'db:symlink'

namespace :db do
  desc "Symlinks the database.yml"
  task :symlink, :except => { :no_release => true }, :roles => :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
end