2013-01-03 36 views
1

我想運行帽部署:冷安裝與postgresql的rails應用程序,我找不出'生產數據庫沒有配置'或其他任何意思。帽部署:冷生產數據庫沒有配置 - Postgresql

* 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 
執行 「室射頻/家/部署/應用/ opedio /釋放/ 20130103131459;真」

* 服務器:[ 「192.155.89.30」] [192.155.89.30]執行命令 命令成品319ms 失敗: 「SH -c '坎德拉/家/部署/應用/ opedio /發行/ 20130103131459 & &束EXEC耙RAILS_ENV =生產RAILS_GROUPS =資產資產:預編譯'」 上192.155.89.30

回答

2

錯誤信息手段你沒有在你的database.yml中配置你的生產數據庫。

在遠程服務器上查看您的database.yml

應該類似於此:

production: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: database_name 
    pool: 5 
    username: database_user 
    password: th3p4ssw0rd 
    socket: /path/to/mysql.sock 

我建議做到以下幾點:

1)請勿將database.yml下的版本控制。 使用git時,只需將/config/database.yml添加到.gitignore文件(或創建該文件)並提交它。

2.)在shared/config/(通過腳本或手動)在遠程服務器上創建database.yml

3.)在部署時將database.yml從應用符號鏈接到shared/config

# /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 

你可以閱讀有關的database.yml式管理更全面的文章: http://www.simonecarletti.com/blog/2009/06/capistrano-and-database-yml/

+0

它是否解決問題了嗎?願意看到我的回答接受:) – Robin