views:

162

answers:

2

Hi there

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.

A: 

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.

Shripad K
Thanks for your answer Paddy, it pointed me in the right direction, I had created the production database; but guess who forgot to tick the "Automatically Start MySQL Server on Startup" in the preferences pane, and had also forgotten he had rebooted the server. Yes, it was me. Proof I shouldn't go near a computer when tired. I appreciate the time you spent answering my question.
Mark V
You are welcome :)
Shripad K
@Mark, Could you mark this as answered, then?
Tim Snowhite
A: 

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.

Shripad K