【问题标题】:Capistrano Trying to Deploy to Old IP AddressCapistrano 尝试部署到旧 IP 地址
【发布时间】:2018-08-18 00:46:10
【问题描述】:

我正在尝试部署到我们的新生产服务器。 Capistrano SSH 到服务器的工作正常,但终端输出中列出的 IP 地址是我们不再使用的 IP,并且不在我们的 Rails 安装中(我们迭代了所有文件)。

如何让 Capistrano 停止尝试访问此 IP?它甚至来自哪里?是否存在可以保存此地址的 Capistrano 缓存?

终端输出

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as vadmin@15.1.153.247: Net::SSH::ConnectionTimeout

Caused by:
Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout

Tasks: TOP => rvm:hook => passenger:rvm:hook => passenger:test_which_passenger

Capistrano 日志输出

  INFO START 2018-08-17 18:20:21 -0600 cap production doctor
  INFO ---------------------------------------------------------------------------
 DEBUG [0244ff8e] Running /usr/bin/env which passenger as vadmin@15.153.1.30
 DEBUG [e9aebdc9] Running /usr/bin/env which passenger as vadmin@15.1.153.247
 DEBUG [0244ff8e] Command: ( export RVM_BIN_PATH="~/.rvm/bin" ; /usr/bin/env which passenger )
 DEBUG [e9aebdc9] Command: ( export RVM_BIN_PATH="~/.rvm/bin" ; /usr/bin/env which passenger )

deploy.rb

# config valid for current version and patch releases of Capistrano
lock "~> 3.10.0"

set :application, "<omitted>"
set :repo_url, "ssh://<omitted>"

# 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, "/home/vadmin/<omitted>"

# Default value for :format is :airbrussh.
# set :format, :airbrussh

# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto

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

# Default value for :linked_files is []
append :linked_files, "config/database.yml", "config/secrets.yml"

# Default value for linked_dirs is []
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads'

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
set :default_env, { rvm_bin_path: '~/.rvm/bin' }

# Default value for local_user is ENV['USER']
# set :local_user, -> { `git config user.name`.chomp }

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

# set migration role to :app instead of :db
set :migration_role, :app

# Uncomment the following to require manually verifying the host key before first deploy.
# set :ssh_options, verify_host_key: :secure

production.rb

# server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:

server "15.153.1.30", user: "vadmin", roles: %w{app db web}
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
# server "db.example.com", user: "deploy", roles: %w{db}

set :stage, :production

# role-based syntax
# ==================

# Defines a role with one or multiple servers. The primary server in each
# group is considered to be the first unless any hosts have the primary
# property set. Specify the username and a domain or IP for the server.
# Don't use `:all`, it's a meta role.

# role :app, %w{deploy@example.com}, my_property: :my_value
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
# role :db,  %w{deploy@example.com}



# Configuration
# =============
# You can set any configuration variable like in config/deploy.rb
# These variables are then only loaded and set in this stage.
# For available Capistrano configuration variables see the documentation page.
# http://capistranorb.com/documentation/getting-started/configuration/
# Feel free to add new variables to customise your setup.



# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult the Net::SSH documentation.
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
#
# Global options
# --------------
#  set :ssh_options, {
#    keys: %w(/home/rlisowski/.ssh/id_rsa),
#    forward_agent: false,
#    auth_methods: %w(password)
#  }
#
# The server-based syntax can be used to override options:
# ------------------------------------
# server "example.com",
#   user: "user_name",
#   roles: %w{web app},
#   ssh_options: {
#     user: "user_name", # overrides user setting above
#     keys: %w(/home/user_name/.ssh/id_rsa),
#     forward_agent: false,
#     auth_methods: %w(publickey password)
#     # password: "please use keys"
#   }

宝石

  gem 'capistrano', '~> 3.10'
  gem 'capistrano-rails', '~> 1.3'
  gem 'capistrano-rvm'
  gem 'capistrano-passenger'

【问题讨论】:

    标签: ruby-on-rails capistrano capistrano3


    【解决方案1】:

    您需要在您的服务器cached_repo 中查找此目录并将其删除。该目录将在下一次部署中创建。

    在 capistrano 3 中

    你应该删除这个$deploy_to/repo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多