我有这样的任务Capistrano的:Rails 3.2.1,部署资源预编译两次?
namespace :deploy do
task :precompile, :role => :app do
run "cd #{release_path}/ && RAILS_ENV=staging bundle exec rake assets:precompile --trace"
end
end
after "deploy:finalize_update", "deploy:precompile"
我知道,有load 'deploy/assets'
但我想了解是怎么回事。
我部署到Amazon EC2上的m1.small情况下,这显然有不断50%的CPU偷时间,与top
验证。 这导致增加的时间编制资产,但看看这个:
[23.21.xxx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /home/ubuntu/apps/myapp-rails/releases/20120227020245/ && RAILS_ENV=staging bundle exec rake assets:precompile --trace'
** [out :: 23.21.xxx.xx] ** Invoke assets:precompile (first_time)
** [out :: 23.21.xxx.xx] ** Execute assets:precompile
** [out :: 23.21.xxx.xx] /home/ubuntu/.rvm/rubies/ruby-1.9.3-p125/bin/ruby /home/ubuntu/apps/myapp-rails/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets --trace
** [out :: 23.21.xxx.xx] ** Invoke assets:precompile:all (first_time)
** [out :: 23.21.xxx.xx] ** Execute assets:precompile:all
** [out :: 23.21.xxx.xx] ** Invoke assets:precompile:primary (first_time)
** [out :: 23.21.xxx.xx] ** Invoke assets:environment (first_time)
** [out :: 23.21.xxx.xx] ** Execute assets:environment
** [out :: 23.21.xxx.xx] ** Invoke environment (first_time)
** [out :: 23.21.xxx.xx] ** Execute environment
** [out :: 23.21.xxx.xx] ** Invoke tmp:cache:clear (first_time)
** [out :: 23.21.xxx.xx] ** Execute tmp:cache:clear
** [out :: 23.21.xxx.xx] ** Execute assets:precompile:primary
** [out :: 23.21.xxx.xx] ** Invoke assets:precompile:nondigest (first_time)
** [out :: 23.21.xxx.xx] ** Invoke assets:environment (first_time)
** [out :: 23.21.xxx.xx] ** Execute assets:environment
** [out :: 23.21.xxx.xx] ** Invoke environment (first_time)
** [out :: 23.21.xxx.xx] ** Execute environment
** [out :: 23.21.xxx.xx] ** Invoke tmp:cache:clear (first_time)
** [out :: 23.21.xxx.xx] ** Execute tmp:cache:clear
** [out :: 23.21.xxx.xx] ** Execute assets:precompile:nondigest
command finished in 958131ms
除了花在出于某种原因,我可以说这是编译他们两次预编译的资产疯狂的时间。为什么?
我正在使用Rails 3.2.1。 有人可以提供一些关于这里发生了什么的见解吗?它的目的是?
staging.rb
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
我在疑问,我知道这个任务Capistrano的提及。我把它关闭了,因为1)我有问题,它和精灵2)我想清楚检查发生了什么事。 – kain 2012-02-27 02:37:41
我已经更新了一些更详细的答案。 – James 2012-02-27 04:09:42
谢谢;尽管为每个“情况”运行一项任务似乎很愚蠢,为什么地球上的铁路不能检查选项并采取相应的行动,只运行一项任务,这超出了我的意图......如果您有任何关于什么摘要,非摘要,主要或为什么的其他信息有人会想要非消化和东西,请分享。 – kain 2012-02-27 07:47:52