Reputation: 1709
I'm using the tts gemfor spoken audio onscreen, and all works fine on local dev station, but throws 500 on heroku's server. The tts gem depends on mpg123.
The heroku logs send back the following errors at runtime:
2014-06-23T09:37:47.024478+00:00 app[web.1]: mpg123 executable NOT found. This function only work with POSIX systems.
2014-06-23T09:37:47.024485+00:00 app[web.1]: Install mpg123 with `brew install mpg123` or `apt-get install mpg123`
2014-06-23T09:37:47.025829+00:00 app[web.1]: Completed 500 Internal Server Error in 196ms
First attempt: heroku run brew install mpg123
Running `brew install mpg123` attached to terminal... up, run.1741
bash: brew: command not found
Second attempt: heroku run apt-get install mpg123
Running `apt-get install mpg123` attached to terminal... up, run.5879
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
Upon further research, I'm now understanding that a 'custom buildpack' needs implementation? If so, how would one determine which buildpack to use and how to install mpg123 using it? Unless there is an easier or more appropriate way, I'm certainly open to that as well.
Gleaning some clues from this post, I took a few stabs in the dark by adding the following buildbacks, then re-running the attempts above, but to no avail:
heroku plugins:install https://github.com/heroku/heroku-buildpacks
Installing heroku-buildpacks... done
heroku config:add BUILDPACK_URL=https://github.com/benjie/heroku-buildpack-apt
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby
heroku config:add BUILDPACK_URL=https://github.com/atris/heroku-buildpack-C
For what it's worth, this is a rails 4 project running under heroku's cedar stack.
Thanks!
Upvotes: 2
Views: 590
Reputation: 369
7 years late but...
I ran into this same problem and discussed it with tech support @ Heroku. As indicated by the error, mpg123 is available through an apt-based package. Therefore, you can do this:
heroku login
heroku buildpacks:add --index 1 heroku-community/apt
# myapp/Aptfile
mpg123
git push heroku main
.Pretty straightforward approach in under 5 minutes. No need to create a custom buildpack or switch to Amazon Web Services.
Upvotes: 0
Reputation: 509
The way Heroku works, all system dependencies like mpg123 have to get installed via buildpacks. This is because Heroku doesn't let an app write to the filesystem after it's been deployed (which is why your brew and apt commands won't work).
So if you want to do this, you'll probably have to create a custom buildpack for mpg123, since it doesn't appear that anyone else has built one yet.
For an example of a custom buildpack, check out the LAME one: https://github.com/lepinsk/heroku-buildpack-lame
Then, you'll want to use the multi-buildpack buildpack which will let you install both your mpg123 buildpack and your app buildpack (for example, Ruby).
Upvotes: -1