首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >cap部署:未配置冷生产数据库- Postgresql

cap部署:未配置冷生产数据库- Postgresql
EN

Stack Overflow用户
提问于 2013-01-03 21:28:36
回答 1查看 509关注 0票数 1

我试着用postgresql来安装一个rails应用,但是我不明白什么是‘生产数据库没有配置’或者其他任何东西。

代码语言:javascript
运行
复制
* 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

*正在执行"rm exec rake /home/deployer/apps/opedio/releases/20130103131459;true“服务器:" 192.155.89.30”执行命令命令在319ms内完成失败:"sh exec 'cd /home/deployer/apps/opedio/releases/20130103131459 && -rf -c RAILS_ENV=production RAILS_GROUPS=assets assets:-rf‘on 192.155.89.30“

EN

回答 1

Stack Overflow用户

发布于 2013-01-03 21:39:07

该错误消息意味着您没有在database.yml中配置生产数据库。

查看远程服务器上的database.yml

它看起来应该类似于:

代码语言:javascript
运行
复制
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时,只需在.gitignore文件中添加/config/database.yml (或创建该文件)并提交即可。

2.)在shared/config/中的远程服务器上创建database.yml (通过脚本或手动)。

3.)在部署时,将应用程序中的database.yml符号链接到shared/config

代码语言:javascript
运行
复制
# /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/

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14139874

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档