我在使用Moonshine和Capistrano設置新服務器時遇到問題。這似乎上手相當好,安裝了一堆Ubuntu的軟件包,編譯REE,安裝一些寶石,但隨後未能通過SFTP上傳文件的輸出:爲什麼Moonshine/Capistrano在部署過程中遇到SFTP問題:setup?
* executing `moonshine:setup_directories'
* executing "mkdir /tmp/moonshine"
servers: ["myserver.tld"]
[myserver.tld] executing command
command finished
servers: ["myserver.tld"]
** sftp upload /Users/arussell/Sites/mysite/config/moonshine/production.yml -> /tmp/moonshine/production.yml
/Users/arussell/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:196:in `normalize': undefined method `pos' for #<Pathname:0x10f3a6988> (NoMethodError)
from /Users/arussell/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:104:in `prepare_transfers'
谷歌搜索的錯誤是不是真的轉了很多,我能想出的是,capistrano/transfer.rb期望196行以外的PathName對象,但我不確定它期望的是什麼,我也不確定爲什麼它被送入PathName對象。
編輯:這裏是我的deploy.rb:
set :stages, %w(staging production dev)
set :default_stage, "staging"
require 'capistrano/ext/multistage' rescue "YOU NEED TO INSTALL THE capistrano-ext GEM"
require 'fileutils'
if ENV['branch']
set :branch, ENV['branch']
end
set :deploy_via, :remote_cache
before "deploy:restart", "deploy:delete_cache"
namespace(:deploy) do
desc "delete cache"
task :delete_cache do
run "rm -rf /usr/local/shared/cache/"
end
task :null, :roles => :app do
run "date"
end
end
require './config/boot'
...和我的部署/ production.rb:
server "myserver.tld", :app, :web, :db, :primary => true
set :rails_env, 'production'
編輯2:我嘗試使用SCP而不是SFTP,但這並沒有更好。我將此添加到我的部署/ production.rb:
upload "local", "remote", :via => :scp
download "remote", "local", :via => :scp
,並得到這個錯誤,而不是試圖部署:
upload via scp failed on myserver.tld: SCP did not finish successfully() (SCP did not finish successfully())
不錯,但將Capistrano更新爲2.9。 0沒有幫助:我仍然看到相同的錯誤。我已經編輯了這個問題來添加config/deploy.rb和config/deploy/production.rb的清理版本。 –