ruby-on-rails – 让Puma Postgres服务器在开发中工作以与Heroku合作,还是回到Sqlite有意义?

我使用puma而不是rails s工作正常一段时间,但随后在开发和更改代码并刷新某些时候刷新不起作用,延迟了很长时间.我以为它已经崩溃了什么,所以我杀死了puma服务器,但随后它说’优雅地关闭’几分钟,所以我杀死了终端窗口.然后,在我尝试使用puma的新窗口中,它表示主机已经被占用,因此该过程仍在运行.无法找到它的位置,我重新启动了我的电脑.重启后,我现在得到错误发生未处理的低级错误.应用程序日志可能包含详细信息或者PG :: ConnectionBad fe_sendauth:没有提供密码,这取决于我是运行puma还是RAILS_ENV =开发美洲狮.

这些响应似乎都没有意义,而且这个错误我看到其他人对rake db:migrate有所了解.所以我尝试迁移数据库并得到相同的错误PG :: ConnectionBad:fe_sendauth:没有提供密码

并且在尝试运行服务器时的日志中:机架应用程序错误:#< RuntimeError:Missingsecret_key_basefor'production'环境,设置此值inconfig / secrets.yml>

现在这对我来说是最不合理的,因为为什么puma默认运行生产环境并需要特殊命令才能在开发中运行?

production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

依赖于Heroku来传递secret_key_base是我的假设,所以它不适用于开发.但是,甚至RAILS_ENV =开发美洲狮投掷

PG::ConnectionBad
fe_sendauth: no password supplied

一条似乎对我没有帮助的痕迹:

activerecord (4.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
activerecord (4.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `new'
activerecord (4.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
activerecord (4.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
activerecord (4.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
activerecord (4.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
/Users/lasernite/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/Users/lasernite/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
activerecord (4.1.7) lib/active_record/connection_handling.rb:113:in `retrieve_connection'
activerecord (4.1.7) lib/active_record/connection_handling.rb:87:in `connection'
activerecord (4.1.7) lib/active_record/migration.rb:388:in `check_pending!'
activerecord (4.1.7) lib/active_record/migration.rb:377:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.7) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.7) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.7) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.7) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.7) lib/action_dispatch/middleware/static.rb:84:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
rack-timeout (0.2.0) lib/rack/timeout.rb:108:in `call'
railties (4.1.7) lib/rails/engine.rb:514:in `call'
railties (4.1.7) lib/rails/application.rb:144:in `call'
puma (2.11.0) lib/puma/configuration.rb:82:in `call'
puma (2.11.0) lib/puma/server.rb:507:in `handle_request'
puma (2.11.0) lib/puma/server.rb:375:in `process_client'
puma (2.11.0) lib/puma/server.rb:262:in `block in run'
puma (2.11.0) lib/puma/thread_pool.rb:104:in `call'
puma (2.11.0) lib/puma/thread_pool.rb:104:in `block in spawn_thread'

我坚持在哪里尝试解决这个错误.

请提供任何见解.谢谢!

最佳答案
您的“config / secrets.yml”文件是否列在.gitignore中? Heroku需要该文件.从.gitignore中删除或注释掉它.我有同样的问题,这是我的问题.

另外,请看这篇文章的相同答案:
How to solve error “Missing `secret_key_base` for ‘production’ environment” (Rails 4.1)

祝好运!

转载注明原文:ruby-on-rails – 让Puma Postgres服务器在开发中工作以与Heroku合作,还是回到Sqlite有意义? - 代码日志