0

我正在尝试在 Linode 上设置我的 Rails 应用程序,我正处于尝试设置 Capistrano 的阶段。

我在与我部署的服务器相同的服务器上设置了一个 git 服务器。我已经设置了 SSH 密钥(我认为)——至少我可以 SSH 没有问题。

'cap deploy:setup' 和 'cap deploy:check' 都运行没有错误。

但是当我尝试运行'cap deploy:migrations'时,我得到以下信息:

ray@ray-ThinkPad-SL:~/mini-saler$ cap deploy:migrations
  * executing `deploy:migrations'
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@XX.207.243.215:mini-saler.git master"
    command finished in 12446ms
  * executing "if [ -d /home/railsu/bianbian.com/shared/cached-copy ]; then cd /home/railsu/bianbian.com/shared/cached-copy && git fetch  origin && git fetch --tags  origin && git reset  --hard 8e8aa8f849a9438851a3767b338ab711d6470299 && git clean  -d -x -f; else git clone git@XX.207.243.215:mini-saler.git /home/railsu/bianbian.com/shared/cached-copy && cd /home/railsu/bianbian.com/shared/cached-copy && git checkout -b deploy 8e8aa8f849a9438851a3767b338ab711d6470299; fi"
    servers: ["XX.207.243.215"]
    [XX.207.243.215] executing command
 ** [XX.207.243.215 :: out] Cloning into /home/railsu/bianbian.com/shared/cached-copy...
 ** [XX.207.243.215 :: err] Host key verification failed.
 ** [XX.207.243.215 :: err] fatal: The remote end hung up unexpectedly
    command finished in 2009ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.3' -c 'if [ -d /home/railsu/bianbian.com/shared/cached-copy ]; then cd /home/railsu/bianbian.com/shared/cached-copy && git fetch  origin && git fetch --tags  origin && git reset  --hard 8e8aa8f849a9438851a3767b338ab711d6470299 && git clean  -d -x -f; else git clone git@XX.207.243.215:mini-saler.git /home/railsu/bianbian.com/shared/cached-copy && cd /home/railsu/bianbian.com/shared/cached-copy && git checkout -b deploy 8e8aa8f849a9438851a3767b338ab711d6470299; fi'" on XX.207.243.215

部署.rb

set :user, 'railsu'
set :domain, 'XX.207.243.215'
set :application, 'mini-saler'
# adjust if you are using RVM, remove if you are not
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.3'
set :rvm_type, :user
# file paths
set :repository, "git@#{domain}:mini-saler.git"
set :deploy_to, "/home/railsu/bianbian.com"
# distribute your applications across servers (the instructions below put them
# all on the same server, defined above as 'domain', adjust as necessary)
role :app, domain
role :web, domain
role :db, domain, :primary => true


# miscellaneous options
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
set :rails_env, :production

namespace :deploy do
  desc "cause Passenger to initiate a restart"
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end
  desc "reload the database with seed data"
  task :seed do
    run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}"
  end
end

after "deploy:update_code", :bundle_install
desc "install the necessary prerequisites"
task :bundle_install, :roles => :app do
  run "cd #{release_path} && bundle install"
end

我可以使用 ssh 连接我的 vps。

4

1 回答 1

2

我不记得是否调用了任何 git 命令,cap deploy:setup或者cap deploy:check- 我认为没有。

假设您使用的是 gitolite,请检查以确保您的配置有您的railsu用户的公钥在keydir目录中。

或者也许代理转发是您想要的? 使用 Capistrano 进行部署可以帮助您。

于 2012-10-18T14:52:31.047 回答