Im trying to deploy my application using Capistrano, but I get this error message:
我试图使用Capistrano部署我的应用程序,但我收到此错误消息:
`deploy:setup' is only run for servers matching {:except=>{:no_release=>true}}, but no servers matched
`deploy:setup'仅对匹配{:except => {:no_release => true}}的服务器运行,但没有匹配的服务器
When running this command:
运行此命令时:
bundle exec cap deploy:setup
Here is my deploy.rb file.
这是我的deploy.rb文件。
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.
我正在使用Rails 3。
4 个解决方案
#1
9
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.
您似乎使用“set”而不是“role”,但是您应该在进行更改之前确认这一点。
#2
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
大多数人可能正在使用capistrano的多级,所以你不会把你的角色放在deploy.rb中,所以如果你在config / deploy /#env_name.rb中添加了特定于环境的角色,那么一定要在config / deploy.rb中添加这些角色。
set :stages, %w(#env_name1, #env_name2...)
require 'capistrano/ext/multistage'
and make sure the capistrano-ext gem is installed.
并确保安装了capistrano-ext gem。
#3
1
Seems that you've already set up your server with bundle exec cap deploy:setup
.
似乎您已经使用bundle exec cap deploy:setup设置了服务器。
If that's the case you should now run bundle exec cap deploy
.
如果是这种情况,您现在应该运行bundle exec cap deploy。
#4
0
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.
如果使用多阶段,请确保环境特定的配置文件(例如config / deploy / environment.rb)是config / deploy目录中的唯一文件。我有一个环境,开发我也无法部署,原来那里是一个完整的空配置/部署/开发文件,它被加载而不是我的config / deploy / dev.rb文件,导致每个部署到该环境发布错误失败。
#1
9
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.
您似乎使用“set”而不是“role”,但是您应该在进行更改之前确认这一点。
#2
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
大多数人可能正在使用capistrano的多级,所以你不会把你的角色放在deploy.rb中,所以如果你在config / deploy /#env_name.rb中添加了特定于环境的角色,那么一定要在config / deploy.rb中添加这些角色。
set :stages, %w(#env_name1, #env_name2...)
require 'capistrano/ext/multistage'
and make sure the capistrano-ext gem is installed.
并确保安装了capistrano-ext gem。
#3
1
Seems that you've already set up your server with bundle exec cap deploy:setup
.
似乎您已经使用bundle exec cap deploy:setup设置了服务器。
If that's the case you should now run bundle exec cap deploy
.
如果是这种情况,您现在应该运行bundle exec cap deploy。
#4
0
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.
如果使用多阶段,请确保环境特定的配置文件(例如config / deploy / environment.rb)是config / deploy目录中的唯一文件。我有一个环境,开发我也无法部署,原来那里是一个完整的空配置/部署/开发文件,它被加载而不是我的config / deploy / dev.rb文件,导致每个部署到该环境发布错误失败。