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