【发布时间】:2018-10-23 17:17:15
【问题描述】:
Rails 服务器没有在生产环境中启动,我认为与数据库存在冲突,我应该迁移它们还是其他?
=> Booting Puma
=> Rails 5.0.6 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Exiting
/home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/connection_specification.rb:170:in
`spec': database configuration does not specify adapter
(ActiveRecord::AdapterNotSpecified)
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_handling.rb:53:in `establish_connection'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:125:in `block (2 levels) in <class:Railtie>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:41:in `block in on_load'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:40:in `each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:40:in `on_load'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:121:in `block in <class:Railtie>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `run'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/application.rb:352:in `initialize!'
from /home/user/Desktop/upgraded-carnival/config/environment.rb:5:in `<top (required)>'
from /home/user/Desktop/upgraded-carnival/config.ru:3:in `require_relative'
from /home/user/Desktop/upgraded-carnival/config.ru:3:in `block in <main>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
from /home/user/Desktop/upgraded-carnival/config.ru:in `new'
from /home/user/Desktop/upgraded-carnival/config.ru:in `<main>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:84:in `app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:104:in `start'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
我的数据库.yml:
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
production:
host: localhost
database: magnetcoin_production
pool: 10
timeout: 10000
username: magnetcoin
password:
magnetcoin template: template0
development: <<: *default
database: magnetcoin_development
test: <<: *default
database: magnetcoin_test
【问题讨论】:
-
在开发环境中一切正常
-
请分享您的
database.yml文件。 -
默认值:&default 适配器:postgresql 编码:unicode 池: 生产:主机:localhost 数据库:magnetcoin_production 池:10 超时:10000 用户名:magnetcoin 密码:magnetcoin 模板:template0 开发:
-
使用正确的格式将 database.yml 文件添加到您的原始问题中,否则无法帮助您。
-
更新>>>>>>>>
标签: ruby-on-rails ruby activerecord ruby-on-rails-5