简体   繁体   中英

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.

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 ?

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. After that make a cap deploy:setup so that updated your shared dir.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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