Ruby on rails Capistrano:没有用于…的服务器。。。。彪马州站
当前正在运行capistrano进行部署: 环境:Ruby on rails Capistrano:没有用于…的服务器。。。。彪马州站,ruby-on-rails,ruby,capistrano,Ruby On Rails,Ruby,Capistrano,当前正在运行capistrano进行部署: 环境: Capistrano 2.15.5 RAILS\u ENV=uat cap部署 2013-11-22 04:27:34 executing `puma:stop' * no servers for "cd /home/ubuntu/fancied-server/current; bundle exec pumactl -S /home/ubuntu/fancied-server/shared/sockets/puma.state stop"
Capistrano 2.15.5
RAILS\u ENV=uat cap部署
2013-11-22 04:27:34 executing `puma:stop'
* no servers for "cd /home/ubuntu/fancied-server/current; bundle exec pumactl -S /home/ubuntu/fancied-server/shared/sockets/puma.state stop"
我的卡皮斯特拉诺:
require "capistrano"
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
set :rvm_autolibs_flag, "read-only" # more info: rvm help autolibs
before 'deploy:setup', 'rvm:install_rvm' # install RVM
before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
if ENV['RAILS_ENV'] == 'uat'
# The address of the remote host on EC2 (the Public DNS address)
set :location, "54.252.151.190"
set :branch, "uat"
role :app, location
role :web, location
role :db, location, :primary => true
role :resque, location
role :rapns, location
#after 'deploy:stop', 'puma:stop'
#after 'deploy:start', 'puma:start'
#after 'deploy:restart', 'puma:restart'
# Ensure the tmp/sockets directory is created by the deploy:setup task and
# symlinked in by the deploy:update task. This is not handled by Capistrano
# v2 but is fixed in v3.
#shared_children.push('tmp/sockets')
_cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
_cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
_cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
_cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" }
_cset(:puma_role) { :app }
end
namespace :deploy do
task :start, :roles => :web, :on_error => :continue do
if ENV['RAILS_ENV'] == 'uat'
if !puma.puma_pid_exists?
puma.start
else
puma.restart
end
else
run start_command
end
sleep 2
warmup_cache
end
....
namespace :puma do
desc 'Start puma'
task :start, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue, :on_error => :continue do
run "cd #{current_path} && #{fetch(:puma_cmd)} #{start_options}", :pty => false
end
desc 'Stop puma'
task :stop, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue, :on_error => :continue do
run "cd #{current_path}; #{fetch(:pumactl_cmd)} -S #{state_path} stop"
end
desc 'Restart puma'
task :restart, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue, :on_error => :continue do
run "cd #{current_path}; #{fetch(:pumactl_cmd)} -S #{state_path} restart"
end
end
所以问题是:服务器设置是否正确?或者如何设置服务器,以便it停止对问题进行窃听我现在没有办法测试它,但是您是否尝试将服务器位置和角色移动到if块之外 在部署之前(至少是第一次),最好先执行cap部署:检查。它将检查是否满足基本的依赖关系,比如拥有正确的权限,检查是否安装了svn/git等 对于多级部署,Capistrano实际上提供了一种定义角色、服务器和其他特定于环境的配置的更简洁的方法,首先在config/deploy.rb中定义角色,然后在config/deploy/.rb(-environment)下定义特定于环境的配置文件。 例如,您可以通过以下方式在config/deploy.rb上定义阶段:
set :stages, %w(production staging)
set :default_stage, "staging"
然后您可以在其自己的配置文件中定义特定于环境的配置。例如,在config/deploy/production.rb上:
set :rails_env, 'production'
namespace :deploy do
task :start do
# ...
end
task :stop do
# ...
end
task :restart do
# ...
end
end
资料来源: