Recently I upgraded ruby version of my Heroku application after which it stopped compiling assets.
Initially I was using ruby version 1.9.2 and my assets were getting compiled while deploying the application. Recently I upgraded ruby version to 1.9.3 by specifying in gem file and adding config variable "RUBY_VERSION" for my application.
Everything is working fine now it is also picking right ruby version but it is not running assets precompile command while deploying application.
I have following line in application.rb
config.assets.enabled = true
A quick 'fix' for this would be precompiling the assets locally and then deploying the application.
I think its better, for a faster deployment.
First
rake assets:clean
then
RACK_ENV=production rake assets:precompile
Related
I have been using Rails 5.2 from the 5-2-stable branch of Rails to use ActiveStorage, now I am updating a bunch of apps to use the released version again. As mentioned in this issue the rails versions from Github all requires coffee_script. Now I want to remove coffee.
I cannot recreate this in my local environment or on CI, but when deploying to Heroku it fails with:
LoadError: cannot load such file -- coffee_script
/tmp/build_2b0eaffa6f7fd662e3233ac5b4de6d62/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
I cannot find any mention of coffee in my code.
Could this be a caching issue on Herkou or similar? Any clues are welcome.
Failing gemfile
https://github.com/fsek/voting/blob/50d063d16ae8d323f0cfe57e5bb6b4299c592019/Gemfile
Working gemfile (separate project, can be deployed)
https://github.com/pensionsupplysning/web/blob/cb256668640e38af4b59e8cf23fbfa939728abb7/Gemfile
Add the gem coffee-rails to your project or migrate to sprockets 4.x and make sure you follow this migration guide: https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs
I'm using Rails 3.0.10 and running rake assets precompile at production server and facing problem as manifest requires output filename.this code is already deployed on heroku server and working fine. Please provide a solution on this.
I used to develop a project on my own and now I have got some others to help in the project. It's developed with Ruby on Rails and we have a staging server on Heroku. Beforehand the deployment workflow is to precompile the assets in local machine then push the code to heroku. It works well when I am on my own.
Now I am working with a Front-end engineer. The problem is we are working in different location so it is difficult to setup his computer the same as mine. As a result, he will not be able to precompile the code before pushing to heroku.
Of course I can do it for him but would be better if he can just submit the code to the staging server and let Heroku to precompile it. I think Heroku detect if the manifest file is available to determine if it needs to precompile. Is there a way to force Heroku to recompile the assets?
I have tried: heroku run rake assets:clean then heroku run rake assets:precompile but no luck...
Heroku's servers use a read-only file system. This is how they make it easy for you to spin up more dynos, among other things.
Compiling Rails assets means taking the source files and compiling a new file, i.e. writing a file to the file system. Since this can't happen on a read-only file system, you have to precompile first. Even if you did manage to compile assets on Heroku, by writing to the /tmp directory, at the end of the day when Heroku reboots dynos, your new files will be gone because they weren't checked into the repo as they would've been if you had precompiled them locally, committed them, and then pushed to Heroku.
Any workaround I can imagine would be more complicated than helping your front end dev setup Rails and bundle installing the gems needed to precompile before pushing.
I have a big problem with the ckeditor "3.7.0.rc2" gem.
In development it works great with s3 a backend for uploading.
But on heroku it does not work.
The problem is that the ckeditor/vendor/skins/(kama) or (office2003) or (v2) /editor.css files contains an error that makes the sass compiler scream. The error like this "filter:;", since there is no value it does not work.
There is no point in change the files locally, because heroku downloads the gem as I deploy.
I have tried to package the gem locally and make my own git fork and install it for there. But, then the
RAILS_ENV=production bundle exec rake assets:precompile
command precompiles all files in the ckeditor folders and always ends in
rake aborted! Permission denied
When I precompile with the "3.7.0.rc2" gem installed, some ckeditor js files are precompiled but not all.
How can I get around this problem?
When you fork ckeditor gem and use the forked git path in Gemfile heroku will pull the sources of ckeditor from your forked git repo instead of the gem. This should fix the issue.
Other thing that you could try is precompile the assets in your development machine and push the assets to heroku. This will make sure that heroku will not precompile those assets. More info is available at http://devcenter.heroku.com/articles/rails31_heroku_cedar. This will run only on cedar stack
The solution was to fork the git repo, delete all unnecesarry and correct the errors. js files. Then the precompiling worked and now the app is running on heroku.
Here's a link to my fork https://github.com/andreaslyngstad/ckeditor
It worked in my project, but I have deleted js files that I did not use, so if you are using some of them, this is not for you.
I don't know it's just me, or everybody is facing same kinda issue. I am trying to precompile assets on server with this command -
bundle exec rake assets:precompile RAILS_ENV=production
but it takes about 10mins to compile all assets. The project is not big, its just started and has some 5 coffee script files, 3 css files.
Because of this, even capistrano deployments takes longer to complete.
Earlier it was ruby 1.9.2 there, now I am trying with REE 1.8.7.