Question

I am getting following error when i run cap deploy:setup .

ayank@vahuradev:~/dev/SandBox$ cap deploy:setup
cap aborted!
wrong number of arguments (5 for 1..2)
/home/mayank/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/dsl/env.rb:38:in `server'
config/deploy.rb:16:in `<top (required)>'
/home/mayank/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `load'
/home/mayank/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/setup.rb:14:in `block (2 levels) in <top (required)>'
/home/mayank/dev/SandBox/Capfile:26:in `<top (required)>'
/home/mayank/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/application.rb:24:in `load_rakefile'
/home/mayank/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/home/mayank/.rvm/gems/ruby-2.1.0/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/home/mayank/.rvm/gems/ruby-2.1.0/bin/cap:23:in `load'
/home/mayank/.rvm/gems/ruby-2.1.0/bin/cap:23:in `<main>'
/home/mayank/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
/home/mayank/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => production
(See full trace by running task with --trace)

my deploy.rb file is as follows:

#require 'bundler/capistrano'

set :application, "SandBox"
set :repository,  "repo address" => this is correct
set :deploy_to, "/home/vahuadmin/SandBox"
set :scm, :git
set :branch, "master"
set :user, "mayank "
set :group, "deployers"
set :use_sudo, false
set :rails_env, "production"
set :deploy_via, :copy
set :ssh_options, { :forward_agent => true, :port => 4321 }
set :keep_releases, 5
default_run_options[:pty] = true
server "xxx.xx.xx.xx", :app, :web, :db, :primary => true
server "xxx.xx.xx.xx", roles: [:app, :web, :db], :primary => true
namespace :deploy do
  task :start do ; end
  task :stop do ; end

  desc "Symlink shared config files"
  task :symlink_config_files do
    run "#{ sudo } ln -s #{ deploy_to }/shared/config/database.yml #{ current_path }/config/database.yml"
  end

  # NOTE: I don't use this anymore, but this is how I used to do it.
  desc "Precompile assets after deploy"
  task :precompile_assets do
    run <<-CMD
      cd #{ current_path } &&
      #{ sudo } bundle exec rake assets:precompile RAILS_ENV=#{ rails_env }
    CMD
  end

  desc "Restart applicaiton"
  task :restart do
    run "#{ try_sudo } touch #{ File.join(current_path, 'tmp', 'restart.txt') }"
  end
end

after "deploy", "deploy:symlink_config_files"
after "deploy", "deploy:restart"
after "deploy", "deploy:cleanup"

gem included>>>

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"

Any idea why this error is and how to resolve this ..please help!!

Was it helpful?

Solution

The line server "xxx.xx.xx.xx", :app, :web, :db, :primary => true should be

server "xxx.xx.xx.xx", :roles => [:app, :web, :db], :primary => true

You are passing in 5 arguments and it only allows 1 or 2; the server name and an optional hash of options.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top