I've Iterated over the creation of a PDF with data in my RoR application. I am using wkhtmltopdf 0.9.9 locally and trying to use wkhtmltopdf-binary (0.9.9.1) gem on heroku.
My PDF looks exactly the way I want it to look locally but it looks like the heroku version is a zoomed out version of the local version effectively making the page on heroku left align when the development version is perfectly centered.
I'd like my production version to look exactly like my development version so that I don't have to iterate on my heroku instance.
Any help is appreciated!
I had the same problem, but setting DPI, while generating pdf via wkhtmltopdf, solved the problem.
--dpi 100
Related
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
I have a Rails app which uses wkhtmltoimage to render an image. The font used in the image is Lucida Grande, included via inline data-uris. On my local Mac everything works just fine, but on the remote server (Ubuntu 12.10) the font just looks weird. Both are using wkhtmltoimage 0.10.0 rc2.
The left one is generated on my Mac, the right one on the Ubuntu server.
Any ideas whats going on?
Unfortunately I haven't found a solution for this problem. But today I was lucky enough to find a workaround! :)
After reading Thomas Fuchs' Embedding Canvas and SVG charts in emails I went the radical way and completely replaced wkhtmltoimage with PhantomJS. I also used his gist to install some dependencies. And here are the results:
wkhtmltoimage local & remote:
PhantomJS local & remote:
Though there are still small differences, PhantomJS does its job quite good! So I will use this for now, and close this question :)
I'm trying to enable image uploads for a model in my Rails app. I'm using the CarrierWave gem, but in order to do any image manipulation like thumbnail resizing I must have Imagemagick installed on the actual computer for use with the Rmagick gem.
Here's the problem: I'm turning this app over to a painter who will log in and upload her own art. This means she won't be in my development environment that has Imagemagick installed. I'm really confused about the role of Imagemagick here - will image manipulation simply not work anymore when the app is deployed, or does it persist somehow?
Feel free to correct me if my understanding of this is completely screwy. Or, is there a better solution available?
ImageMagick must be installed to install RMagick; RMagick is an interface to ImageMagick's libraries, and calls ImageMagick's functions to do its processing.
If the ImageMagick libraries and development headers are not present on the deployed machine, RMagick installation will fail.
When you 'turn over' your app to the painter what this really means is that you'll deploy your application to a platform like Heroku (i.e. a production environment) that will host your Rails app for you. If you choose Heroku, all will be well because their Rails setup includes Imagemagick and you don't need to do anything.
The key here is to ensure that whatever provider you use to host your Rails app, they either have Imagemagick installed or it is an option for you to do that manually.
Personally I'd go with something like Heroku, it's easy and the interface is slick and pretty. Here is their setup guide: https://devcenter.heroku.com/articles/rails3
I've got a strange problem. My rails app looks fine in prod, but I recently started working on it on a different computer, and the front page seems to have forgotten about it's margins. When I commit everything and push it out to production, there are no problems.
I'm using twitter-bootstrap-rails and have not customized the stylesheets at all.
This picture has everything crammed against the left side of the browser, on my local machine
This picture shows production, where everything is properly aligned
This could be due to the mode you are running the server. My guess is that you will see the difference when you run rails s development vs rails s production.
I ran into this before, and it was an issue where my CSS was compiling incorrectly because I had some bad CSS floating around.
It can be pretty insidious to track down, so first look through your assets hierarchy and look for anything that is out of place. After that, you'll have to investigate using a browser and inspection tools like through Chrome.
Had similar issues with the fixed header bar which lost it's style. Looks like it was the update to the twitter-bootstrap-rails gem from 2.0.3, which I was using to the new 2.1.6.
With the update I then got an error about twitter-bootstrap-rails v2.1.6 break with error "rails app: method_missing': undefined methodless'
There has been a lot of discussion on the twitter-bootstrap-rails issue list: see v2.1.6 breaks app which explains a lot of the revised Gemfile configurations.
So far applying the suggestions hasn't resolved my issue of the header bar, which was dark, as per the Twitter Bootstrap examples, now appearing with a grey background like the LH nav bar. Suspect that it's something to do with the less compiling or linking of the assets.
I'm not sure exactly what the problem was still, but once I linked the app to Pow on my Mac everything displays normally. Strange. Anyway, I'm not having a problem anymore.
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)