First let me start by saying I'm a complete novice when it comes to Ruby & Rails, so hopefully I'm not making a noob mistake.
I've picked up the source for an app which I have successfully deployed to heroku; and running in development mode it works fine but when I switch it to production mode the images are not shown.
The app is using the assets_sync Gem and the images as well as other assets should be served from AWS using an S3 bucket. The css and js files are coming through correctly but not the images. This article explains quite well how it should work https://firmhouse.com/blog/complete-guide-to-serving-your-rails-assets-over-s3-with-asset_sync
As far as I can tell the css and images are precompiles; with the css generated from sass, and the images combined into one sprite. I found this article useful for explaining what was going on here http://compass-style.org/help/tutorials/spriting/ (probably nothing new for experienced rails developers)
If I dig a little deeper and view the css of the running app the background image url property is missing the bucket name from the url.
Here's an example; I'm certain the part //.s3
should be //mybucket.s3
:
someclass {
background: url(http://.s3.amazonaws.com/assets/myicon.png)
}
If I take the url and place directly in the browser address bar - no image!. But as soon as I add the bucket name the image is downloaded. That is, the following works, which confirms the images exist on the s3 bucket.
http://my-bucket.s3.amazonaws.com/assets/myicon.png
This implies the css isn't precompiled correctly and perhaps can't find the bucket name from the config.
I've checked that the heroku config is correct. With the following set:
- FOG_PROVIDER,
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- FOG_DIRECTORY
- FOG_REGION
I've hit a wall with this spending a fair bit of time Googling the issue without result. So has anyone seen this issue before, or suggest ways of working out what could be going wrong?