Capistrano deploy - assets precompile error

痴心易碎 提交于 2019-12-05 08:45:06
itsnikolay

It seems as you have low operation memory size on your vpn server. (Vpn supplies without memory-swap for now) thus operation system kills your deploy process.
The solution is to compile assets locally (on your development machine)

Add deploy:assets:precompile task to your deploy.rb file (this is for Capistrano 2)

namespace :deploy do
  . . .
  namespace :assets do
      task :precompile, :roles => :web do
        from = source.next_revision(current_revision)
        if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ lib/assets/ app/assets/ | wc -l").to_i > 0
          run_locally("rake assets:clean && rake assets:precompile")
          run_locally "cd public && tar -jcf assets.tar.bz2 assets"
          top.upload "public/assets.tar.bz2", "#{shared_path}", :via => :scp
          run "cd #{shared_path} && tar -jxf assets.tar.bz2 && rm assets.tar.bz2"
          run_locally "rm public/assets.tar.bz2"
          run_locally("rake assets:clean")
        else
          logger.info "Skipping asset precompilation because there were no asset changes"
        end
      end
    end
  end

Then just redeploy you app $ bundle exec cap deploy wish it helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!