Spree 2.1 deployment on Heroku - ruby-on-rails

I am trying to deploy an ecomm site I am developing to Heroku.
I am using Rails 4, Spree 2.1 with the Spree_Fancy theme overtop that, S3 for images, and postgres as database in all environments.
The application is working perfectly on my local machine, but when I deployed it to Heroku, the front end breaks. The app runs via Heroku, but there is no styling at all, no theme, nothing. Just plain text and "no products found" message.
I expected there to be no images (since none had yet been uploaded to s3), but there were no products either, even though the db migrations ran.
Any ideas of what I am missing?

I've just answered on another thread the same problem scenario. Hope it helps.
Broken spree_fancy layout on heroku

Related

Rails host app doesn't see engine layout

What I want to do works on my OSX dev machines and on a staging server. However, I encounter problems on the production server.
I have a Rails Engine which I have created, maintained, and used over the years: https://github.com/allesklar/tkh_admin_panel
It works fine on many apps and I have been porting it to this new website as of late. For admin views, my controllers render the 'admin' layout which is located on this engine.
Everything has gone great until I tried to deploy to the site's production server. I get the following error:
ActionView::Template::Error (no implicit conversion of nil into String):
This exception occurs in the line with the following code:
render layout: 'admin'
I can't pinpoint any differences in gems, rbenv ruby versions, or any other factor from one setup to the next.
I've tried to reset the binstubs and done a number of other things.
No matter what I do, it works on the staging server and not on the production server.
Please point me to some directions where I can investigate further.
UPDATE ---
The scope of the problem has changed entirely since now I'm experiencing the same issue on my development machines.
I therefore think the problem lies in the host app/gem relationship. The same version of this gem works fine with some other Rails host sites of mine.
Any ideas welcome.
Try to recompile all assets. If you can (it's a prod server) delete all assets and manifest and re-deploy.
Try to delete all cache, if you are using page or fragment caching, perhaps your deploy system is not cleaning it correctly.
Simply reboot the system (simple action that fixed a lot of problems in the past).
And if nothing works, try to display the full backtrace to see where this is happening

Rails 4 Heroku - changes not getting pushed?

I am using Heroku to try to deploy a personal Ruby on Rails project and everything was going great until today.
I am very very new to Ruby on Rails and Heroku so please bare that in mind. I am not sure what is causing my issue and therefore not sure what code or information is best to supply so please ask me what you think you need to know to help resolve the issue and I will provide it.
My Ruby on Rails app worked fine both locally and on Heroku until I followed the information here to try and serve static images from Amazons S3 bucket. Note I only went as far as the static assets section.
This appeared to stop my Ruby on Rails application from recognising changes in my code. So I would make a change to a HTML file in my editor but the server was serving up the older version of the HTML file, even restarting the server didn't fix this.
I have been searching the web for hours trying to figure out what has gone wrong.
I deleted everything under public assets and I ran the precompile command:
rake assets:precompile
And this seems to have improved things locally, when I edit a HTML file the changes are reflected on localhost. However when I push to Heroku and go to my application hosted on Heroku it still shows the older HTML file no matter how many changes I make and pushes I do to Heroku.
The HTML files that are not updating are located here:
app/assets/templates
I'm not sure what I may have changed that has caused the HTML files not to get updated on Heroku?? What should I look at and try? What other information would be useful in helping track down the issue?
The answer marked as correct in this StackOverflow question worked for me - Updated CSS Stylesheet not loaded following deployment to Heroku? - It looks like I accidently added assets precompiled file in my git repo somewhere along my development and that caused the issue.

Remote Server behaving weirdly

I am trying to upload multiple images using paperclip gem. I have controller BatchImagesController, an associate batch images model and an attachment model image_assets. Now the issue is, my app is working fine on localhost in development and production environment. But on Remote server its not uploading images. The database shows batch_images entries but nothing uploads in image_assets. I am unable to debug here. Production log is also not showing anything. I am using ruby 1.9.3 and rails 3.2.13.
Any suggestion what I might be doing wrong?? Is this a mass assignment issue??I have made the
config.active_record.whitelist_attributes = false

Newly uploaded images break in production but not in development

I would appreciate any feedback regarding what may be causing my issue, described below.
I have an application that allows users to upload images. Everything works fine in development and used to work fine in production.
Recently, my newer images have all broken. I can upload new images, but when I check back a few hours later, the images are broken again. This started happening about a week ago, and images that I've had up in production from before then are still ok.
I am using Rails with Bootstrap and SimpleForm, and using Paperclip for the images. I am using Postgres in both devleopment and production, and am deploying to Heroku.
The only hint I have is in the "blank_profile_pic.png" image that I use as a default when users don't have a profile picture uploaded.
User.all.each do |u|
if u.profile_pic.file?
image_tag(user.profile_pic)
else
image_tag("blank_profile_pic.png")
end
end
For users that don't have a profile_pic uploaded, a broken image appears if their profile was created in the last week, but the expected "blank_profile_pic.png" remains for people that created their account before the issues started surfacing a week ago. How can the same block of code return different results between recent and older users?
I really don't know where to start with this, so would appreciate any feedback regarding what possible causes could be, and if there are any other files that I can show here.
Thanks very much for your help!
Heroku is a read only system. So you most definitely have to upload your images either to S3 or some other cloud provided.
Your images might have been uploaded to /tmp in Heroku and then somehow it was cleared, hence the errors.
Here are the docs: https://devcenter.heroku.com/articles/read-only-filesystem
And configuring Paperclip with S3: https://github.com/thoughtbot/paperclip#storage
I am not sure if you have the imagemagick gem installed, but we had same issue with image_magic that was breaking our paperclip functionality in production, but not in development (weird, I know). Yet even after removing imagemagick from our gemfile and Gemfile.lock locally (running bundle install and all that stuff) and then deploying back to production on heroku, the error persisted in production! (weird, I know).
What ended up doing the trick was running:
$ heroku repo:purge_cache -a myAppName
(Taken from: https://github.com/heroku/heroku-repo#purge_cache)
When you deploy your app, Heroku caches some things like your assets and installed gems in order to speed up deployment. Although this is a great feature, it can have side-effects sometimes, and in this case, it seems that something about the imagemagick gem got "stuck" in production's cache, which is why purging solved the issue for us (since after purging, your app will rebuild itself from scratch on your next deployment)

How did this Ruby on Rails app get deployed?

I have a Ruby on Rails app running on my server, and I can't figure out how it was deployed (someone else set it up).
The app is located in /var/www/myapp. Before it was deployed, I had been able to go in there and make minor edits to the app. The person helping me out with RoR then "deployed" it. It was unclear what deploying actually did, since it points to the same database and is on the same server. However, I can no longer edit it (or at least, the files I am editing are not being pointed to by the server).
Any way to figure out how this thing was deployed so I can take it down to edit it? Or should I basically just start over?
Was it maybe running in development mode before, and now it's in production? When it's in development mode, all of the files are loaded on each request, so your changes show up immediately. In production mode, you have to restart the server to see your changes.

Resources