Re: capistrano errors when running `cap migrate`

Jamey
Thu, 14 Sep 2006 12:56:28 -0000

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, 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
\&quot;current\&quot; (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"
&nbsp; role :web, &quot;<a
href="http://mysite.com">mysite.com"
&nbsp; role :app, &quot;<a
href="http://mysite.com">mysite.com"
&nbsp; role :db, &nbsp;&quot;<a
href="http://mysite.com">
> 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.

Try:

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


Jamey