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
Related
I've been trying to set up migrations for a golang application on Heroku. I'm using native Go modules (vgo) and the official Heroku build pack. For migrations I'm using the migrate package.
The thing is, I could run migrations when the main function runs, but it feels a bit hacky, this would mean that every time the app restarts it will run the migrations. I would prefer to just run the schema migration when deploying.
I'm not sure how this can be accomplished, when I log in to the instance the go binary is not installed, it's like the build pack only executes the main function.
I could live with doing it with a Heroku CLI command but I can't find how to do this in the docs nor via Google.
All of your dependencies should be defined such that Heroku can install them for you. For Go, Heroku supports godep and govendor. If you're not already using one, pick one and start.
Your dependency file should be committed to your repository. For godep that's Godeps/Godeps.json and for govendor it's vendor/vendor.json. Your dependencies themselves should not be committed.
After you've added a dependency on migrate it should be available on Heroku. You can run migrate up and other commands via heroku run bash. Once you're comfortable running migrations manually you might want to consider adding a release phase command to your Procfile so migrations get applied automatically when you deploy a new version.
I am trying to make a copy of this Elm web-app with Heroku. When I click 'Deploy App' however, the build log displays this:
-----> Source app detected
-----> Creating profile.d script
SOURCE_VERSION:
Script installed to .profile.d/source_version.sh
-----> Elm app detected
-----> Retrieving 0.18.0
https://s3.amazonaws.com/heroku-buildpack-elm/assets/elm/0.18.0/elm:
2018-10-22 04:07:13 ERROR 403: Forbidden.
! Push rejected, failed to compile Elm app.
! Push failed
I have checked the app.json file and I didn't notice anything strange with it. Could this be related to the issues that Github is having right now (in Australia at least)? Am I doing something wrong? As soon as Github have fixed their issue I will try making an issue there, but the last commit was 2 years ago so that probably wouldn't do much. Thanks.
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
I have created one application using NodeJS, Angular and Express which I want to run at Heroku. Now, Im using Grunt to build the code that are placed in the dist folder and is ready to be deployed and run on Heroku. This would be done by pushing the dist folder in the Heroku git repo.
Now, should i push my source code in Heroku git as well?
If so, how should I seperate it from dist-folder repository? For instance, I dont want Heroku to run npm install each time i push changes to remote repo. And dist folder should not be part of the source code folder in the repository since it is auto generated.
Using a git repository is the only way to push changes to heroku. So yes it is mandatory. Having said that here is what they have to say about it.
Heroku provides the git service primarily for deployment, and the ability to clone from it is offered as a convenience. We strongly recommend you store your code in another git repository such as GitHub and treat that as canonical.
Again there is no way to stop them from doing an npm install on each push. Here is a quote from their getting started guide
Heroku recognizes an app as Node.js by the existence of a package.json. Even if your app has no dependencies, you should still create a package.json that declares a name, version, and empty dependencies in order that it appear as a Node app.
But I suppose that you could download all the dependencies of your app locally, not specify in package.json, push it along with rest of your application and you might trick heroku into thinking that there are no dependencies. Have not tried it myself though.
If you don't want dist folder to be a part of push simply gitignore it.
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.