Deploy using Capistrano - is only run for servers matching

11,737

Solution 1

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.

Solution 2

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.

Solution 3

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.

Share:
11,737

Related videos on Youtube

Linus Oleander
Author by

Linus Oleander

I'm a developer, student, long distance triathlete and adrenaline junkie from Gothenburg, Sweden. I'm currently doing master of science in algorithms, logic and languages at Chalmers university. Beside school I'm the founder of radiofy.se and co-founder of hprovet.se

Updated on June 04, 2022

Comments

  • Linus Oleander
    Linus Oleander almost 2 years

    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.

Related