gpt4 book ai didi

ruby-on-rails - 上限生产部署错误 Net::SSH::AuthenticationFailed: 身份验证失败

转载 作者:行者123 更新时间:2023-12-03 15:32:22 25 4
gpt4 key购买 nike

http://www.sitepoint.com/deploy-your-rails-app-to-aws/

我一直在按照本教程将我的 Rails 应用程序部署到 Amazon EC2,直到最后它告诉我这样做:

cap production deploy

当我将它输入到我的代码所在的文件夹中时,我收到了这个错误:

** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
DEBUG [be2a201f] Running ~/.rvm/bin/rvm version as deploy@54.152.90.79
DEBUG [be2a201f] Command: ~/.rvm/bin/rvm version
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@54.152.90.79: Authentication failed for user deploy@54.152.90.79
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Net::SSH::AuthenticationFailed: Authentication failed for user deploy@54.152.90.79
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/net-ssh-3.0.1/lib/net/ssh.rb:239:in `start'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:187:in `with_ssh'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:137:in `block in _execute'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:77:in `capture'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block (3 levels) in <top (required)>'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/Minling/.rvm/gems/ruby-2.2.1/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'

我认为我正确地遵循了教程中的所有内容。这是我第一次使用 EC2,我应该如何解决这个问题?


这是我的 deploy.rb 文件

# config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'studentdiscount'
set :repo_url, 'git@github.com:minling/StudentDiscount.git'
set :branch, :master
set :deploy_to, '/home/deploy/studentdiscount'
set :pty, true
set :linked_files, %w{config/database.yml config/application.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
set :keep_releases, 5
set :rvm_type, :user
set :rvm_ruby_version, 'jruby-1.7.19' # Edit this if you are using MRI Ruby

set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock" #accept array for multi-bind
set :puma_conf, "#{shared_path}/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_error.log"
set :puma_error_log, "#{shared_path}/log/puma_access.log"
set :puma_role, :app
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
set :puma_threads, [0, 8]
set :puma_workers, 0
set :puma_worker_timeout, nil
set :puma_init_active_record, true
set :puma_preload_app, false
set :ssh_options, { user: 'deploy', keys: %w(~/.ssh/student-discount-ec2.pem), forward_agent: true }
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp

# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, '/var/www/my_app_name'

# Default value for :scm is :git
# set :scm, :git

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
# set :log_level, :debug

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

# Default value for :linked_files is []
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')

# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
# set :keep_releases, 5

namespace :deploy do

after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end

这部分我有点困惑:(但不是我认为的错误原因,因为我因为身份验证错误而遇到这个问题?)

set :rvm_ruby_version, 'jruby-1.7.19' # Edit this if you are using MRI Ruby

我没有使用 jruby,我应该放什么?如何找到 MRI 版本?

最佳答案

我有同样的错误。我通过这样做解决了它:

ssh-add ~/.ssh/student-discount-ec2.pem

关于ruby-on-rails - 上限生产部署错误 Net::SSH::AuthenticationFailed: 身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33909558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com