I'm trying to deploy my Discord Bot to Heroku and I've successfully linked my Github account to Heroku. It can successfully find the repository I'm trying to deploy, but when I try a manual deployment it gives me the error:
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
My bot is coded in Go, which is supported by Heroku. Could it be that my code has external libraries? If so, how can I add support for those libraries in Heroku? Thank you in advance.
On Heroku projects are compiled / built using so called buildpacks. Specific buildpacks are created for projects using different languages. For Go projects there exists the heroku/go which knows how to get, compile and build Go projects, including getting their dependencies automatically as part of the build process.
The buildpack selection can happen either manually or automatically. You see the error you posted because you have not set any buildpacks manually, and automatic detection failed for you. See reasons below.
Manual buildpack selection
For manual selection, download the Heroku CLI, and execute the following command:
heroku buildpacks:set heroku/go
Note: if you're using heroku cli for the first time, you may need to login using heroku login. Also if your app is not selected by default, you may specify it using the -a or --app argument, e.g.:
heroku buildpacks:set heroku.go -a yourappname
To see selected buildpacks, execute the heroku buildpacks command.
Automatic buildpack detection
Just because a project is using the Go language, the heroku/go buildpack does not get selected automatically.
The actual detection whether heroku/go should be used is done by the script heroku-buildpack-go/bin/detect, the detection logic is:
if test -f "${build}/Godeps/Godeps.json" || # godeps
test -f "${build}/vendor/vendor.json" || # govendor
test -f "${build}/glide.yaml" || # glide
(test -d "${build}/src" && test -n "$(find "${build}/src" -mindepth 2 -type f -name '*.go' | sed 1q)") # gb
then
echo Go
else
exit 1
fi
So basically the Go language is detected and heroku/go buildpack is selected automatically if one of the following file is present in your project:
Godeps/Godps.json; used by godep
vendor/vendor.json; used by govendor
glide.yaml; used by glide
src/*/*/**/*.go; used by GB
Further reading
Official articles about working with Go and Heroku:
Getting Started on Heroku with Go
Heroku Go Support
Related
I have added this pdftk buildpack to my free app on Heroku: https://github.com/fxtentacle/heroku-pdftk-buildpack.git.
I am unable to deploy my application to Heroku:
Preparing runtime environment...
-----> Checking for additional extensions to install...
-----> heroku-pdftk-buildpack app detected
cp: cannot stat 'binaries-heroku-18/*': No such file or directory
! Push rejected, failed to compile heroku-pdftk-buildpack app.
! Push failed
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
That buildpack hasn't been updated for the heroku-18 stack. Its compile script tries to copy precompiled binaries from binaries-$STACK/ into /app/bin/, but only contains binary directories for cedar-14 and heroku-16.
You could roll your app back to heroku-16, which will be supported until April, 2021, but of course this will also change other package versions:
heroku apps:stacks:set heroku-16 --app myapp
This would be very similar to going from Ubuntu 18.04 to Ubuntu 16.04, but it's likely to be your simplest solution.
Alternatively, you could fork the pdftk buildpack you found and update it for Ubuntu 18.04, but that isn't likely to be straightforward.
pdftk was removed from Ubuntu's official repositories because it depends on a deprecated library called gcj. The buildpack you're trying to use includes libgcj for cedar-14 and heroku-16 in their respective binary directories. You'll have to include that as well if you want to update the buildpack.
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
The error you're seeing is preventing your application from being deployed. You're not seeing a new version of the application with pdftk, but whatever was last deployed successfully. You'll have to resolve the build issue before you can use pdftk.
I followed this article (http://derekbarber.ca/blog/2014/11/20/using-pdftk-with-rails-on-heroku/) and got PDFTK working on Heroku-18, though on a Rails app.
Code excerpted below, HT #derek-barber.
mkdir -p [my_project]/vendor/pdftk/lib [my_project]vendor/pdftk/bin
cd /tmp
git clone https://github.com/millie/pdftk-source.git
cd pdftk-source
tar xzvf pdftk.tar.gz
mv bin/pdftk [my_project]/vendor/pdftk/bin/
mv lib/libgcj.so.12 [my_project]/vendor/pdftk/lib/
cd [my_project]
git add -f vendor/pdftk/
git commit -m "Add pdftk dependencies"
git push heroku master
heroku config:set LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/vendor/pdftk/lib
heroku config:set PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/vendor/p
Once this PR is merged: https://github.com/fxtentacle/heroku-pdftk-buildpack/pull/9 then the buildpack should work with heroku-18 stack.
Maybe leave a comment to the repo owner asking them to merge?
For now, you could use the forked & updated version: https://github.com/Aesthetikx/heroku-pdftk-buildpack which works with heroku-18 stack.
If you are using an app.json file, then point the pdftk buildpack to the forked version:
"buildpacks": [
...,
{
"url": "https://github.com/fxtentacle/heroku-pdftk-buildpack.git"
}
]
I am trying to install FFMPEG to work with my NodeJs server.
I am using heroku-buildpack-multi plugin:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
I have created a .buildpacks (without extesion) file at my github repository. This is what it includes:
https://github.com/jayzes/heroku-buildpack-ffmpeg
https://github.com/heroku/heroku-buildpack-nodej
Each time i am trying to push my changes to heroku, this is what i get:
-----> Fetching custom git buildpack... failed
! Push rejected, error fetching custom buildpack
Unforlunatly, there is not much information regarding ffmpeg installtion
on heroku. What am i missing here?
I just tried this with a demo app I cloned from Heroku:
https://github.com/heroku/node-js-getting-started.git
I was able to deploy successfully following the same steps you listed above, except I added an 's' to the end of your second buildpack (you have a typo - could this be the issue?): https://github.com/heroku/heroku-buildpack-nodejs
I would recommend following the same process with a fresh codebase to help troubleshoot your environment. But note two things: 1) The heroku-buildpack-multi plugin you're using is deprecated, and 2) Heroku officially supports multiple buildpacks:
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
and has an officially supported ffmpeg buidback you can use:
https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest
I'm attempting to upload a Play! 2.1 Project to Heroku, however the build keeps timing out after 15 minutes. (During the javascript minification/uglification stage).
Plan B is to simply compile it ourselves locally (play dist) and upload the resulting compiled package with a Procfile to launch it.
This fails, however, as Heroku seems intent on detecting source code and compiling it, and doesn't seem to be happy with executing a simple shell script.
Heroku push rejected, no Cedar-supported app detected
Is it possible to have heroku ignore the build process and simply execute my Procfile?
You'll have to push your zip file into a git repo, and then you'll have to use a special buildpack, and a special Procfile.
Maybe it can help : https://stackoverflow.com/a/16580332/320180
I am developing an Eclipse Virgo buildpack but when I try it with Heroku and push a trivial app, detection fails:
-----> Fetching custom git buildpack... done
! Heroku push rejected, no Cedar-supported app detected
The buildpack's detect script works fine locally in the root directory of the app:
$[...]virgo-buildpack/bin/detect .
Virgo Web
Any tips on how to debug this? I tried having the detect script write to stdout and stderr, but the output doesn't appear under "heroku logs".
I am running Mac OS X 10.8.2, Ruby 1.9.3p374, and gems 1.8.23.
Update: following the first two answers, I used a bash detect script to install the missing gem before driving a detect.rb script. I also changed the buildpack scripts to write to standard output.
The heroku push gets a lot further, but still fails. I can see the compile script exiting, but the release bash script has an echo command right at the start and this does not appear in the output.
So it seems that the release script is not being called.
The output is as follows (# indicates comments to avoid clutter):
-----> Fetching custom git buildpack... done
# detect script enter and exit
Virgo Web app detected
# compile script enter and exit
-----> Discovering process types
Procfile declares types
-> (none)
# detect script enter and exit (again)
Virgo Web -> web
-----> Compiled slug size: 60.4MB
-----> Launching... ! Heroku push rejected, failure releasing code
heroku logs --tail simply shows:
2013-03-06T10:53:48+00:00 heroku[slugc]: Slug compilation started
2013-03-06T10:54:27+00:00 heroku[slugc]: Slug compilation failed: failure releasing code
For a custom buildpack, the detect script doesn't really need to be that complicated because users will be specifying it manually with BUILDPACK_URL anyway. A sophisticated detect script really only makes sense for the default Heroku buildpacks because they need to detect if the buildpack applies for any given app.
If you want to completely punt on detection, you can get away with something like this:
#!/usr/bin/env bash
# bin/detect <build-dir>
echo "Vergo"
exit 0
Once you get that working (and work out any issues with compile and release), you can make it a little more intelligent. For example, you could detect if a certain file pattern exists:
#!/usr/bin/env bash
# bin/detect <build-dir>
if [ -f $1/index.jsp ]; then
echo "Vergo" && exit 0
else
echo "no" && exit 1
fi
Also, speaking of simplicity, it looks like you are basing your buildpack on the Ruby buildpack, which is one of the most complicated ones out there. You may want to take a look at the list of third-party buildpacks to see how most are done in simple bash.
Currnetly there are a few tools to make this much easier.
This build pack https://github.com/kr/heroku-buildpack-inline (A build pack to help construct buildpack)
heroku run bash Is your best friend.
Push your build pack on to the platform using the inline buildpack so that you can get good logging, and use heroku run bash so that you can actaully tinker with your buildpack in the environment that you will be using it in.
I'd like to deploy an app with a Procfile that runs
web: node myapp.js
Where myapp.js uses phantomjs-node to run headless webkit stuff, returning the results to browser requests. Is this possible?
I also ran into the same problem, the way I fixed it was by using this "Multiple Buildpack" Buildpack. Then in my .buildpacks file I put the following:
http://github.com/heroku/heroku-buildpack-nodejs.git
http://github.com/stomita/heroku-buildpack-phantomjs.git
Finally, you want to add PhantomJS to the path
heroku config:set PATH=$PATH:vendor/phantomjs/bin
I hope this helps.
Heroku Toolbelt now has first class support for multiple buildpacks, so you can get a working Node and PhantomJS setup with the following:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs.git
heroku buildpacks:add --index 1 https://github.com/stomita/heroku-buildpack-phantomjs.git
Here's a PhantomJS buildpack: https://github.com/stomita/heroku-buildpack-phantomjs
I also am able to run the x86_64 build of PhamtomJS, just stuck in my app's vendor directory:
http://phantomjs.org/download.html
Checkout my modified version of stomita that includes NodeJS, PhantomJS & CasperJS ready to run.
https://github.com/olragon/heroku-buildpack-nodejs
This is an old thread but for anybody that lands here I have created a working buildpack for Node and Phantom that's a fork of the official Heroku Node buildpack which incorporates the build scripts from Beedesk's custom Phantom buildpack. Here it is https://github.com/datamail/heroku-buildpack-nodejs-phantomjs
I have forked #stomita buildpack to use the official linux build binary from phantomJS.org. I tested it and it is working with heroku.
Hope some security paranoids like me out there will find it useful.
https://github.com/beedesk/heroku-buildpack-phantomjs
The disadvantage of my pack it that, unlike stomita's, it doesn't include fontconfig and freetype. But, PhantomJS should work without them.