由于数据库连接错误,无法部署应用程序

时间:2014-04-17 14:20:47

标签: ruby-on-rails-4 cloudcontrol ruby-2.1

有谁知道为什么我无法部署我的应用程序?我使用了与我的其他应用程序完全相同的配置/更改,我可以将其部署到cc而没有任何问题(当然是不同的凭据)。

database.yml

production:
  adapter: postgresql
  encoding: unicode
  reconnect: false
  pool: 3
  database: xxx
  host: horton.elephantsql.com
  port: 5432
  username: xxx
  password: xxx

这是我收到的错误消息:

-----> Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   rake aborted!
   could not connect to server: Connection refused
   Is the server running on host "127.0.0.1" and accepting
   TCP/IP connections on port 5432?
   /srv/tmp/builddir/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `initialize'
   /srv/tmp/builddir/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `new'
   /srv/tmp/builddir/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `connect'

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

由于在推送期间,附加凭据尚不可用(它们仅在运行时可用),因此必须设置以下选项以告知Rails在资产预编译期间不尝试初始化数据库。 / p>

config.assets.initialize_on_precompile = false if ENV['BUILDPACK_RUNNING']

您可以在此处找到此Rails相关设置和其他相关设置:https://www.cloudcontrol.com/dev-center/Guides/Ruby/RubyNotes

相关问题