1

I try to execute a binary on heroku. I follow this blog : http://www.verrot.fr/2010/02/24/executing-binary-files-with-ruby-on-rails-and-heroku/ :

I have the following code :

@exec = IO.popen("#{Rails.root}/bin/aapt version")
@result = @exec.gets
puts @result

I've got the following error on heroku while it's working on local rails server :

command not found: app/bin/aapt version

Have you got any idea on a way to do that ? Or if you already done that ?

2
  • Never used heroku, but maybe this would work: @exec = IO.popen("#{File.expand_path(Rails.root)}/bin/aapt version")
    – Brian
    May 12, 2011 at 15:54
  • i've tried both, no one works :(
    – Jerome VDL
    May 12, 2011 at 20:44

2 Answers 2

5

How I have gotten this to work, but be warned, Heroku does not support this solution. The direct quote from Heroku Support is "you are on your own."

  1. Create a bin directory in your application.
  2. Add Debian etch amd64 binaries to this directory. For example, add application called mongodump.
  3. Have your code execute system call. Example (note the lack of path):
system "bin/mongodump --help"

A true or false will be returned from the system call.

1
  • Indeed the problem is my binary is not compiled for amd64... i need to build it on this platform :(
    – Jerome VDL
    May 13, 2011 at 8:52
0

Did you make sure the permissions on your local binary allow execution? Git is permissions-aware. If not, you need to make sure the file allows executable permissions (modify the permissions if you must), then add the modified file to git and repush to heroku before trying again. Keep in mind that the user heroku will use to execute the file may or may not be the owner, so you may need to play with them in order to get heroku to recognize it. Just chmod 777 bin/executable_name as a last resort.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.