help on the basics (git ls-remote failing)

153 views
Skip to first unread message

okram

unread,
Apr 21, 2015, 4:08:12 PM4/21/15
to capis...@googlegroups.com
i just started my test  of using cap2, i was depending on a Chef resource called "deploy_revision". The cap testing deploy:check looks all okay. But when i try to perform a deploy, i got this authentication failure. I can go in to the server, su to the user for deployment and perform the same command successfully. But it appears to me that capistrano is trying to test the authentication from my local work station to the repo. The repo is not a github repository. i tried by adding the private rsa key for the user on the ssh-agent but it still fails. Please suggest.  






Versions:
  • Ruby -- Ruby-2.1.1
  • Capistrano v2.15.5
Platform:
  • Working on.... ubuntu 12 precise
  • Deploying to... RHEL 6.6
Logs:
  • Please past logs (as completely as possible to a 3rd party pasting service such as pastie.org)

Test :

± |master ✓| → cap testing deploy:check

ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly

* 2015-04-21 12:05:49 executing `testing'

ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly

triggering start callbacks for `deploy:check'

* 2015-04-21 12:05:51 executing `multistage:ensure'

* 2015-04-21 12:05:51 executing `deploy:check'

* executing multiple commands in parallel

-> "else" :: "test -d /opt/mount1/oss/releases"

-> "else" :: "test -d /opt/mount1/oss/releases"

servers: ["serv1", "serv2"]

[serv2] executing command

[serv1] executing command

command finished in 465ms

* executing multiple commands in parallel

-> "else" :: "test -w /opt/mount1/oss"

-> "else" :: "test -w /opt/mount1/oss"

servers: ["serv1", "serv2"]

[serv1] executing command

[serv2] executing command

command finished in 551ms

* executing multiple commands in parallel

-> "else" :: "test -w /opt/mount1/oss/releases"

-> "else" :: "test -w /opt/mount1/oss/releases"

servers: ["serv1", "serv2"]

[serv2] executing command

[serv1] executing command

command finished in 453ms

* executing multiple commands in parallel

-> "else" :: "which git"

-> "else" :: "which git"

servers: ["serv1", "serv2"]

[serv1] executing command

[serv2] executing command

command finished in 562ms

* executing multiple commands in parallel

-> "else" :: "which rsync"

-> "else" :: "which rsync"

servers: ["serv1", "serv2"]

[serv2] executing command

[serv1] executing command

command finished in 456ms

* executing multiple commands in parallel

-> "else" :: "test -w /opt/mount1/oss/shared"

-> "else" :: "test -w /opt/mount1/oss/shared"

servers: ["serv1", "serv2"]

[serv1] executing command

[serv2] executing command

command finished in 547ms

You appear to have all necessary dependencies installed 






While deploying- 

± |master ✓| → cap testing deploy

ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly

* 2015-04-21 11:40:46 executing `testing'

ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly

triggering start callbacks for `deploy'

* 2015-04-21 11:40:48 executing `multistage:ensure'

* 2015-04-21 11:40:48 executing `deploy'

triggering before callbacks for `deploy'

* 2015-04-21 11:40:48 executing `deploy:stop_app'

* executing multiple commands in parallel

-> "else" :: "sudo /etc/init.d/oss stop"

-> "else" :: "sudo /etc/init.d/oss stop"

servers: ["serv1", "serv2"]

[serv2] executing command

[serv1] executing command

** [out :: serv1] Stopping

** [out :: serv1] cat: /var/run/oss.pid: No such file or directory

** [out :: serv1] pidfile not found

** [out :: serv2] Stopping

** [out :: serv2] cat: /var/run/oss.pid: No such file or directory

** [out :: serv2] pidfile not found

command finished in 604ms

* 2015-04-21 11:40:50 executing `deploy:update'

** transaction: start

* 2015-04-21 11:40:50 executing `deploy:update_code'

updating the cached checkout on all servers

executing locally: "git ls-remote ssh://repo...@privaterepo.com:29418/abc-oss test"

Received disconnect from 16.216.191.171: 2: Too may authentication failures

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

*** [deploy:update_code] rolling back

DO NOT WANT TO ROLL BACK?

Command git ls-remote ssh://repo...@privaterepo.com:29418/abc-oss test returned status code pid 15621 exit 128 









Files:
  • Capfile
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
    # Uncomment if you are using Rails' asset pipeline
      # load 'deploy/assets'
        Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
          load 'config/deploy' # remove this line to skip loading any of the default tasks

          • deploy.rb

          require 'capistrano/chef'

          require "capistrano/ext/multistage"


          set :application, "oss"

          set :repository, 'ssh://repo...@privaterepo.com:29418/abc-oss'

          :user, 'python'


          set :deploy_via, :remote_cache


          set :deploy_to, '/opt/mount1/oss'

          set :scm, :git


          set :copy_exclude, [".git", ".gitignore"]


          set :scm_verbose, true

          ssh_options[:paranoid] = false

          default_run_options[:pty] = true



          # set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names

          # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`


          before "deploy", "deploy:stop_app"


          after "deploy", "deploy:start_app"


          namespace :deploy do

          task :update_code, :roles => :web, :except => { :no_release => true } do

          on_rollback { puts "DO NOT WANT TO ROLL BACK?" }

          strategy.deploy!

          finalize_update

          end


          task :stop_app, :roles => :web do

          run "sudo /etc/init.d/oss stop", :shell => :bash

          end


          task :start_app, :roles => :web do

          run "sudo /etc/init.d/oss start", :shell => :bash

          end


          task :restart_app, :roles => :web do

          run "sudo /etc/init.d/oss restart", :shell => :bash

          end

          end



          • Stage files 
          testing.rb
            require 'capistrano/chef'

                set :stage, :test
                  set :deploy_env, 'test'
                    set :branch, 'test'
                      chef_env = `knife block | grep 'Currently Selected'`.strip
                      raise "Deploy env #{fetch(:stage).to_s} does not match chef #{chef_env}" unless chef_env.include? fetch(:stage).to_s
                        chef_role :web, "role:oss", :attribute => Proc.new { |n| n["name"] || n.name}





                        --------









                        okram

                        unread,
                        Apr 21, 2015, 4:15:53 PM4/21/15
                        to capis...@googlegroups.com
                        Going through this \



                        some other online doc above, capistrano 2, it appears to be a design of cap2 to perform the git status on the local workstation as well. Is there a way to override this setting and make the git commands to run only on the server?

                        executing locally: "git ls-remote ssh://repouser@privaterepo.com:29418/abc-oss test"

                        Received disconnect from 16.216.191.171: 2: Too may authentication failures

                        fatal: Could not read from remote repository.

                        Please make sure you have the correct access rights

                        and the repository exists.

                        *** [deploy:update_code] rolling back

                        DO NOT WANT TO ROLL BACK?

                        Command git ls-remote ssh://repouser@privaterepo.com:29418/abc-oss test returned status code pid 15621 exit 128 









                        Files:
                        • Capfile
                        load 'deploy' if respond_to?(:namespace) # cap2 differentiator
                          # Uncomment if you are using Rails' asset pipeline
                            # load 'deploy/assets'
                              Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
                                load 'config/deploy' # remove this line to skip loading any of the default tasks

                                • deploy.rb

                                require 'capistrano/chef'

                                require "capistrano/ext/multistage"


                                set :application, "oss"

                                okram

                                unread,
                                Apr 21, 2015, 4:49:39 PM4/21/15
                                to capis...@googlegroups.com
                                To understand the issue, i went and tried to perform a git clone using the deploy_user as below on my development machine. 


                                this returned :  Too may authentication failures. fatal: Could not read from remote repository.

                                I appended the ~/.ssh/config file like so, with no luck.


                                    HostName privaterepo.com
                                    User repouser
                                    IdentityFile ~/keys/github/some_name.rsa
                                Host *
                                    StrictHostKeyChecking no


                                I see a bunch of keys loaded on my ssh-agent when i do a 'ssh-add -l', is it possible that the authentication failed below it tries with the right key? 






                                On Tuesday, April 21, 2015 at 1:08:12 PM UTC-7, okram wrote:

                                executing locally: "git ls-remote ssh://repouser@privaterepo.com:29418/abc-oss test"

                                Received disconnect from 16.216.191.171: 2: Too may authentication failures

                                fatal: Could not read from remote repository.

                                Please make sure you have the correct access rights

                                and the repository exists.

                                *** [deploy:update_code] rolling back

                                DO NOT WANT TO ROLL BACK?

                                Command git ls-remote ssh://repouser@privaterepo.com:29418/abc-oss test returned status code pid 15621 exit 128 









                                Files:
                                • Capfile
                                load 'deploy' if respond_to?(:namespace) # cap2 differentiator
                                  # Uncomment if you are using Rails' asset pipeline
                                    # load 'deploy/assets'
                                      Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
                                        load 'config/deploy' # remove this line to skip loading any of the default tasks

                                        • deploy.rb

                                        require 'capistrano/chef'

                                        require "capistrano/ext/multistage"


                                        set :application, "oss"

                                        okram

                                        unread,
                                        Apr 21, 2015, 5:01:05 PM4/21/15
                                        to capis...@googlegroups.com
                                        The solution was to set the SSH "IdentitiesOnly" config option to "yes" in the '~/.ssh/config' file which tell the local SSH client to only send just that one IdentityFile and no others.

                                            HostName privaterepo.com
                                            User repouser
                                            IdentityFile ~/keys/github/some_name.rsa
                                            IdentitiesOnly  yes
                                        Host *
                                            StrictHostKeyChecking no



                                        On Tuesday, April 21, 2015 at 1:08:12 PM UTC-7, okram wrote:

                                        executing locally: "git ls-remote ssh://repouser@privaterepo.com:29418/abc-oss test"

                                        Received disconnect from 16.216.191.171: 2: Too may authentication failures

                                        fatal: Could not read from remote repository.

                                        Please make sure you have the correct access rights

                                        and the repository exists.

                                        *** [deploy:update_code] rolling back

                                        DO NOT WANT TO ROLL BACK?

                                        Command git ls-remote ssh://repouser@privaterepo.com:29418/abc-oss test returned status code pid 15621 exit 128 









                                        Files:
                                        • Capfile
                                        load 'deploy' if respond_to?(:namespace) # cap2 differentiator
                                          # Uncomment if you are using Rails' asset pipeline
                                            # load 'deploy/assets'
                                              Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
                                                load 'config/deploy' # remove this line to skip loading any of the default tasks

                                                • deploy.rb

                                                require 'capistrano/chef'

                                                require "capistrano/ext/multistage"


                                                set :application, "oss"

                                                Reply all
                                                Reply to author
                                                Forward
                                                0 new messages