本文介绍了Capistrano和Carrierwave的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Capistrano部署一个Ruby on Rails和NodeJS应用程序。每次部署时都会删除uploads文件夹。



这几个地方弹出,但似乎不起作用:

 #保存文件上传
任务:symlink_uploads do
运行ln -nfs#{shared_pa​​th} / rails / uploads#{release_path} / rails / public /


部署后:update_code,部署:symlink_uploads

回购:

  repo:
/ node
/ rails

谢谢!

解决方案>

确保删除现有的公开/上传文件夹,将 -f 传递到 ln 不覆盖删除目标目录(或者至少还没有为我这样做)



我的符号链接目录任务通常看起来像



运行rm -rf#{release_path} / rails / public / uploads}& ln -nfs#{shared_pa​​th} / rails / uplo ads#{release_path} / rails / public / uploads
end

显然要确保那里在您需要的公开/上传的签到版本中是没有的!


I'm deploying a Ruby on Rails and NodeJS application using Capistrano. The uploads folder gets removed on every deploy.

This popped up on several places but it doesn't seem to work:

# Keep File Uploads
  task :symlink_uploads do
    run "ln -nfs #{shared_path}/rails/uploads  #{release_path}/rails/public/uploads"
  end

  after 'deploy:update_code', 'deploy:symlink_uploads'

the repo:

  repo:
    /node
    /rails

Thanks!

解决方案

Make sure you remove the existing public/uploads folder, passing -f to ln doesn't cover removing target directories (or at least hasn't done so portably for me)

My symlink directories tasks normally look like

task :symlink_uploads do
  run "rm -rf #{release_path}/rails/public/uploads} && ln -nfs #{shared_path}/rails/uploads  #{release_path}/rails/public/uploads"
end

Obviously make sure there is nothing in the checked in version of public/uploads that you need!

这篇关于Capistrano和Carrierwave的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 07:46