我必须在服务器出现问题后部署rails应用程序,并且IP地址已更改。
我已将deploy / production.rb中的IP地址以及git的远程分支更新为正确的值,即192.168.30.24,但正如您从以下输出中所看到的,由于尝试通过192.168.30.23连接,部署失败。
Capistrano从哪里检索192.168.30.23?
INFO [fa83a838] Running /usr/bin/env git remote update as code@192.168.30.24
DEBUG [fa83a838] Command: cd /var/www/paperless_office/repo && ( export RBENV_ROOT="~/.rbenv" RBENV_VERSION="2.3.0" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/paperless_office/git-ssh.sh" ; /usr/bin/env git remote update )
DEBUG [fa83a838] Fetching origin
DEBUG [fa83a838] ssh: connect to host 192.168.30.23 port 22: No route to host
Capfile
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
production.rb如下:
role :app, %w{192.168.30.24}
role :web, %w{192.168.30.24}
role :db, %w{192.168.30.24}
server '192.168.30.24', user: 'code', roles: %w{web app}
after 'deploy:publishing', 'deploy:restart'
由于
答案 0 :(得分:0)
通过删除Capistrano构建的远程仓库来解决此问题,以便在下次部署时使用正确的IP地址重建它。
我正在部署到/ var / www / app_name,因此要删除的repo是/ var / www / app_name / repo