Tôi có nhiệm vụ này Capistrano:Rails 3.2.1, tài sản được biên dịch trước hai lần khi triển khai?
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"
Tôi biết rằng có load 'deploy/assets'
nhưng tôi đang cố gắng để hiểu những gì đang xảy ra ở đây.
Tôi đang triển khai đến một Amazon EC2 m1.small dụ, mà dường như có liên tục 50% cpu ăn cắp thời gian, xác minh với top
. Điều này dẫn đến tăng thời gian cho việc biên soạn tài sản, nhưng có một cái nhìn lúc này:
[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
Ngoài các điên lượng thời gian dành cho precompiling tài sản đối với một số lý do tôi có thể nói nó biên dịch cho họ hai lần. Tại sao?
Tôi đang sử dụng Rails 3.2.1. Ai đó có thể cung cấp một số thông tin chi tiết về những gì đang xảy ra ở đây? Nó có dự định không?
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
tôi đã đề cập trong câu hỏi của tôi mà tôi biết về nhiệm vụ capistrano này. Tôi tắt nó đi vì 1) Tôi đang gặp vấn đề với nó và sprites 2) Tôi muốn kiểm tra rõ ràng những gì đang xảy ra. – kain
Tôi đã cập nhật câu trả lời của mình với một số chi tiết khác. – James
cảm ơn; mặc dù chạy một nhiệm vụ cho mỗi 'tình huống' có vẻ ngớ ngẩn với tôi, tại sao đường ray trên trái đất không thể kiểm tra các tùy chọn và hành động phù hợp chỉ chạy một nhiệm vụ vượt ra ngoài tôi ... nếu bạn có bất kỳ thông tin nào khác về thông báo nào, không rõ ràng, chính hoặc lý do ai đó sẽ muốn không tiêu hóa và các công cụ, xin vui lòng chia sẻ. – kain