Chakreshwar Sharma
Chakreshwar Sharma

Reputation: 2610

Error in Capistrano deployment in localhost

I am deploying my application on localhost using capistrano , but getting the below error:

INFO [5f197b14] Running /usr/bin/env mkdir -p /tmp/promo_app/ as chakreshwar@localhost DEBUG [5f197b14] Command: /usr/bin/env mkdir -p /tmp/promo_app/ (Backtrace restricted to imported tasks) cap aborted! Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:22

I am using the below gem for capistrano

gem 'capistrano'
gem 'capistrano-ext'

Below is the code of Deploy.rb

# config valid only for current version of Capistrano
lock '3.4.0'
 set :application, 'my_app'
set :repo_url, '/home/test/git_server/test_app.git'

set :deploy_to, '/home/test/projects/capistrano_deployment/my_app'

set :scm, :git

set :format, :pretty

# Default value for :pty is false
set :pty, true

set :default_stage, "staging"

namespace :deploy do

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

    end
  end

end

Below is my staging.rb:

    server 'localhost', user: 'username', roles: %w{app db web}#   


:other_value
    role :app, %w{localhost}#, my_property: :my_value
    role :web, %w{localhost}#, other_property: :other_value
    role :db,  %w{localhost}

Please tell if anything missed in it .

Upvotes: 1

Views: 1762

Answers (2)

Bruno Peres
Bruno Peres

Reputation: 3256

Maybe you're missing an SSH server to connect on your on machine because you only have the client.

If you can't do ssh 127.0.0.1, use:

sudo apt-get install openssh-server

To install the ssh server

Upvotes: 0

will_in_wi
will_in_wi

Reputation: 2653

The error indicates that you cannot SSH to the destination box, in this case localhost. Try ssh 127.0.0.1, and make sure that works. The deployment should execute once that works.

In regards to your general config, a couple of notes:

  • The capistrano-ext gem is obsolete, you can remove that.
  • In staging.rb, you have duplicate directives. You should probably remove the lines beginning with role in favor of the line beginning with server.
  • In staging.rb, make sure that username: is set to the SSH user with which you will log in.

Good luck!

Upvotes: 0

Related Questions