Rails Asset Precompile需要很长时间

时间:2015-02-11 07:45:24

标签: ruby-on-rails deployment asset-pipeline capistrano3

我的资产预编译生产时间差不多15分钟,因为有时它会中止。

我的其他项目花了这么长时间。看起来即使启动任务也需要很长时间。

以下是日志。

DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Compiled jquery1.10.2.js  (2ms)  (pid 4828)
DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Compiled jquery-ui.min.js  (1ms)  (pid 4828)

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     Compiled admin.js  (270ms)  (pid 4828)
DEBUG[b6fdcae6]     

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Compiled jquery.nicescroll.js  (1ms)  (pid 4828)

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     Compiled application.js  (1031ms)  (pid 4828)

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     Compiled jquery.carouFredSel-6.2.1-packed.js  (1ms)  (pid 4828)

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Compiled jquery.autocomplete.css  (108ms)  (pid 4828)
DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Compiled admin.css  (728ms)  (pid 4828)

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     Compiled application.css  (354ms)  (pid 4828)

...... (some assets which took 0ms)

DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Processed digest assets in 418179ms
DEBUG[b6fdcae6]     
DEBUG[b6fdcae6]     Copied binary asset to 12maple.jpg
DEBUG[b6fdcae6]     ...........

1 个答案:

答案 0 :(得分:0)

我不确定你问题的原因是什么,但我遇到了类似的问题,尝试将应用程序部署到Digital Ocean,dropplet的规格是最小的,因此RAM和共享内存非常小导致中止预编译任务中的部署。我解决了增加共享内存和RAM大小的问题。

这些链接帮助我解决了这个问题,希望对你有帮助。

增加RAM:

Rake assets:precompile gets killed when there is a console session open in production

增加共享内存:

https://docs.oracle.com/cd/E19879-01/821-0182/fxxua/index.html

https://serverfault.com/questions/710264/failed-to-map-segment-from-shared-object-cannot-allocate-memory

http://rwitkop.com/VistA/ConfigureSysctl4Cache.html