Need Help w/ Production Deployment (docs lacking)

I’ve gotten to the point of attempting a “test” production deployment.
And it looks like the further you get away from the development
environment, the fuzzier things get. Ugh.

So, yes, I’ve read all about Capistrano and I’ve even found this great
how-to: (http://duncandavidson.com/essay/2005/12/railsonlighty). But
notice that the section on “now get your production database set up” is
more of an exercise left to the reader (understandably).

Ruby 1.8.4

Rails 1.1.6

And so I’ve created the foo_production database and mysql lets me peek
at it. But when I run rake db:migrate & rake engines_migrate,
foo_development is getting populated with tables. I can’t seem to get
my tables loaded at all.

  • script/server is booting lighttpd

  • script/server webrick -e production boots WEBrick, but seems to ignore
    the option

  • script/server -h does NOT list -e

  • script/server -e production gives me an error ‘-e invalid option’
    (found a thread on this, but no resolution other than to…

  • uncommented the first ENV line (ENV[‘RAILS_ENV’] ||= 'production) in
    environment.rb, but this doesn’t seem to work either

  • I dropped the foo_development database and now when I run
    script/server I get the following:


=> Booting WEBrick…
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:330:in
real_connect': Unknown database 'foo_development' (Mysql::Error) from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:330:in connect’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:87:in
initialize' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:36:in mysql_connection’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in
connection_without_query_cache=' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_cache.rb:54:in connection=’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in
retrieve_connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in connection’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:679:in
table_exists?' ... 14 levels... from /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
from script/server:3

I totally feel like I’m missing something stupid. But my two hands &
flashlight seem to be occupied. Thoughts?

–dwf

New rule. Search for solutions in the following:

wiki.rubyonrails.org
http://www.ruby-forum.com
and ALWAYS
rails.techno-weenie.net

Ugh. Such a noob.

The problem is that I was attempting to use rake db:migrate to bring up
my tables. This is fine, but since the default value of RAILS_ENV is
‘development’, the work was always going to foo_development. The simple
fix is:

rake RAILS_ENV=‘production’ db:migrate

And now I have tables.

–dwf