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, "git@github.com: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.
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.
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.
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
.
I'm going to leave an answer here that helped me that when none of the suggested answers here or elsewhere could help me - I spent days researching this issue before I found a fix.
Make sure that if using multistage that the environment specific config files (e.g. config/deploy/environment.rb
) are the only files in the config/deploy
directory. I had an environment, dev
that I was unable to deploy too, turned out there somehow was a complete empty config/deploy/dev
file that was getting loaded instead of my config/deploy/dev.rb
file, causing every deployment to that environment fail with the posted error.
精彩评论