6
我想爲我的網站安裝Capistrano部署,我已經部署工作,所有身份驗證都很好,但是我用Media temple託管,所以默認的符號鏈接不會工作,因爲Apache不會可以訪問爲最新版本指定的路徑。Capistrano創建任務來改變當前的符號鏈接
我試圖做一個任務,將取消鏈接當前的符號鏈接,然後重新創建一個相對路徑,但Capistrano文檔嚴重缺乏,我無法找到任何設置如何正確的任何更多的信息。
我嘗試過使用sh,但似乎在我的計算機上而不是在服務器上運行命令,找不到運行命令,並且我嘗試執行但找不到正確的格式來執行rm或ln之類的操作等等......
目前我正嘗試以下操作:
namespace :deploy do
desc "Change HTML Symlink to relative path"
task :create_symlink do
#latest_release_relative = relative_path(deploy_to, release_path + '/html')
#sh "rm -f #{current_path} && ln -s #{latest_release_relative} #{current_path}"
#sh "echo #{File.basename release_path}"
info "echo Modifying symlink to be relative"
#run "rm -d #{current_path}"
#run "ln releases/#{File.basename release_path} #{current_path}"
#execute :rm, '-d', #{current_path}
end
desc "Create environment file"
task :create_env_conf
file 'env.conf' do |t|
sh "touch env.conf"
end
end
after :deploy, "deploy:create_symlink", "deploy:create_env_conf"
你介意發佈解決這個問題的代碼嗎?我有同樣的問題。 – bigsweater
@bigsweater我已經添加了什麼爲我工作... –
謝謝!我最終只是覆蓋默認的符號鏈接函數,以便資產和目錄都被更新。我可能能夠使用你的任務,但使覆蓋更模塊化... https://gist.github.com/bigsweater/9307075 – bigsweater