Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Rails4 with ckeditor to Heroku , failed with time-out assets:precompile

I wrote a rails4 app and deployed to heroku, and everything is ok until I add gem ckeditor and wanna implement this wysiwyg editor. when I run git push heroku master

it takes me massive time at this step Preparing app for Rails asset pipeline
Running: rake assets:precompile
even more , finally I get this error: ! Timed out compiling Ruby/Rails app (15 minutes) ! See https://devcenter.heroku.com/articles/slug-compiler#time-limit

seems this editor is too heavy to compile.

I have searched for the solution , like this two tips-pages

Page I

Page II

After I did like those:

  #  config/initializers/ckeditor.rb:
  Ckeditor.setup do |config|
    config.assets = ["ckeditor/ckeditor.js"]
  end

still got the same time-out error.

Sigh for wasting so many time waiting that precompile error.

just wondering how to disabe unnecessary packages like some language-packages , plugins exactly.

BTW, things could be done with assets:precompile locally.

like image 718
xguox Avatar asked Dec 28 '13 06:12

xguox


2 Answers

So I finally solved it by doing the following:

  1. Adding config.assets.precompile += Ckeditor.assets to application.rb
  2. Added gem 'turbo-sprockets-rails3' to my Gemfile under :assets group.
  3. Removed unused Gems from Gemfile.
  4. Bundle Install
  5. Removed the following lines from active_admin.js.coffee:

    //= require active_admin/base
    //= require ckeditor/override
    //= require ckeditor/init
    
  6. Pushed to Heroku.

  7. Added the 3 lines back.
  8. Pushed again.

Now everything works because most of the assets have been recompiled before pushing with ckeditor.

like image 169
Danpe Avatar answered Oct 06 '22 01:10

Danpe


Add config.assets.precompile += Ckeditor.assets in your application.rb file

like image 33
Adimir Colen Avatar answered Oct 05 '22 23:10

Adimir Colen