先说下应用的开发环境:ruby1.9.3,rails3.2.9,mongodb2.2 在 window 环境下开发的,并且在本地电脑下运行时没有问题,部署到 VM 的 cloudfoundry 中就出现找不到页面,查看日志时发现如下问题:
No Redis service bound to app. Skipping auto-reconfiguration.
Loading MongoDB auto-reconfiguration.
No MongoDB Library Found. Skipping auto-reconfiguration.
No MySQL service bound to app. Skipping auto-reconfiguration.
No PostgreSQL service bound to app. Skipping auto-reconfiguration.
No RabbitMQ service bound to app. Skipping auto-reconfiguration.
=> Booting WEBrick
=> Rails 3.2.9 application starting in production on http://0.0.0.0:8345
=> Call with -d to detach
=> Ctrl-C to shutdown server
Started GET "/" for 183.233.189.114 at 2013-04-18 02:21:42 +0000
Connecting to database specified by database.yml
Processing by ArticlesController#index as HTML
Rendered articles/index.html.erb within layouts/application (90.5ms)
Completed 500 Internal Server Error in 144ms
ActionView::Template::Error (
Problem:
No sessions configuration provided.
Summary:
Mongoid's configuration requires that you provide details about each session t
hat can be connected to, and requires in the sessions config at least 1 default
session to exist.
Resolution:
Double check your mongoid.yml to make sure that you have a top-level sessions
key with at least 1 default session configuration for it. You can regenerate a n
ew mongoid.yml for assistance via `rails g mongoid:config`.
Example:
\_\_development:
\_\_\_\_sessions:
\_\_\_\_\_\_default:
\_\_\_\_\_\_\_\_database: mongoid_dev
\_\_\_\_\_\_\_\_hosts:
\_\_\_\_\_\_\_\_\_\_- localhost:27017
但是所说的 mongoid.yml 配置,我是已经配置好的,配置如下:
development:
# Configure available database sessions. (required)
sessions:
# Defines the default session. (required)
default:
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: spec_mongoid_development
# Provides the hosts the default session can connect to. Must be an array
# of host:port pairs. (required)
hosts:
- localhost:27017
求在 VM 的 cloudfoundry 部署成功过的朋友给建议。。。。谢谢啦