How do I install FFMPEG inside Heroku? - heroku

I am hosting a Discord music bot on Heroku and it seems it won't play music as the FFMPEG is not found. This is understandable as the FFMPEG is only available within my PC and not on the external cloud. What can I do to install FFMPEG on Heroku?

Self answering as I had this problem and wish to share what I found:
Heroku supports ffmpeg as a buildpack to your app. Simply open you app settings at https://dashboard.heroku.com/apps/[app-name]/settings and scroll down to Buildpacks, where you should add https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git to it.
Alternatively you can also run the CLI command:
$ heroku buildpacks:add https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
Source:
https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest

Related

would like to run a third party executable on Azure VM

I would like to run ffmpeg.exe and process media files on Azure VM. Do I need to add the exe anywhere in the VM settings? I have copied ffmpeg.exe to Azure VM and trying to run a command, but ffmpeg.exe --help also not returning anything, no error either. Do I have to whitelist the .exe in order to run it on Azure VM?
If you are using a Linux image then one way would be directly installing the ffmpeg using package manager instead of the .exe file. Just run the following commands in the vm
sudo apt update
sudo apt install ffmpeg
Now if you have a windows server just make sure that you are in the folder where the ffmpeg.exe is located. If you want to run the ffmpeg anywhere on the server you will have to install you can refer this answer by the user - peanut_butter

How to deploy a Jython app on Heroku

Is it possible to deploy a Jython app, which uses Flask, on Heroku? There is very little info on this, and according to this article it should be possible by adding a pom.xml: http://venturebeat.com/2011/08/26/heroku-java/. I know Heroku supports JRuby natively, but there's nothing on Jython.
I have an app that references a .jar library, from within Jython. When trying to push the local git repo to Heroku a Python app is detected, packages in requirements.txt file are installed and deploy completes. Unfortunately, when accessing the app online, I get an Application error (Note: gunicorn package has been installed to project and added to requirements.txt). The Log states the following:

Is it possible to run xvfb on Heroku?

I'd like to run xvfb on Heroku. On my mac, I used the dmg to install it. Would anyone have any idea how to go about this on Heroku?
I came across these buildpacks (http://github.com/douglasjsellers/heroku-xvfb-buildpack) - but following the instructions didn't seem to solve the problem as xvfb is still not installed properly. Also, I tried installing the xvfbwrapper (https://pypi.python.org/pypi/xvfbwrapper/0.1.0), but it's still not working on Heroku (apologies for what is potentially a noob question).
Here is the error I get in my logs off of Heroku:
2015-02-24T02:09:16.035298+00:00 app[web.6]: cmd=['Xvfb', '-help']
2015-02-24T02:09:16.035564+00:00 app[web.6]: Program install error!
2015-02-24T02:09:16.035302+00:00 app[web.6]: OSError=[Errno 2] No such file or directory
Here is the code:
temp = tempfile.mkstemp(suffix='.html')
html = os.fdopen(temp[0], "r+")
html.write(cv)
html.seek(0, 0)
display = Display(visible=0, size=(800, 600))
display.start()
# Open the file on Selenium to load the JavaScript
driver = webdriver.Firefox()
driver.get("file://" + temp[1])
I found this question while researching how to update Xvfb for Cedar-14, and I managed to get #2 to work. So here's how:
I used buildpack-apt to install x11-xkb-utils xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic libxfont1 xvfb.
After running the apt buildpack, you need to patch Xvfb a bit to make everything work smoothly. For that, I used my own run-bash buildpack, but everything that lets you run a bash script during Heroku compile will work. Here's the script I used to patch Xvfb and index the fonts: https://gist.github.com/fxtentacle/960cdb96ece01add8686
Now you can use heroku run bash to check with XAUTHORITY=/tmp/xvfb-run.2NG0xl/Xauthority Xvfb ":99" -screen 0 1280x1024x24 -nolisten tcp that the Xvfb is working.
Yes, it is possible, but complicated. I followed some of what fxtentacle did (in their answer), but this may be simpler. These instructions provide for a minimal Xvfb setup; it still prints out a bunch of warnings.
Use heroku-buildpack-apt to install the xvfb and libnotify4 debian packages. Then use this buildpack to fix the /usr/bin/xkbcomp issue:
https://github.com/captain401/heroku-buildpack-xvfb
Then you can use xvfb-run $PROGRAM to run your application.
I'm wondering the same thing. Seems like you already found this guy's issue. All the buildpacks mentioned are 1+ years old, and don't work anymore.
Two viable seeming options:
Compile a self-contained xvfb binary a la https://github.com/kenshin23/xvfb-portable-binary that runs on Heroku's current OS and architecture, rebuild when they update.
Install all dependencies from the apt package manager into someplace like ~/.apt, and run from there, as in the latest buildpack-apt. For me, this option dies with sh: 1: /usr/bin/xkbcomp: not found. Xvfb is looking in /, while apt installed the command to ~/.apt/usr/bin/xkbcomp. Haven't figured out how to tell Xvfb to look in ~/.apt/.

Bored to write app name in every heroku command though I got only 1 app [duplicate]

This question already has answers here:
Is there a way to set a default app for Heroku Toolbelt?
(3 answers)
Closed 1 year ago.
Heroku toolbelt is always forcing me to write an app name at the end like this:
heroku pg:reset DATABASE --app [app_name]
Is there a way to set the default app to which all my CLI heroku commands will apply?
Going to post this just in case it helps someone else out. I had the same problem even though there was only one app installed. I had to switch my heroku remote url from https to git.
https://git.heroku.com/[heroku-app-1234].git
to
git#heroku.com:[heroku-app-1234].git
Then everything worked normally for myself.
git remote remove heroku
git remote add heroku git#heroku.com:[heroku-app-1234].git
If heroku is claiming that there are multiple apps in the folder you must have more than one remote in your .git/config.
Remove the extra heroku remote or set the default using git config heroku.remote remote_name
If you have the heroku-accounts plugin installed, switching to the heroku branch worked for me, as discussed in this answer.
To swap out your existing version of the heroku-accounts plugin, use:
heroku plugins:install https://github.com/heroku/heroku-accounts.git
Note that if you've followed #Moemars answer, you'll need to switch your git remote back to https.
If you run heroku from the Git repo linked to your Heroku app, you don't have to specify an app name (unless the repo is connected to multiple apps).
This seems to be the easiest way to fix the issue:
heroku git:remote -a <app_name>
Since this wasn't mentioned until now:
Apart from the git remote, the Heroku CLI also looks into the HEROKU_APP environment variable.
By using direnv, dotenv or similar tools for project-specific environments you can easily set the respective Heroku app for each project or directory.

how to run phantomjs on heroku?

I am trying to run phantomjs on the heroku cedar stack.
I am using a phantomjs buildpack for heroku https://github.com/stomita/heroku-buildpack-phantomjs.
However I followed the instructions but still cannot make it work.
When I run the command heroku run bash and type phantomjs --version it says phantomjs: command not found
I read things about LD_LIBRARY_PATH that needs to be set to "/usr/local/lib:/usr/lib:/lib:/app/vendor/phantomjs/lib", this is what i did but without success.
Is there something that i am missing ?
Where does the buildpack install the phantomjs binary exactly ? Is there a way to know the path where the binary is ?
I am using ruby 1.9.2
Thanks a lot for your help.
EDIT: To be more precise, i want to combine ruby and phantomjs, so i am using this custom buildpack: https://github.com/ddollar/heroku-buildpack-multi, but when i push to heroku i get "Heroku push rejected, failed to compile Multipack app"
Download the 64-bit linux binary file from phantomjs.org here http://phantomjs.org/download.html
Create a bin/ directory in your app if you do not already have one and place the binary file there. You should then be able to test if you can run it with "heroku run 'phantomjs'" or "heroku run 'bin/phantomjs'"
For phantomjs with javascript
I dont know if the previous examples are actually necessary becasue although i am working with javascript it should not be different. For me all i had to do was place the phantomjs buildpack as the first on the list of installed buildpacks on your master.
check available buildpacks
open terminal from the app folder and type:
heroku buildpacks
This wll show the available buildpacks.
eg.
1.heroku/node.js
2.https://github.com/stomita/heroku-buildpack-phantomjs.git
As you can see the buildpack is second on this list. We need tomake it the first in the list.So, what i did was i removed the phantomjs builpack and then add it again but this time made sure its first on the list of all available buildpacks.
So, to remove a buildpack, type:
heroku buildpacks:remove https://github.com/stomita/heroku-buildpack-phantomjs.git
this removes the buildpack.You can check it by typing:
heroku buildpacks
Now, it should only show,
1.heroku/node.js
Great, now we add the phantomjs buildackmaking sure its first . So on terminal type:
heroku buildpacks:add --index 1 https://github.com/stomita/heroku-buildpack-phantomjs.git
You can check if its first by typing:
heroku buildpacks
Now, it should be ,
1.https://github.com/stomita/heroku-buildpack-phantomjs.git
2.heroku/node.js
Thats It!!
now, on terminal , type:
heroku run bash
once you're in bash, type
phantomjs --version
The current verion of phantomjs should be shown on the terminal.
2.1.1

Resources