构建任务时 Capistrano 3 出错
Error in Capistrano 3 when building task
I am trying to deploy a crm application to digital ocean with Capistrano 3 and sunzi. (FWI Im a novice in rails )
My tasks templates are from this link: **https://github.com/TalkingQuickly/capistrano-3-rails-template
I've tried lots of
stuff to fix the error below, : I've changed the file extension, I've added code but nothings helping.. Anyone got any Ideas?**
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
Don't know how to build task 'deploy:setup_config' (see --tasks)
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:62:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:353:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/dsl/task_enhancements.rb:7:in `before'
config/deploy.rb:81:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:209:in `in_namespace'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/dsl_definition.rb:147:in `namespace'
config/deploy.rb:71:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/setup.rb:14:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/setup.rb:14:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ubuntu/workspace/tcrm/Capfile:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:689:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:77:in `block in run'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/application.rb:15:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/bin/cap:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `load'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `<main>'
/usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => production
这是我的 capfile:
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
#
#require 'capistrano/rvm'
require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('/tcrm/lib/capistrano/tasks/*.rake').each { |r| import r }
Dir.glob('lib/capistrano/**/*.rake').each { |r| import r }
Rake::Task[:production].invoke
这是我的 Deploy.rb 文件
set :application, 'tcrm'
set :deploy_user, 'deployer'
set :assets_roles, [:app]
# setup repo details
set :scm, :git
set :repo_url, 'https://github.com/mic50771/tcrm.git'
# setup rbenv.
set :rbenv_type, :system
set :rbenv_ruby, '2.1.2'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
# how many old releases do we want to keep, not much
set :keep_releases, 5
# files we want symlinking to specific entries in shared
set :linked_files, %w{config/database.yml config/secrets.yml}
# dirs we want symlinking to shared
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# what specs should be run before deployment is allowed to
# continue, see lib/capistrano/tasks/run_tests.cap
#set :tests, []
# which config files should be copied by deploy:setup_config
# see documentation in lib/capistrano/tasks/setup_config.cap
# for details of operations
set(:config_files, %w(
nginx.conf
database.example.yml
secret.sample.yml
log_rotation
unicorn.rb
unicorn_init.sh
))
# which config files should be made executable after copying
# by deploy:setup_config
set(:executable_config_files, %w(
unicorn_init.sh
))
# files which need to be symlinked to other parts of the
# filesystem. For example nginx virtualhosts, log rotation
# init scripts etc. The full_app_name variable isn't
# available at this point so we use a custom template {{}}
# tag and then add it at run time.
set(:symlinks, [
{
source: "nginx.conf",
link: "/etc/nginx/sites-enabled/{{full_app_name}}"
},
{
source: "unicorn_init.sh",
link: "/etc/init.d/unicorn_{{full_app_name}}"
},
{
source: "log_rotation",
link: "/etc/logrotate.d/{{full_app_name}}"
}
])
# this:
# http://www.capistranorb.com/documentation/getting-started/flow/
# is worth reading for a quick overview of what tasks are called
# and when for `cap stage deploy`
namespace :deploy do
# make sure we're deploying what we think we're deploying
before :deploy, "deploy:check_revision"
# only allow a deploy with passing tests to deployed
#before :deploy, "deploy:run_tests"
# compile assets locally then rsync
after :finishing, 'deploy:cleanup'
# remove the default nginx configuration as it will tend
# to conflict with our configs.
before 'deploy:setup_config', 'nginx:remove_default_vhost'
# reload nginx to it will pick up any modified vhosts from
# setup_config
after 'deploy:setup_config', 'nginx:reload'
# Restart monit so it will pick up any monit configurations
# we've added
# after 'deploy:setup_config', 'monit:restart'
# As of Capistrano 3.1, the `deploy:restart` task is not called
# automatically.
after 'deploy:publishing', 'deploy:restart'
end
更新:
我已将我的 gems 更新到 3.10(之前是 3.4.0),但我收到了一个不同的错误:
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4: warning: duplicated key at line 6 ignored: :starting
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
Don't know how to build task 'deploy:setup_config' (see --tasks)
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:62:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:353:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/dsl/task_enhancements.rb:5:in `before'
config/deploy.rb:81:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:209:in `in_namespace'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/dsl_definition.rb:147:in `namespace'
config/deploy.rb:71:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ubuntu/workspace/tcrm/Capfile:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:689:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/application.rb:24:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:77:in `block in run'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `load'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `<main>'
/usr/local/rvm/gems/ruby-2.2.1@global/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.1@global/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => production
更新 2:
尽管当我访问我的 Ip 时,上限生产部署已经完成,但 nginx 默认页面仍然存在吗?
有什么建议吗?
您提供的 link 说 capistrano gem 版本应该是 3.1 系列,但您使用的是 capistrano 3.4.0。
在终端 运行 中:bundle clean --force
然后在 Gemfile 中粘贴您提供的 link 中提供的行:
gem 'capistrano', '~> 3.1.0'
# rails specific capistrano funcitons
gem 'capistrano-rails', '~> 1.1.0'
# integrate bundler with capistrano
gem 'capistrano-bundler'
# if you are using RBENV
gem 'capistrano-rbenv', "~> 2.0"
# Use Unicorn as our app server
gem 'unicorn'
然后运行捆绑安装
如果错误仍然存在,请查看我的 link 解释 在 Rails 上使用 Puma 和 Capistrano 将 Ruby 部署到 Digital Ocean 的完整指南:
http://sulmanbaig.com/blog/deploy-on-digitalocean-rails-puma-nginx
对于您的第二个编辑问题,答案是:
在 Capfile 中放入这些行:
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/nginx'
最后删除另外两行并添加以下行:
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
实际上你正在调用 deploy 和 nginx 的任务,但 Capfile 中不需要它们。
I am trying to deploy a crm application to digital ocean with Capistrano 3 and sunzi. (FWI Im a novice in rails ) My tasks templates are from this link: **https://github.com/TalkingQuickly/capistrano-3-rails-template I've tried lots of stuff to fix the error below, : I've changed the file extension, I've added code but nothings helping.. Anyone got any Ideas?**
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
Don't know how to build task 'deploy:setup_config' (see --tasks)
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:62:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:353:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/dsl/task_enhancements.rb:7:in `before'
config/deploy.rb:81:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:209:in `in_namespace'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/dsl_definition.rb:147:in `namespace'
config/deploy.rb:71:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/setup.rb:14:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/setup.rb:14:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ubuntu/workspace/tcrm/Capfile:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:689:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:77:in `block in run'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/lib/capistrano/application.rb:15:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.4.0/bin/cap:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `load'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `<main>'
/usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => production
这是我的 capfile:
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
#
#require 'capistrano/rvm'
require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('/tcrm/lib/capistrano/tasks/*.rake').each { |r| import r }
Dir.glob('lib/capistrano/**/*.rake').each { |r| import r }
Rake::Task[:production].invoke
这是我的 Deploy.rb 文件
set :application, 'tcrm'
set :deploy_user, 'deployer'
set :assets_roles, [:app]
# setup repo details
set :scm, :git
set :repo_url, 'https://github.com/mic50771/tcrm.git'
# setup rbenv.
set :rbenv_type, :system
set :rbenv_ruby, '2.1.2'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
# how many old releases do we want to keep, not much
set :keep_releases, 5
# files we want symlinking to specific entries in shared
set :linked_files, %w{config/database.yml config/secrets.yml}
# dirs we want symlinking to shared
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# what specs should be run before deployment is allowed to
# continue, see lib/capistrano/tasks/run_tests.cap
#set :tests, []
# which config files should be copied by deploy:setup_config
# see documentation in lib/capistrano/tasks/setup_config.cap
# for details of operations
set(:config_files, %w(
nginx.conf
database.example.yml
secret.sample.yml
log_rotation
unicorn.rb
unicorn_init.sh
))
# which config files should be made executable after copying
# by deploy:setup_config
set(:executable_config_files, %w(
unicorn_init.sh
))
# files which need to be symlinked to other parts of the
# filesystem. For example nginx virtualhosts, log rotation
# init scripts etc. The full_app_name variable isn't
# available at this point so we use a custom template {{}}
# tag and then add it at run time.
set(:symlinks, [
{
source: "nginx.conf",
link: "/etc/nginx/sites-enabled/{{full_app_name}}"
},
{
source: "unicorn_init.sh",
link: "/etc/init.d/unicorn_{{full_app_name}}"
},
{
source: "log_rotation",
link: "/etc/logrotate.d/{{full_app_name}}"
}
])
# this:
# http://www.capistranorb.com/documentation/getting-started/flow/
# is worth reading for a quick overview of what tasks are called
# and when for `cap stage deploy`
namespace :deploy do
# make sure we're deploying what we think we're deploying
before :deploy, "deploy:check_revision"
# only allow a deploy with passing tests to deployed
#before :deploy, "deploy:run_tests"
# compile assets locally then rsync
after :finishing, 'deploy:cleanup'
# remove the default nginx configuration as it will tend
# to conflict with our configs.
before 'deploy:setup_config', 'nginx:remove_default_vhost'
# reload nginx to it will pick up any modified vhosts from
# setup_config
after 'deploy:setup_config', 'nginx:reload'
# Restart monit so it will pick up any monit configurations
# we've added
# after 'deploy:setup_config', 'monit:restart'
# As of Capistrano 3.1, the `deploy:restart` task is not called
# automatically.
after 'deploy:publishing', 'deploy:restart'
end
更新: 我已将我的 gems 更新到 3.10(之前是 3.4.0),但我收到了一个不同的错误:
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4: warning: duplicated key at line 6 ignored: :starting
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
Don't know how to build task 'deploy:setup_config' (see --tasks)
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:62:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:353:in `[]'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/dsl/task_enhancements.rb:5:in `before'
config/deploy.rb:81:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task_manager.rb:209:in `in_namespace'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/dsl_definition.rb:147:in `namespace'
config/deploy.rb:71:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/ubuntu/workspace/tcrm/Capfile:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:689:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/application.rb:24:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:77:in `block in run'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.2.1/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/usr/local/rvm/gems/ruby-2.2.1/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `load'
/usr/local/rvm/gems/ruby-2.2.1/bin/cap:23:in `<main>'
/usr/local/rvm/gems/ruby-2.2.1@global/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.1@global/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => production
更新 2: 尽管当我访问我的 Ip 时,上限生产部署已经完成,但 nginx 默认页面仍然存在吗? 有什么建议吗?
您提供的 link 说 capistrano gem 版本应该是 3.1 系列,但您使用的是 capistrano 3.4.0。 在终端 运行 中:bundle clean --force
然后在 Gemfile 中粘贴您提供的 link 中提供的行:
gem 'capistrano', '~> 3.1.0'
# rails specific capistrano funcitons
gem 'capistrano-rails', '~> 1.1.0'
# integrate bundler with capistrano
gem 'capistrano-bundler'
# if you are using RBENV
gem 'capistrano-rbenv', "~> 2.0"
# Use Unicorn as our app server
gem 'unicorn'
然后运行捆绑安装
如果错误仍然存在,请查看我的 link 解释 在 Rails 上使用 Puma 和 Capistrano 将 Ruby 部署到 Digital Ocean 的完整指南:
http://sulmanbaig.com/blog/deploy-on-digitalocean-rails-puma-nginx
对于您的第二个编辑问题,答案是:
在 Capfile 中放入这些行:
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/nginx'
最后删除另外两行并添加以下行:
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
实际上你正在调用 deploy 和 nginx 的任务,但 Capfile 中不需要它们。