Can I push to Heroku using a non-Cedar-supported app? - heroku

My app only uses PHP and SQLite.
I get this error:
Heroku push rejected, no Cedar-supported app detected

You should be a able to use PHP, there is a PHP buildpack — although it’s not very well documented on the Heroku site. Looking at its detect script, it is checking for an index.php file. Does your app have one? If not you’ll need to create one, if only so that it’ll be detected as a PHP app.
If your app still isn’t being detected as a PHP app, you could try explicitly specifying the buildpack to use with a config var:
$ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
A bigger problem is that you won’t be able to use SQLite on Heroku. Even if you were to create your own buildpack that added the relevant SQLite libraries, the read-only filesystem would mean it’s of little use. You should look into using Postgres (or possibly MySQL using an add-on).

Related

Is it possible to deploy a raw Java web app to Heroku?

Very inexperienced user here...please be patient!
I inherited maintenance of Heroku app from someone no longer with the company. Having to re-deploy an app update is probably a once-a-year event, and here we are.
The instructions I have include building a standalone jar file containing my app and then deploying it to Heroku. Specifically the procedure for this is to use the Heroku CLI with the following command:
heroku deploy:jar webapp.jar -a my-app
Easy enough. Except he had his own instance of the Heroku CLI, and when I went to download my own copy, it appears that the deploy command no longer exists! Is this the case? Is this a deprecated command? Do I need to go through the process of figuring out how to set up a git repository to deploy this? (We are in fact using git to manage the source for this app, but it's behind our company firewall, so I'm not sure how practical/difficult it will be to set this up for Heroku). I just want to make sure I'm not missing something simple before investing a significant amount of time re-inventing the deployment process. Thanks.
The most popular mechanism is indeed to push the code from git to Heroku, providing the necessary files (i.e. profcile) to deploy the runtime.
An alternative is to create a Docker image and push it to the Heroku Registry (which in your case would require more reworking).
Refer to Deploy with Git, the firewall should not be a problem as Heroku will not access your code, but you will need to perform the push (git push heroku master)
I have to answer my own question because I was able to find the solution.
It turns out there is a plugin available for the heroku CLI that provides the deploy command. Running heroku plugins:install java will install the plugin that provides the deploy command in the heroku CLI.
See https://devcenter.heroku.com/articles/deploying-executable-jar-files for more information.

Why do I need a procfile for my heroku flask app but I didn't need a procfile for my heroku express.js or rails apps?

I've previously deployed apps on heroku written in Rails and in Express.js, and never come across the concept of a Procfile before. Now that I've just gone to deploy a Flask app, I discovered this Procfile concept and found that the app would not run correctly without it. The Heroku docs say nothing about this being Flask-specific, and imply it's needed for all apps.
What's up with that? Why didn't I need it before, but needed it now?
In the package.json it tells Heroku how to execute the program. That's JavaScript specific. In other languages there is no such file hence the need for a Procfile.
Heroku needs to know how to execute your project.

Is it possible to get the release version in Heroku using PHP?

I'd like to get the release version of my app in Heroku on PHP. I was hoping it might be available as an environment variable, for example like $_ENV['HEROKU_RELEASE'] might retrieve v23. Is there a way to get ahold of this?
Yes, that is possible, by enabling dyno metadata on your app with the following command:
heroku labs:enable runtime-dyno-metadata -a
Then, Heroku will set a HEROKU_RELEASE_VERSION environment variable on your app (as well as other ones, which are all described in the article linked above).
That variable includes the number of the current release for your app.

Heroku addon - programmatically create a deployhook

When I implement a custom Herku Addon, is it possible for it to programmatically add a deploy hook to the application?
I.e. say my programmers always deploy their Heroku apps with:
> heroku addons:add myCompanyAddon
> heroku addons:add deployhook:http; url="http://mycompany.com"
I'd prefer it if my programmers could just print a single line:
> heroku addons:add myCompanyAddon
And mycompanyAddon would internally execute the 2nd line of adding the deployhook.
I thought it should probably be possible, since 'deployhook' is an addon by itself, which does exactly what I wanted...
thanks
You should be able to use the platform API in order to programmatically add add-ons in this way. You can find details about adding addons here: https://devcenter.heroku.com/articles/platform-api-reference#add-on-create

How can i create a clone of an existing app on heroku from another heroku app as separate app?

I have a main app on heroku and another app A on git in location github:a.
I want to create, when it is necessary, copies of A as A1,A2,A3...AN as separate apps on heroku from my main app automatically with different parameters.
How can i do that?
Edit: This process should be done by my main app automatically.
Updating this answer due to Heroku command DEPRECATION:
heroku fork has been deprecated as a core command as of 12/01/2017.
You will need to install the heroku-fork plugin to continue using this command.
heroku plugins:install heroku-fork
Here is a link to the Github plugin repo.
Use heroku fork to copy an existing application, including add-ons, config vars, and Heroku Postgres data.
See this KB page: Forking Applications.
Heroku toolbelt now provides a fork method to clone an existing application, see my answer here :
how to clone a project on heroku
There is a new feature on Heroku called Review Apps. One can create copies of the app manually or set up automatic copies from new PRs on Github.
Read more at: https://devcenter.heroku.com/articles/github-integration-review-apps
Simply create new applications and push your code to them. If you need to copy data, checkout the pgbackups transfers.
For management purposes, check out this dev center article.
To do this programatically, you'll need to look at the Heroku gem, and then figure out a way of getting something to git push to the appropriate remote. I would be surprised if this was possible to be honest.

Resources