1

I am trying to deploy my app to ubuntu server but I am getting error. I have added my key in server authorized keys.I am using Google computer server for server purpose.I am unable to find any solution all solutions leads to authorization key in server ssh folder and I have already added that. Does anyone faced same problem? here is a code:

Ayazs-MBP:peatio_exchange ayaz$ cap production deploy
00:00 rbenv:validate
      rbenv: rbenv_ruby is not set; ruby version will be defined by the remote …
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@35.190.186.40: Authentication failed for user deploy@35.190.186.40


Caused by:
Net::SSH::AuthenticationFailed: Authentication failed for user deploy@35.190.186.40

Tasks: TOP => rbenv:map_bins => passenger:rbenv:hook => passenger:test_which_passenger
(See full trace by running task with --trace)
Ayazs-MBP:peatio_exchange ayaz$ 

My gems are

group :development do
    gem 'capistrano',         require: false
    gem 'capistrano-rvm',     require: false
    gem 'capistrano-rails',   require: false
    gem 'capistrano-bundler', require: false
    gem 'capistrano3-puma',   require: false
    gem 'capistrano-passenger'
    gem 'capistrano-rbenv', '~> 2.0', require: false
  end

cap file is

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

# Include default deployment tasks
require "capistrano/deploy"

# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#   https://github.com/capistrano/passenger
#
require "capistrano/rails"
# require "capistrano/rvm"
require "capistrano/rbenv"
# require "capistrano/chruby"
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
require "capistrano/passenger"

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

Deploy.rb

lock "~> 3.10.1"

set :application, "peatio_exchange"
set :repo_url, "https://github.com/ayazahmadtarar/peatio_exchange.git"

Production.rb

server "35.190.186.40",
  user: "deploy",
  roles: %w{web app},
  ssh_options: {
    user: "deploy", # overrides user setting above
    keys: %w(/home/deploy/.ssh/id_rsa),
    forward_agent: false,
    auth_methods: %w(publickey password)
    # password: "please use keys"
  }
Ayaz Ahmad Tarar
  • 534
  • 8
  • 24

1 Answers1

1

It could be a number of things, but from the looks of it the public key you presumably added isn't for the deploy user. Ensure that it exists in /home/deploy/.ssh (or whatever its home directory is)

Make sure you're able to log in to the server with ssh deploy@35.190.186.40 — if you generated a separate key for your deploy user you can use the -i flag to specify the path to the keyfile.

ssh -i ~/Desktop/deploy_id_rsa.pub deploy@35.190.186.40

Josh Brody
  • 5,153
  • 1
  • 14
  • 25