Mika H.
Mika H.

Reputation: 4339

System command with Rails on Heroku

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?

Upvotes: 0

Views: 584

Answers (1)

John Beynon
John Beynon

Reputation: 37507

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.

Upvotes: 4

Related Questions