我一直在尝试按照史蒂文的指南与Dokku部署rails应用程序。
根据推送日志成功部署了应用。我创建了一个postgres数据库,将其链接到应用程序并运行迁移。所有这些操作都成功执行。
但是,当我尝试访问该应用时,我收到502错误的网关错误。
我的部分日志如下所示:
:11:54 worker.1 | 2015-09-19T06:11:54+0000: [Worker(host:861baaccc2e0 pid:18)] Starting job worker
06:11:54 worker.1 | [Worker(host:861baaccc2e0 pid:18)] Error while reserving job:
06:11:54 worker.1 | Problem:
06:11:54 worker.1 | No configuration could be found for a session named 'default'.
06:11:54 worker.1 | Summary:
06:11:54 worker.1 | When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
06:11:54 worker.1 | Resolution:
06:11:54 worker.1 | Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.
06:11:54 worker.1 | 2015-09-19T06:11:54+0000: [Worker(host:861baaccc2e0 pid:18)] Error while reserving job:
06:11:54 worker.1 | Problem:
06:11:54 worker.1 | No configuration could be found for a session named 'default'.
06:11:54 worker.1 | Summary:
06:11:54 worker.1 | When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
06:11:54 worker.1 | Resolution:
06:11:54 worker.1 | Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.
06:11:54 web.1 | [2015-09-19 06:11:54] INFO WEBrick 1.3.1
06:11:54 web.1 | [2015-09-19 06:11:54] INFO ruby 2.0.0 (2015-04-13) [x86_64-linux]
06:11:54 web.1 | [2015-09-19 06:11:54] INFO WEBrick::HTTPServer#start: pid=20 port=5200
06:11:54 console.1 | exited with code 0
06:11:54 system | sending SIGTERM to all processes
06:11:54 rake.1 | rake aborted!
06:11:54 worker.1 | [Worker(host:861baaccc2e0 pid:18)] Exiting...
06:11:54 worker.1 | 2015-09-19T06:11:54+0000: [Worker(host:861baaccc2e0 pid:18)] Exiting...
06:11:54 rake.1 | SignalException: SIGTERM
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies/autoload.rb:70:in `block in eager_load!'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies/autoload.rb:70:in `each_value'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/dependencies/autoload.rb:70:in `eager_load!'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.3/lib/action_view/helpers.rb:34:in `eager_load!'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.3/lib/action_view.rb:87:in `eager_load!'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/application/finisher.rb:56:in `each'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
06:11:54 rake.1 | /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
我的nginx错误日志显示:
2015/09/19 06:44:14 [error] 5421#0: *140 connect() failed (113: No
route to host) while connecting to upstream, client: 197.253.32.226,
server: lycent.bamsonline.org
虽然我没有在我的应用程序中引用MongoDB,但我尝试将gem 'mongoid', '~> 4.0.0'
添加到我的gem文件并重新运行迁移。
我在网上看到的任何参考和教程都没有提及MongoDB或mongoid.yml所以我不知道它的mongo(或缺少它)是否导致了这个问题,或者完全没有其他东西。
我的宝石文件的副本如下所示:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem 'twitter-bootstrap-rails'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'delayed_job_active_record'
gem 'delayed_job_mongoid'
gem "font-awesome-rails"
gem "geocoder"
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
gem 'mongoid', '~> 4.0.0'
gem "activemodel"
gem 'gravtastic'
gem "tzinfo"
group :development, :test do
gem 'sqlite3'
gem 'web-console', '~> 2.0'
gem "pry"
gem "pry-nav"
gem 'rspec-rails'
gem 'capybara'
gem 'guard-rspec'
gem 'spring-commands-rspec'
gem 'spring'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
我真的很感激任何帮助。感谢。