2015-11-17 122 views
0

我已經繼承了一個Rails項目,我無法使用Capistrano提供的說明部署它。我根本不熟悉capistrano。Capistrano 3.4部署問題

無論我嘗試,我總是收到以下錯誤消息

(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{[email protected]**.**.**.**:****} 
role :web, %w{[email protected]**.**.**.**:****} 
role :db, %w{[email protected]**.**.**.**:****} 

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 

請幫幫忙!

+0

您是否嘗試過運行'cap production deploy'(從應用程序根目錄)? – martincarlin87

+0

是的,謝謝。我犯了同樣的錯誤。 – 32423hjh32423

回答

1

您可以通過以下得到該錯誤回溯:

bundle exec cap --backtrace -T 

這會給你更多的信息。可能這是您的配置中的語法錯誤。