Welcome Guest | Login

rake db:migrate hanging when running

I'm a new Ruby on Rails developer, and this is my first attempt at deploying a web app that I have built. This whole process works on my development machine which has the following specs:

OS X 10.5.3

Gem: 1.0.1
Rails: 1.2.6
Ruby: 1.8.6

I've followed all of the steps in the "how to deploy" tutorial, and I'm trying to run my migration files to create and populate my database tables.

I'm running this command:
rake db:migrate RAILS_ENV=production

This is the output:
(in /home/USERNAME/MYAPPNAME)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateUsers: migrating =====================================================
-- create_table(:users)
  -> 0.0019s
-- add_index(:users, :username)
  -> 0.0029s
rake aborted!
druby://localhost:9010 - #<Errno::ETIMEDOUT: Connection timed out - connect(2)>
Here is this migration file (I've altered the info, but the structure is the same):

class CreateUsers < ActiveRecord::Migration
 def self.up
   create_table :users do |t|
     t.column :username, :string
     t.column :email,    :string
     t.column :hashed_password, :string, :limit => 64
     t.column :temp, :string, :limit => 8
   end
   add_index :users, :username
   User.create(:username => 'testuser',
               :email => 'fake@test.com',
               :password => 'pass123',
               :password_confirmation => 'pass123')
 end

 def self.down
   drop_table :users
 end
end
if I remove the User.create statement it run's fine until it get's to a migration which looks for that user.

I do have a migration which seems to run fine that has a create statement. it populates a table with state names, here's a sample of that migration:

class CreateStates < ActiveRecord::Migration
 def self.up
   create_table :states do |t|
     t.column :abv, :string
     t.column :name, :string
     t.column :region, :string
   end
   State.create(:abv  =>   'AL',
                :name =>   'Alabama',
                :region => 'South')
   State.create(:abv  =>   'AK',
                :name =>   'Alaska',
                :region => 'Pacific')
   State.create(:abv  =>   'AZ',
                :name =>   'Arizona',
                :region => 'West')
 end

 def self.down
   drop_table :states
 end
end
like I said above, this whole migration process run's fine locally, any idea's where I'm going wrong?

2008-06-01 11:32 AM

just in case it helps, here's the rake db:migrate command with --trace

(in /home/USERNAME/MYWEBAPP)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateUsers: migrating =====================================================
-- create_table(:users)
  -> 0.0019s
-- add_index(:users, :username)
  -> 0.0029s
rake aborted!
druby://localhost:9010 - #<Errno::ETIMEDOUT: Connection timed out - connect(2)>
/usr/local/lib/ruby/1.8/drb/drb.rb:736:in `open'
/usr/local/lib/ruby/1.8/drb/drb.rb:729:in `each'
/usr/local/lib/ruby/1.8/drb/drb.rb:729:in `open'
/usr/local/lib/ruby/1.8/drb/drb.rb:1189:in `initialize'
/usr/local/lib/ruby/1.8/drb/drb.rb:1169:in `new'
/usr/local/lib/ruby/1.8/drb/drb.rb:1169:in `open'
/usr/local/lib/ruby/1.8/drb/drb.rb:1085:in `method_missing'
/usr/local/lib/ruby/1.8/drb/drb.rb:1103:in `with_friend'
/usr/local/lib/ruby/1.8/drb/drb.rb:1084:in `method_missing'
/home/USERNAME/MYWEBAPP/vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in `send'
/home/USERNAME/MYWEBAPP/vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in `method_missing'
/home/USERNAME/MYWEBAPP/vendor/plugins/acts_as_ferret/lib/act_methods.rb:189:in `acts_as_ferret'
/home/USERNAME/MYWEBAPP/app/models/user.rb:36
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in `require'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in `require'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:104:in `require_or_load'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:248:in `load_missing_constant'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in `const_missing'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:464:in `const_missing'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:260:in `load_missing_constant'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
./db/migrate//001_create_users.rb:10:in `real_up'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:212:in `send'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:212:in `migrate'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:212:in `migrate'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:335:in `migrate'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:330:in `each'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:330:in `migrate'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:297:in `up'
/home/USERNAME/MYWEBAPP/vendor/rails/activerecord/lib/active_record/migration.rb:288:in `migrate'
/home/USERNAME/MYWEBAPP/vendor/rails/railties/lib/tasks/databases.rake:4
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

2008-06-01 11:37 AM

well, I think I figured out the cause, closer inspection of the trace shows these lines of code:

/home/USERNAME/MYWEBAPP/vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in `send'
/home/USERNAME/MYWEBAPP/vendor/plugins/acts_as_ferret/lib/remote_index.rb:16:in `method_missing'
/home/USERNAME/MYWEBAPP/vendor/plugins/acts_as_ferret/lib/act_methods.rb:189:in `acts_as_ferret'
/home/USERNAME/MYWEBAPP/app/models/user.rb:36
line 36 in my user model is this:

  acts_as_ferret :fields => ['username', 'email'] # but NOT password
so I think my acts_as_ferret plugin is all messed up.





edit:

I tried removing that line of code, and everything runs fine. while I don't really need that line of code, any idea's why it would work locally but not on the server?

2008-06-01 11:52 AM

I uncommented the line 36 in your user model and tried rake db:migrate command. I didn't get any error as you mentioned. Are you still having any issues?

2008-06-01 02:39 PM

Well I don't know if it's something I did, or something you did, but it seems to work now.

thanks a bunch, it was for a function that only admin's have, but it makes my life easier :)

2008-06-01 03:02 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.