Rails assets images in production - ruby-on-rails-3

I found some strange behavior of assets images
If I run unicorn in production mode at hosting - /assets/image.png - server give me blank image ie file exist, but size=0 . In same time at localhost I run in unicorn development mode - and all works fine, Then I run webrick at hosting - images are display fine. After that I run unicorn in production mode at localhost and images stops display, then I run unicorn in development images already doesn't work.
Rails 3.1.0.rc6, after that I update to rc8 at hosting but nothing happened
Maybe production mode build some cache, which remains forever?

There are different things that may go wrong, so here the ideas you have to check:
There is a known error in Rails 3.1, that the precompilation of assets does not work properly. See Upgrade to Rails 3.1.0 from rc6, asset precompile fails for a question with a solution.
I had problems with creating precompiled assets for production. The following worked for me (after fixing the error above):
Ensure that your application is not running in production mode.
Call bundle exec rake assets:clean. This will clean all resources hanging around.
Call bundle exec rake assets:precompile afterwards. As a result, the directory /public/assets should be filled with assets with the hash appended (e.g. icon_add-96985e087048a8c2e09405494509750d.gif instead of icon-add.gif).
Start your server in production mode.
Depending on the browser I used, I had to refresh or even clear all caches. Especially Chrome was very nasty in caching resources that he should not cache.
I hope some of the ideas will help you find the source of your problem.

Related

Rails 3 Assets not available in deployed development mode

We have a rails 3 application being deployed using capistrano 3 in development mode. Capistrano compiles the assets and the site displays properly. However some of the site functionality is not working and using "inspect" in chrome it shows that none of the css of js files are not present.
The site can be viewed at here.
How can I set capistrano that it does not compile assets when deploying to this server?
I am not sure what other information I should be providing, so please let me know and I will update the question accordingly.
EDIT
1) Corrected the site URL.
2) development.rb file
3) Using capistrano3 with Capfile

Best Asset Pipeline Setup for Ruby on Rails and Heroku

I am running Rails 3.2.12 and deploying to Heroku.
Currently, to get my css files to update locally I need to run
RAILS_ENV=production bundle exec rake assets:precompile
I was wondering how I can get my asset pipeline to start automatically updating upon sacing again in development mode.
I have read the following article, but I am unsure which set up to follow. I am just using basic scss, nothing crazy.
https://devcenter.heroku.com/articles/rails-asset-pipeline
Thank you.

Images load slowly in ruby on rails

I have developed a website using ruby 1.9.3 and deployed in on aws server through passenger. But my website takes time in loading.
I am using passenger in: production mode
I am worried because i reduced the size of images to 100kb even then they took time in loading due to which animation can't occur properly.
I have assets precompile :true
in production environment.
Is there any way to load images fast.
Please help i am new to ruby
Thanks & Regards
Rajat
If you are using asset pipeline, then you need precompile assets using the rake task and deploy the application to production.
bundle exec rake assets:precompile
Refer to below links for more info
http://guides.rubyonrails.org/asset_pipeline.html
http://stackoverflow.com/questions/8821864/config-assets-compile-true-in-rails-production-why-not

Rails + foreman + worker hangs server

On my local machine I'm trying to start my rails app and delayed job worker using Foreman. My Procfile looks like this:
web: bundle exec rails server -p $PORT
worker: bundle exec rake jobs:work
When I start foreman only the first two web requests get executed. With the third request the server hangs. The first request is outputted in the console, the second isn't.
If I leave out the worker in my Procfile the server is running just fine and is outputting everything to the console. Also when I start the rails server and worker without Foreman everything is working fine.
So it looks like there's an issue with Foreman. I'm guessing it's a problem with Foreman not outputting anything to the console after the first request and therefore the buffer doesn't get flushed. I've searched other posts and as a result added STDOUT.sync = true to my development.rb but without any success.
Does anybody have a clue? Thanks!
UPDATE:
Tracked and resolved here:
https://github.com/ddollar/foreman/issues/244
TL;DR: Install the gem, don't use foreman.pkg
I'm facing the same problem.
Here's a link to the question I've asked on stackoverflow. #smek, if you found an answer, please reply!
I had a similar problem when trying to implement and test DJ + Foreman in my local dev environment. I intended to deploy to Heroku and was using the following article as a guide. If you are also deploying to Heroku, I recommend installing Heroku Toolbelt, which includes Foreman. In my case I already had Heroku Toolbelt installed, so I simply reinstalled it.
most of the times someone left a debugger/pry statement in the code or you put a breakpoint in somewhere.
if you can't find anything than you can use system tools like lsof or gdb to find out what your ruby process is doing at the moment. that might help finding the problem.
I just started using Foreman about an hour ago, and I was having some issues with both my rake tasks and rails server hanging when being run by Foreman. When I removed the pry gem from my Gemfile it worked, but that wasn't acceptable since I use pry in development.
Then I updated to foreman version 0.49.0 (which was released about 10 minutes ago) and the problem was fixed. Too bad I didn't start working on this task an hour later, because then I would have gotten 0.49.0 to start with and not had to mess around for an hour :)
You should try upgrading Foreman and see if it fixes your problem.

jquery-datatables-rails sort arrows not showing up when deployed to Heroku

Running the cedar stack. When I deploy, the dataTables works but none of the sort arrows show up.
The files not showing up are:
sort_asc.png
sort_both.png
sort_desc.png
They appear when running locally on my development environment. I found this Images desapears after deploy Rails 3.1.3 on Heroku Cedar and it looks like a similar issue, but I am somewhat new to rails and don't know how to apply that since I'm using a gem.
Any ideas?
Have you precompiled your assets?
There could be a few reasons this doesn't work. Best bet is start here:
http://www.neilmiddleton.com/heroku-asset-pipeline-faq/