capistrano 3:帽子流产了!不知道如何构建任务'deploy:update'

时间:2016-02-28 18:10:20

标签: node.js capistrano3

我正在尝试将node.js应用程序部署到我的远程服务器上 正在运行

    cap staging deploy:setup

我收到错误:

   after "deploy:update", "deploy:cleanup"

默认部署任务应该是所有加载(更新,清理,...)?

这是我的 deploy.rb 文件

    # config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'cockpit-api'
set :scm, :git

set :repository, 'git@gitlab.com:user/myapp.git'
set :branch, "master"
set :deploy_to, '/var/www/myapp'
set :deploy_via, :remote_cache

set :copy_strategy, :checkout
set :keep_releases, 5

set :use_sudo, false
set :copy_compression, :bz2
set :normalize_asset_timestamps, false

set :document_root, "/var/www/myapp"

set :ssh_options, {:forward_agent => true}
set :user, "deploy"

namespace:deploy do

task :start do 
  on primary roles :app do
   run "sudo restart #{application} || sudo start #{application}"
  end
end

task :stop do
  on primary roles :app do
    run "sudo stop #{application}"
  end
end

task :restart do
  on primary roles :app do
    start
  end
end

task :npm_install  do
  on primary roles :app do
    run "cd #{release_path} && npm install"
  end
end

在“deploy:update”之后,“deploy:cleanup”   在“deploy:update_code”,“deploy:npm_install”

之后

和我的 staging.r b

set :stage, :staging
server 'myapp.mydomain.com', user: 'deploy', roles: %w{app}
role :app, "deploy@myapp.mydomain.com"

我的 Capfile 非常简单

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

1 个答案:

答案 0 :(得分:0)

我不确定Node.js通常是如何通过Capistrano 3部署的,但这里有很多错误。例如,Capistrano 3中没有deploy:update这样的东西,也没有deploy:update_code。此外,Capistrano 3没有名为:copy_strategy:copy_compression的设置。

我的猜测是你遵循文档或为Capistrano 2编写的示例并尝试将其添加到Capistrano 3项目中。不幸的是,它不会起作用,因为Capistrano 2和3完全不同且不相容。

我建议搜索明确提到Capistrano 3的Node.js + Capistrano的最新示例。