Ruby Rails Mongrel Sever 无法服务 OXS1.6

发布于 2024-08-29 03:12:29 字数 4307 浏览 4 评论 0原文

我对 Rails 和 Mac 相当陌生,正在做我的第一次部署...

我正在尝试在运行 OXS1.6 (Snow Leopard) 的全新 Apple 迷你服务器上设置我的 Rails 应用程序。目前它在我的新 iMac i7(相同操作系统)上运行良好。

我使用以下命令启动 mongrel:

mongrel_rails start -e production -p 3000 -d -a 127.0.0.1 --debug

它开始在 log/mongrel.log 中提供此输出

** Daemonized, any open files are closed.  Look at log/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 127.0.0.1:3000
** Installing debugging prefixed filters. Look in log/mongrel_debug for the files.
** Starting Rails with production environment...
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
/Users/danadmin/ServiceApp/ServiceApp/app/helpers/input_grid_manager.rb:9: warning: already initialized constant ID_PREFIX
/Users/danadmin/ServiceApp/ServiceApp/app/helpers/input_grid_manager.rb:10: warning: already initialized constant ADD_ID
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 127.0.0.1:3000
** Writing PID file to log/mongrel.pid

该输出在我的 dev iMac 上是相同的(包括警告)。

不同之处在于,在我的 iMac 上访问 http://127.0.0.1:3000 会提供应用程序的登录页面。在 mac 迷你服务器上访问相同的结果会出现来自 mongrel 的错误 500 文本:“我们很抱歉,但出了点问题。”

就好像 Rails 不起作用一样。如果我有一些日志文件消息来指导我,我很擅长弄清楚事情,但是 mongrel.log 没有错误消息(输出与上面相同),并且 log/production.log 是空的(这使得我认为 Rails 还没有启动?)。

我的 gems 在机器之间都是相同的版本,应用程序代码也是如此;我在任何 mongrel_debug 日志中都看不到任何线索,除了 mac mini-server 和 iMac 上的rails.log 不同。

启动和单次访问后,首先是来自 mac 迷你服务器的rails.log:

D, [2010-04-15T13:45:34.870406 #6914] DEBUG -- : TRACING ON Thu Apr 15 13:45:34 +1200 2010
Thu Apr 15 13:46:08 +1200 2010 REQUEST /
--- !map:Mongrel::HttpParams 
SERVER_NAME: 127.0.0.1
HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_CACHE_CONTROL: max-age=0
HTTP_HOST: 127.0.0.1:3000
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_0; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
REQUEST_PATH: /
SERVER_PROTOCOL: HTTP/1.1
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
REMOTE_ADDR: 127.0.0.1
PATH_INFO: /
SERVER_SOFTWARE: Mongrel 1.1.5
SCRIPT_NAME: /
HTTP_VERSION: HTTP/1.1
REQUEST_URI: /
SERVER_PORT: "3000"
HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
REQUEST_METHOD: GET
GATEWAY_INTERFACE: CGI/1.2
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_CONNECTION: keep-alive

在我的 iMac 上,除了添加了 HTTP_COOKIE 和 HTTP_IF_NONE_MATCH 之外,它似乎是相同的,这里是来自我的 iMac

# Logfile created on Thu Apr 15 13:41:42 +1200 2010 by logger.rb/22285
D, [2010-04-15T13:41:42.934088 #2070] DEBUG -- : TRACING ON Thu Apr 15 13:41:42 +1200 2010
Thu Apr 15 13:42:05 +1200 2010 REQUEST /
--- !map:Mongrel::HttpParams 
SERVER_NAME: 127.0.0.1
HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_HOST: 127.0.0.1:3000
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
REQUEST_PATH: /
SERVER_PROTOCOL: HTTP/1.1
HTTP_IF_NONE_MATCH: "\"216cc63ce3c1f286ef8dd4f18f354f6e\""
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
REMOTE_ADDR: 127.0.0.1
PATH_INFO: /
SERVER_SOFTWARE: Mongrel 1.1.5
SCRIPT_NAME: /
HTTP_COOKIE: _ServiceApp_session=BAh7DDonY3VzdG9tZXJfbGlzdF9maWx0ZXJfam9iX3N0YXR1c19pZGn6Og9zZXNzaW9uX2lkIiU0ZTk1ZWZjMmViMGU3NjE2YzA0NDc2YTkxYzJlNDZiOToaY3VycmVudF9jdXN0b21lcl9uYW1lIilUSEUgQ1VTVE9NRVIgTkFNRSBORUVEUyBUTyBCRSBMT0FERUQ6EF9jc3JmX3Rva2VuIjFuT1JMUWk0NlZrWlM3c2lUN3BaWCs5NkhRajhxYnFwRnhzVHVTWXEvUWY0PToZam9iX2xpc3RfZmlsdGVyX3RleHQiADogam9iX2xpc3RfZmlsdGVyX2VtcGxveWVlX2lkafo6HmN1c3RvbWVyX2xpc3RfZmlsdGVyX3RleHQiAA%3D%3D--d01bc5d0b457ad524d16cb3402b5dfed9afce83d
HTTP_VERSION: HTTP/1.1
REQUEST_URI: /
SERVER_PORT: "3000"
HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
REQUEST_METHOD: GET
GATEWAY_INTERFACE: CGI/1.2
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_CONNECTION: keep-alive

任何方向或的 rails.log想法将不胜感激。谢谢。

I'm fairly new to Rails and the Mac, and doing my first deploy...

I'm trying to set up my rails app on a brand new Apple mini-server running OXS1.6 (Snow Leopard). It is currently running fine on my new iMac i7 (same OS).

I start mongrel with this command:

mongrel_rails start -e production -p 3000 -d -a 127.0.0.1 --debug

And it starts giving this output in the log/mongrel.log

** Daemonized, any open files are closed.  Look at log/mongrel.pid and log/mongrel.log for info.
** Starting Mongrel listening at 127.0.0.1:3000
** Installing debugging prefixed filters. Look in log/mongrel_debug for the files.
** Starting Rails with production environment...
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
/Users/danadmin/ServiceApp/ServiceApp/app/helpers/input_grid_manager.rb:9: warning: already initialized constant ID_PREFIX
/Users/danadmin/ServiceApp/ServiceApp/app/helpers/input_grid_manager.rb:10: warning: already initialized constant ADD_ID
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 127.0.0.1:3000
** Writing PID file to log/mongrel.pid

The output is the same on my dev iMac (including the warnings).

The difference is that accessing http://127.0.0.1:3000 on my iMac serves up the app's login page. Where as on the mac mini-server accessing the same results in this error 500 text from mongrel: "We're sorry, but something went wrong."

It's as if rails is not working. I'm pretty good at figuring things out if I have some log file messages to direct me, but mongrel.log has no error message (the output remains the same as above), and the log/production.log is empty (which makes me think rails has not started?).

My gems are all the same versions between machines and so is the app code; and there are no clues I can see in any of the mongrel_debug logs, except that rails.log on the mac mini-server and the iMac are different.

After a start and single access, first is the rails.log from the mac mini-server:

D, [2010-04-15T13:45:34.870406 #6914] DEBUG -- : TRACING ON Thu Apr 15 13:45:34 +1200 2010
Thu Apr 15 13:46:08 +1200 2010 REQUEST /
--- !map:Mongrel::HttpParams 
SERVER_NAME: 127.0.0.1
HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_CACHE_CONTROL: max-age=0
HTTP_HOST: 127.0.0.1:3000
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_0; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
REQUEST_PATH: /
SERVER_PROTOCOL: HTTP/1.1
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
REMOTE_ADDR: 127.0.0.1
PATH_INFO: /
SERVER_SOFTWARE: Mongrel 1.1.5
SCRIPT_NAME: /
HTTP_VERSION: HTTP/1.1
REQUEST_URI: /
SERVER_PORT: "3000"
HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
REQUEST_METHOD: GET
GATEWAY_INTERFACE: CGI/1.2
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_CONNECTION: keep-alive

While on my iMac it seems the same except for the addition of the HTTP_COOKIE and the HTTP_IF_NONE_MATCH, here is rails.log from my iMac

# Logfile created on Thu Apr 15 13:41:42 +1200 2010 by logger.rb/22285
D, [2010-04-15T13:41:42.934088 #2070] DEBUG -- : TRACING ON Thu Apr 15 13:41:42 +1200 2010
Thu Apr 15 13:42:05 +1200 2010 REQUEST /
--- !map:Mongrel::HttpParams 
SERVER_NAME: 127.0.0.1
HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_HOST: 127.0.0.1:3000
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
REQUEST_PATH: /
SERVER_PROTOCOL: HTTP/1.1
HTTP_IF_NONE_MATCH: "\"216cc63ce3c1f286ef8dd4f18f354f6e\""
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
REMOTE_ADDR: 127.0.0.1
PATH_INFO: /
SERVER_SOFTWARE: Mongrel 1.1.5
SCRIPT_NAME: /
HTTP_COOKIE: _ServiceApp_session=BAh7DDonY3VzdG9tZXJfbGlzdF9maWx0ZXJfam9iX3N0YXR1c19pZGn6Og9zZXNzaW9uX2lkIiU0ZTk1ZWZjMmViMGU3NjE2YzA0NDc2YTkxYzJlNDZiOToaY3VycmVudF9jdXN0b21lcl9uYW1lIilUSEUgQ1VTVE9NRVIgTkFNRSBORUVEUyBUTyBCRSBMT0FERUQ6EF9jc3JmX3Rva2VuIjFuT1JMUWk0NlZrWlM3c2lUN3BaWCs5NkhRajhxYnFwRnhzVHVTWXEvUWY0PToZam9iX2xpc3RfZmlsdGVyX3RleHQiADogam9iX2xpc3RfZmlsdGVyX2VtcGxveWVlX2lkafo6HmN1c3RvbWVyX2xpc3RfZmlsdGVyX3RleHQiAA%3D%3D--d01bc5d0b457ad524d16cb3402b5dfed9afce83d
HTTP_VERSION: HTTP/1.1
REQUEST_URI: /
SERVER_PORT: "3000"
HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
REQUEST_METHOD: GET
GATEWAY_INTERFACE: CGI/1.2
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_CONNECTION: keep-alive

Any direction or ideas would be greatly appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

栀子花开つ 2024-09-05 03:12:29

我希望您已经为您的应用程序设置了数据库。如果没有,请执行rake db:create:all并迁移数据库rake db:migrate RAILS_ENV="product"。猜测您还没有为生产设置数据库。

编辑:是的,看起来您已经创建了一个用于开发的数据库,但不是用于生产的。因此,它可以在开发模式(即在 iMac 上)上正常运行,但不能在生产模式下运行。通过输入第一个命令(如上所示)为您的生产模式创建一个数据库。

I hope you have setup the database for your app. If not do a rake db:create:all and migrate your database rake db:migrate RAILS_ENV="production". Guess you haven't setup a database for production.

Edit: Yes it looks like you had created a database for development but not for production. So it will run fine on a development mode (i.e on your iMac) but not in the production mode. Create a database for your production mode by typing in the first command as shown above.

好听的两个字的网名 2024-09-05 03:12:29

还使用乘客进行开发和生产。它减少了时不时启动杂种的麻烦。您还可以使用乘客预面板来启动您的应用程序。

Also use passenger for development and production. It reduces the hassle of booting up mongrels every now and again. Also you can use the passenger prefpane to launch your apps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文