Moving my app from Development to Production.

I'm new to Rails, coming from Python (Django) and PHP (Zend), and have
an issue trying to move my application from development to production.
It's a little mysterious to me, but I'm sure it's something simple
that I've completely overlooked.

Without getting to in depth, I'm comfortable with developing, but I'm
taking the steps in moving applications from my development machine to
a virtual production machine. The Production machine is a Debian Lenny
box running ruby 1.8.7, Rails 2.3.4, and Mongrel 1.1.5. I've set up a
quick and simple "todo list" app for this task by running: rails todo -d mysql cd todo { mate | vim } config/database.yml rake db:create:all script/generate scaffold Todo title:string body:text done:boolean
due:datetime rake db:migrate

And when I run script/server, everything runs great, and I can see no
errors in the logs. If I evoke mongrel_rails directly on the
application by: sudo mongrel_rails start -e development -p 8000 -a 127.0.0.1 -P tmp/ pids/mongrel-1.pid

I get the exact same effect (as I understand I am essentially doing
the same thing as script/server). But when I evoke mongrel_rails to
run as production: sudo mongrel_rails start -e production -p 8000 -a 127.0.0.1 -P tmp/ pids/mongrel-1.pid

Then I can pull up the public/index.html with no problem, but
navigating to http://example.com/todos I'll get the dreaded "We're
sorry, but something went wrong. (500)" page, and my log/ production.log delivers:

ActiveRecord::StatementInvalid (Mysql::Error: Table
'todo_production.todos' doesn't exist: SELECT * FROM `todos` ):    app/controllers/todos_controller.rb:5:in `index'

Rendering /var/rails/todo/public/500.html (500 Internal Server Error)

Which can be confirmed by opening up the production database,
todo_production, and noting that it is empty. What have I overlooked?

Note: the todo app is borrowed from: http://robmayhew.com/rails-201-todo-list-tutorial/

Apparantly nothing, rake db:create:all should create all you databases defined on config/database.yml Are you sure the specified production configuration is a valid configuration? Have you tried?: rake db:create RAILS_ENV=production

Hope it helps.

H.P.L. wrote:

rails todo -d mysql cd todo { mate | vim } config/database.yml rake db:create:all script/generate scaffold Todo title:string body:text done:boolean
due:datetime rake db:migrate

You've created all three databases here (Prod,Dev,Test) but they are empty.

You've then populated the dev database with "rake db:migrate"

I get the exact same effect (as I understand I am essentially doing
the same thing as script/server). But when I evoke mongrel_rails to
run as production: sudo mongrel_rails start -e production -p 8000 -a 127.0.0.1 -P tmp/ pids/mongrel-1.pid

Then I can pull up the public/index.html with no problem, but
navigating to http://example.com/todos I'll get the dreaded "We're
sorry, but something went wrong. (500)" page, and my log/ production.log delivers:

ActiveRecord::StatementInvalid (Mysql::Error: Table
'todo_production.todos' doesn't exist: SELECT * FROM `todos` ):    app/controllers/todos_controller.rb:5:in `index'   

The table todos doesn't exist as it hasn't been created.

Anthony

That's totally true, I messed that point before. You need to run: rake db:migrate RAILS_ENV=production