0
votes

I've deployed my Rails application to Heroku following https://devcenter.heroku.com/articles/rails3 and can open a website like http://severe-mountain-793.herokuapp.com

In my controller, I have a system command

`wget ...`

but it gives the error

sh: wget: not found

What should I do to use the command?

1
why do you need to use system commands? Why can't use use net::http? - John Beynon
@JohnBeynon I need to do recursive downloading, which net::http doesn't provide as far as I know. - Mika H.
you're downloading into your heroku application? What are you doing? - John Beynon
@JohnBeynon Yes, downloading into /tmp folder. I'm serving some content to the user. - Mika H.
so you're aware that they will only have 30 seconds to download it from your Heroku application else the request will be timed out? - John Beynon

1 Answers

4
votes

So you'll need to use a custom buildpack to achieve this which will grab wget, compile it and then include the resultant binary into your slug (a heroku term).

Turns out, I've just whipped one up - https://github.com/johnbeynon/heroku-buildpack-wget.

To use;

create a .buildpacks file in the root of your project containing

git://github.com/heroku/heroku-buildpack-ruby.git
git://github.com/johnbeynon/heroku-buildpack-wget.git

and then do

heroku config:add BUILDPACK_URL=git://github.com/ddollar/heroku-buildpack-multi.git

Now, when you deploy your application, it will use the heroku-buildpack-multi which will read your .buildpacks file and use those defined in there. heroku-buildpack-ruby is the default provided ruby buildpack and then mine will add wget into your application.

to verify if it's work, do heroku run bash and then try and run wget and see if it works.