I have been using the spreadsheet gem from http://spreadsheet.ch/ to read in seed data to a Rails 3 application.
I was using
Spreadsheet.open "xxxx"
which ran fine on my dev machine but when pushed to Heroku errored with "Permission denied"
The guide http://spreadsheet.rubyforge.org/files/GUIDE_txt.html is only very basic help.
Down we go into the 'long series of debugging questions' rabbit hole:
"Is the spreadsheet checked into git, such that it would show up on Heroku?"
"Is ruby spreadsheet trying to write to a file that's in one of the read only parts of heroku?"
"Are you using Spreadsheet.open or ?"
I guess in general it would be nice if you could include a stack trace of the error Heroku is giving you.
Perhaps: heroku logs within your project directory might be of help, if the errors are recorded there?
Chalk this one up to duh
Spreadsheet by default opens in read/write which Heroku does not allow. A little ri research revealed that Spreadsheet.open can be passed the 'r' flag for read-only. Here is the ri output
>>ri Spreadsheet.open
Spreadsheet.open
(from gem spreadsheet-0.6.5.4)
------------------------------------------------------------------------------
open(io_or_path, mode="rb+", &block)
------------------------------------------------------------------------------
Parses a Spreadsheet Document and returns a Workbook object. At present, only Excel-Documents can be read.
Related
I'm adding security to a 'forgot password' process and using the securimage code. I know it is not recommended, but it is only 1 step in a multi-step validation ... just using the tools I have available until something better comes along
I simply installed the securimage files in a root directory under public_html, ran the compatibility check (all good except the LAME M_3 support)
When I run securimage_show by itself, I get a good image. When I run example_form or captcha.html, I get a background image with 'Failed to load TIF font file'. I looked for any errors, did some debugging, and do not see any difference in the debug log with respect to the TFF file location or name.
Any pointers would be appreciated!
I know this question has been asked a lot, but no one seems to have my exact problem.
I ran into the permission error on my rails app, running on an AWS EC2, so I promptly ran chmod 666 -R public/uploads
However, once I did that, I got another permission denied error, this time for mkdir on uploads/images. So I ran chmod on it too. But this time, no difference.
I am using Carrierwave to upload the images. I'm a bit of a newb with the linux commands. Any help would be greatly appreciated!
Turned out to be an issue with Carrierwave. The gem wasn't writing files when 'version_name' was used in the url. So I removed it and the files saved fine.
However, image_url, the documented method of getting the url, returned the url with the version_name, rather than the actual url to file. Calling the object attribute declared for the uploader returned the right one.
I have a rake task in Rails which job is basically to just open a file and write some text, I have
def self.log
File.open("#{Rails.root.join("app/views/main/log.html.erb")}", "a+"){|f| f << "sometext" }
end
My file is at /app/views/main/log.html.erb
This works perfectly fine locally, but once I upload onto Heroku it doesn't write anything to the file (no error message either). Suspecting the file path is incorrect, or anything else I don't know about Heroku? Thanks!
Heroku's filesystem is read only. It is highlighted in this article: https://devcenter.heroku.com/articles/read-only-filesystem. Hope that helps.
I'm having a problem running the oink gem on my app in Heroku. I've included it in my gemfile and gemfile.lock, uploaded those, and it installs. It even creates the oink.log (which I have no way of viewing, unfortunately). When I run
heroku run bundle exec oink --threshold=0 log/* --app my_app
I get
Running bundle exec oink --threshold=0
log/delayed_job.log log/development.log log/oink.log log/production.log log/test.log attached to terminal... up, run.3
/app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:88:in get_file_listing':
Could not find "log/delayed_job.log" (RuntimeError)
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:86:ineach'
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:86:in get_file_listing'
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:59:inprocess'
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/oink:4
from /app/.bundle/gems/ruby/1.8/bin/oink:19:in 'load'
from /app/.bundle/gems/ruby/1.8/bin/oink:19
I've tried running each of the individual files, too, and get the same result. This command runs fine on my local machine.
In my production.rb file, I have
config.logger = Hodel3000CompliantLogger.new(config.paths.log.first)
config.middleware.use( Oink::Middleware )
as configuration.
Can you enlighten me on what I'm doing wrong here? My understanding is that the logs are read only, but I don't know if that means they're only accessible through the heroku logs command. If there's a way I can see the oink.log file, too--knowing how to do that is also appreciated, or knowing how to see it in the actual Heroku log using heroku logs.
UPDATE: The configuration for oink shown above allows the commands to be run successfully on my localhost.
Thanks!
-Andrew
I am having a memory leak and am trying to track it down, therefore im trying to use oink on Heroku servers. Since Heroku does not provide log archives, im exporting them to Amazon S3 through the Papertrail add-on.
I have been able to succesfully do so, however, in order to use oink, my log files must be in a special format called "Hodel 3000 compliant logger". I have managed to do so in development, however I do not know how to create such log files in production (*heroku). Any help would be appreciated.
Thanks in advance,
Juan Lagrange
The hodel_3000_compliant_logger gem should do the job here; it's designed just for that purpose.
Add gem 'hodel_3000_compliant_logger' to your Gemfile, then bundle install
Add config.logger = Hodel3000CompliantLogger.new(config.paths['log'].first) to your application.rb (if you want to replace your default logger with the Hodel3000 one).