1

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

* "rm -rf /home/deployer/apps/opedio/releases/20130103131459; true" サーバーの実行: ["192.155.89.30"] [192.155.89.30] コマンドの実行 command は 319ms で終了しました 失敗しました: "sh -c 'cd / home/deployer/apps/opedio/releases/20130103131459 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on 192.155.89.30

4

1 に答える 1

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

次のことをお勧めします。

database.yml1.)バージョン管理下で保存しないでください。git を使用する場合は、ファイルに追加/config/database.yml(.gitignoreまたはそのファイルを作成) してコミットします。

2.)database.ymlリモート サーバー上にshared/config/(スクリプトまたは手動で) を作成します。

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/

于 2013-01-03T13:39:07.473 に答える