在使用符号链接的capistrano部署后,回形针图像消失

时间:2014-06-06 16:52:41

标签: ruby-on-rails paperclip capistrano spree

我在疯狂商业项目中的回形针图片在capstrano部署后消失了。我尝试在deploy.rb文件中对它们进行符号链接但是可能有错误吗?无论如何,我已经在这一整天了。我觉得符号链接应该足够了。我还打电话给build_missing_paperclip_styles。

来自狂欢的

image.rb:

has_attached_file :attachment,
                      default_url: ':rails_root/public/missing.png',
                      styles: { mini: '80x80>', small: '100x100>', product: '640x640>', large: '640x640>' },
                      default_style: :product,
                      url: '/spree/products/:id/:style/:basename.:extension',
                      path: ':rails_root/public/spree/products/:id/:style/:basename.:extension',
                      convert_options: { all: '-strip -auto-orient -colorspace sRGB' }

deploy.rb:

 namespace :deploy do
   task :start do ; end
   task :stop do ; end
   task :restart, :roles => :app, :except => { :no_release => true } do
     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
   end
    desc "build missing paperclip styles"

  task :build_missing_paperclip_styles, :roles=> :app do
      run "cd #{current_path}; RAILS_ENV=production bundle exec rake paperclip:refresh:missing_styles"
    end

  task :saveme, :roles => :app do
    run "rm -rf #{release_path}/public/spree && mkdir -p #{ deploy_to }/shared/spree"
    run "ln -nfs #{shared_path}/spree #{release_path}/public/spree"
  end
 end


after "deploy:finalize_update", "deploy:saveme"
after "deploy", "deploy:build_missing_paperclip_styles"
after "deploy", "deploy:restart"
after "deploy:restart", "deploy:cleanup"

任何想法? - 在新部署到生产后,pics就会消失

使用capistrano进行部署时,命令肯定会执行:

* 2014-06-05 23:21:26 executing `deploy:saveme'
  * executing "rm -rf /home/deploy/releases/20140605211204/public/spree && mkdir -p /home/deploy/shared/spree"
    servers: []
    [] executing command
    command finished in 160ms
  * executing "ln -nfs /home/deploy/shared/spree /home/deploy/releases/20140605211204/public/spree"
    servers: []
    [] executing command
    command finished in 159ms

0 个答案:

没有答案