简体   繁体   English

Capistrano部署配方以符号链接Ruby on Rails文件夹public / images,不起作用

[英]Capistrano Deploy recipe to symlink Ruby on Rails folder public/images, not working

Every time I upload images it goes to public/images/upload then when I run a cap deploy they get erased since it creates a new current directory. 每次我上传图像时,它都会进入public / images / upload,然后在运行cap部署时会被删除,因为它会创建一个新的当前目录。

How do I instruct Capistrano to move the files in public/images/upload to the shared/images/ then symlink those images to the current(new) release ? 如何指示Capistrano将public / images / upload中的文件移动到shared / images /,然后将这些图像符号链接到当前(新)版本?

after "deploy:update_code", "deploy:symlink_shared"
after "deploy:restart", "deploy:cleanup"

    namespace :deploy do
      task :restart do
        run "touch #{current_path}/tmp/restart.txt"
      end

      desc "Symlink shared configs and folders on each release."
      task :symlink_shared do
        run "ln -nfs #{shared_path}/images/upload #{release_path}/public/images/uploads"
      end
    end

Have try to expand shared directory list? 有尝试扩展共享目录列表吗?

#deploy.rb
set :shared_children, shared_children + %w{public/images/uploads}

Edit : Remove you code and set shared_children variable. 编辑 :删除您的代码,并设置shared_children变量。 After that make a cap deploy:setup so that updated your shared dir. 之后,进行cap deploy:setup ,以更新您的共享目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM