Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy using Capistrano - is only run for servers matching

Im trying to deploy my application using Capistrano, but I get this error message:

`deploy:setup' is only run for servers matching {:except=>{:no_release=>true}}, but no servers matched

When running this command:

bundle exec cap deploy:setup

Here is my deploy.rb file.

set :application, "example.com"
set :repository, "[email protected]:username/repo.git"
set :use_sudo, false
set :scm, :git
set :web, application
set :app, application
set :db, application
set :branch, "master"
set :user, "webmaster"
set :deploy_to,  "/opt/www/#{application}"
set :deploy_via, :remote_cache
set :domain, application
set :port, 2222

set :bundler_cmd, "bundle install --deployment --without=development,test"
ssh_options[:paranoid] = false

namespace :deploy do
  task :start do ; end
  task :stop do ; end

  task :restart_stalker do
    run "cd #{deploy_to}/current && thor stalker:kill && stalker:init"
  end

  task :restart, :roles => :app, :except => { :no_release => true } do
    run "cd #{deploy_to}/current && touch tmp/restart.txt"
  end

  after "bundler_cmd", "deploy:restart_stalker"
end

I'm using Rails 3.

like image 385
Linus Oleander Avatar asked Apr 05 '11 17:04

Linus Oleander


3 Answers

You need to define some roles. E.g.:

role :app, 'myapphostname'
role :web, 'mywebhostname'

It seems you used "set" instead of "role", but you should confirm this before making the change.

like image 126
Kelvin Avatar answered Oct 27 '22 01:10

Kelvin


Most people are probably using multistage with capistrano so you wouldnt put your roles in the deploy.rb, so if you have added environment specific roles in config/deploy/#env_name.rb then make sure to add these in your config/deploy.rb

set :stages, %w(#env_name1, #env_name2...)
require 'capistrano/ext/multistage'

and make sure the capistrano-ext gem is installed.

like image 33
Adam McB Avatar answered Oct 27 '22 01:10

Adam McB


Seems that you've already set up your server with bundle exec cap deploy:setup.

If that's the case you should now run bundle exec cap deploy.

like image 38
Pablo B. Avatar answered Oct 27 '22 00:10

Pablo B.