【问题标题】:Capistrano 3.4 Deployment ProblemsCapistrano 3.4 部署问题
【发布时间】:2015-11-17 16:56:23
【问题描述】:

我继承了一个 Rails 项目,但无法使用 Capistrano 提供的说明部署它。我对 capistrano 一点也不熟悉。

无论我尝试什么,我总是收到以下错误消息

(Backtrace restricted to imported tasks)
cap aborted!
ArgumentError: wrong number of arguments (1 for 2)

Tasks: TOP => production
(See full trace by running task with --trace)

这包括

$ bundle exec cap -T

$ bundle exec cap production deploy

我正在按照这里的指南https://github.com/capistrano/capistrano

我已将重要信息加注星标,但这里是 config/deploy/staging.rb 的副本

role :app, %w{deploy@**.**.**.**:****}
role :web, %w{deploy@**.**.**.**:****}
role :db,  %w{deploy@**.**.**.**:****}

set :branch, 'develop'
set :deploy_to, '/var/www/soreen.staged.ws'

set :ssh_options, {
  keepalive: true,
  keepalive_interval: 60 #seconds
}

这里是 Capfile

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

require 'capistrano/rbenv'
require 'capistrano/bundler'
require 'capistrano/rails/migrations' 
require 'capistrano/rails/assets'
require 'capistrano/rails/collection'

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

这里是 config/deploy.rb

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

set :application, 'Soreen'
set :repo_url => "****************" 

set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

set :rbenv_type, :user # or :system, depends on your rbenv setup
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}
set :rbenv_roles, :all # default value

namespace :deploy do

  desc 'Restart application'
  task :restart do
on roles(:app), in: :sequence, wait: 5 do
      # Your restart mechanism here, for example:
      execute :mkdir, '-p', "#{ release_path }/tmp"
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  after :publishing, :restart

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do

    end
  end

end

请帮忙!

【问题讨论】:

  • 你试过只运行cap production deploy(从应用根目录)吗?
  • 好的,谢谢。我得到同样的错误。

标签: ruby-on-rails-4 capistrano


【解决方案1】:

您可以使用以下方法获取错误的回溯:

bundle exec cap --backtrace -T

这将为您提供更多信息。这可能是您的配置中的语法错误。

【讨论】:

    猜你喜欢
    • 2014-07-07
    • 2014-05-30
    • 1970-01-01
    • 2014-02-24
    • 2011-05-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多