2

При запуске cap deploy, я получаю следующее сообщение об ошибке при попытке компиляции активов:Как исправить рейк-активы: прекомпилировать задачу, вызвавшую ошибку «[FATAL]»?

*** [err :: 205.186.157.163] /usr/local/ruby-enterprise/bin/ruby /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets 
*** [err :: 205.186.157.163] [DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.attributes.spree/order" is no longer supported 
*** [err :: 205.186.157.163] [FATAL] failed to allocate memory 
*** [err :: 205.186.157.163] rake aborted! 

Я смотрю рич памяти максимум, используя top каждый раз. Я увеличил выделение памяти в поле MediaTemple (ve) до 1 ГБ без успеха.

Контекст: Spree 1.0.3, рельсы 3.1, сервер MediaTemple (ve) с памятью 1 ГБ.

Любые подсказки?

ответ

1

Я думаю, что это known issue с Rails 3.1, предположительно исправленный в Rails 3.2. Также видя еще одно упоминание here. Я столкнулся с той же проблемой, что и новая установка Rails 3.1 и Spree 1.0 и никаких других зависимостей.

Вот как я работал вокруг него:

В Capfile, закомментируйте:

load 'deploy/assets' 

В моем deploy.rb файл, я скопировал, что предусмотрено в deploy/assets с драгоценным камнем Spree-рельсы, но добавил, Задача precompile_quick. Это компилирует CSS и JS, но похоже, что на самом деле это не может сжимать CSS и JS.

before 'deploy:finalize_update', 'deploy:assets:symlink' 
after 'deploy:update_code', 'deploy:assets:precompile_quick' 

namespace :deploy do 
    namespace :assets do 
    desc <<-DESC 
     [internal] This task will set up a symlink to the shared directory \ 
     for the assets directory. Assets are shared across deploys to avoid \ 
     mid-deploy mismatches between old application html asking for assets \ 
     and getting a 404 file not found error. The assets cache is shared \ 
     for efficiency. If you cutomize the assets path prefix, override the \ 
     :assets_prefix variable to match. 
    DESC 
    task :symlink, :roles => assets_role, :except => { :no_release => true } do 
     run <<-CMD 
     rm -rf #{latest_release}/public/#{assets_prefix} && 
     mkdir -p #{latest_release}/public && 
     mkdir -p #{shared_path}/assets && 
     ln -s #{shared_path}/assets #{latest_release}/public/#{assets_prefix} 
     CMD 
    end 

    desc <<-DESC 
     Run the asset precompilation rake task. You can specify the full path \ 
     to the rake executable by setting the rake variable. You can also \ 
     specify additional environment variables to pass to rake via the \ 
     asset_env variable. The defaults are: 

     set :rake,  "rake" 
     set :rails_env, "production" 
     set :asset_env, "RAILS_GROUPS=assets" 
    DESC 
    task :precompile_quick, :roles => assets_role, :except => { :no_release => true } do 
     run "cd #{current_path} ; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile:primary" 
     run "cd #{current_path} ; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile:nondigest" 
    end 

    desc <<-DESC 
     Run the asset clean rake task. Use with caution, this will delete \ 
     all of your compiled assets. You can specify the full path \ 
     to the rake executable by setting the rake variable. You can also \ 
     specify additional environment variables to pass to rake via the \ 
     asset_env variable. The defaults are: 

     set :rake,  "rake" 
     set :rails_env, "production" 
     set :asset_env, "RAILS_GROUPS=assets" 
    DESC 
    task :clean, :roles => assets_role, :except => { :no_release => true } do 
     run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:clean" 
    end 
    end 
end 
+0

Хотя ваш ответ, возможно, не был техническим решением, я тем не менее ценю его. Я уже видел ваше решение где-то раньше (проблемы github?), И я также думаю, что нам действительно нужна более тонкая задача с прекомпиляцией. – thekingoftruth