capistrano errors when running `cap migrate`

Hello all, I can deploy, enable/disable_web, cleanup, restart and so forth, but I am unable to migrate without errors.

When I am on the server I can run rake RAILS_ENV="production" migrate successfully. When I run cap migrate:

  • executing task migrate
  • executing “cd /var/www/localhost/rails_test/current && rake RAILS_ENV=production migrate” /opt/local/lib/ruby/gems/1.8/gems/capistrano- 1.1.0/lib/capistrano/actor.rb:416:in `execute_on_servers’: The migrate task is only run for servers matching {:only=>{:primary=>true}, :roles=>:db, :desc=>“Run the migrate rake task. By default, it runs this in the version of the app\nindicated by the ‘current’ symlink. (This means you should not invoke this task\nuntil the symlink has been updated to the most recent version.) However, you\ncan specify a different release via the migrate_target variable, which must be\none of "current" (for the default behavior), or "latest" (for the latest release\nto be deployed with the update_code task). You can also specify additional\nenvironment variables to pass to rake via the migrate_env variable. Finally, you\ncan specify the full path to the rake executable by setting the rake variable.\n”}, but no servers matched (RuntimeError)

My deploy file specifies: task :switch_to_production do set :use_sudo, false set :user, “root” role :web, “mysite.com” role :app, “mysite.com” role :db, " mysite.com" set :deploy_to, “/var/www/localhost/rails_test” set :rails_env, “production” end

task :migrate_production do switch_to_production migrate end

I have similar task :whatever_production ones that work (as I’d mentioned). Any ideas?

Thanks in advance for any advice.

B N wrote:

Hello all,   I can deploy, enable/disable_web, cleanup, restart and so forth, but I am unable to migrate without errors.

When I am on the server I can run `rake RAILS_ENV="production" migrate` successfully. When I run cap migrate:   * executing task migrate   * executing "cd /var/www/localhost/rails_test/current && rake RAILS_ENV=production migrate" /opt/local/lib/ruby/gems/1.8/gems/capistrano-1.1.0/lib/capistrano/actor.rb:416:in

`execute_on_servers': The migrate task is only run for servers matching {:only=>{:primary=>true}, :roles=>:db, :desc=>"Run the migrate rake task. By default, it runs this in the version of the app\nindicated by the 'current' symlink. (This means you should not invoke this task\nuntil the symlink has been updated to the most recent version.) However, you\ncan specify a different release via the migrate_target variable, which must be\none of \"current\" (for the default behavior), or \"latest\" (for the latest release\nto be deployed with the update_code task). You can also specify additional\nenvironment variables to pass to rake via the migrate_env variable. Finally, you\ncan specify the full path to the rake executable by setting the rake variable.\n"}, but no servers matched (RuntimeError)

My deploy file specifies: task :switch_to_production do   set :use_sudo, false   set :user, "root"   role :web, "mysite.com"   role :app, "mysite.com"   role :db, "mysite.com"   set :deploy_to, "/var/www/localhost/rails_test"   set :rails_env, "production" end

task :migrate_production do   switch_to_production   migrate end

I have similar task :whatever_production ones that work (as I'd mentioned). Any ideas? Thanks in advance for any advice.

------=_Part_7169_12225120.1158232943016 Content-Type: text/html; charset=ISO-8859-1 X-Google-AttachSize: 2205

Hello all, <br> &nbsp; I can deploy, enable/disable_web, cleanup, restart and so forth, but <br> I am unable to migrate without errors. <br> <p>When I am on the server I can run `rake RAILS_ENV=&quot;production&quot; migrate` <br> successfully. When I run cap migrate: <br> &nbsp; * executing task migrate <br> &nbsp; * executing &quot;cd /var/www/localhost/rails_test/current &amp;&amp; rake <br> RAILS_ENV=production &nbsp;migrate&quot; <br> /opt/local/lib/ruby/gems/1.8/gems/capistrano- 1.1.0/lib/capistrano/actor.rb:416:in <br> `execute_on_servers': The migrate task is only run for servers matching <br> {:only=&gt;{:primary=&gt;true}, :roles=&gt;:db, :desc=&gt;&quot;Run the migrate rake <br> task. By default, it runs this in the version of the app\nindicated by <br> the 'current' symlink. (This means you should not invoke this <br> task\nuntil the symlink has been updated to the most recent version.) <br> However, you\ncan specify a different release via the migrate_target <br> variable, which must be\none of \&quot;current\&quot; (for the default behavior), <br> or \&quot;latest\&quot; (for the latest release\nto be deployed with the <br> update_code task). You can also specify additional\nenvironment <br> variables to pass to rake via the migrate_env variable. Finally, <br> you\ncan specify the full path to the rake executable by setting the <br> rake variable.\n&quot;}, but no servers matched (RuntimeError) <br> </p><p>My deploy file specifies: <br> task :switch_to_production do <br> &nbsp; set :use_sudo, false <br> &nbsp; set :user, &quot;root&quot; <br> &nbsp; role :web, &quot;<a href="http://mysite.com">mysite.com</a>&quot; <br> &nbsp; role :app, &quot;<a href="http://mysite.com">mysite.com</a>&quot; <br> &nbsp; role :db, &nbsp;&quot;<a href="http://mysite.com"> mysite.com</a>&quot; <br> &nbsp; set :deploy_to, &quot;/var/www/localhost/rails_test&quot; <br> &nbsp; set :rails_env, &quot;production&quot; <br> end <br> </p><p>task :migrate_production do <br> &nbsp; switch_to_production <br> &nbsp; migrate <br> end <br> </p><p>I have similar task :whatever_production ones that work (as I'd <br> mentioned). Any ideas? <br> </p>Thanks in advance for any advice.

Try:

role :db, "mysite.com", :primary=>true

Jamey

Hmmm, I had encountered that in other code and assumed it only necessary when multiple databases were involved. In any event, it worked and I am deeply appreciative.

Best regards!

Jamey wrote: