2

Is it possible to switch a Heroku app on the Cedar stack from one language to another?

In this particular instance I am trying to migrate an app from PHP to NodeJS, which is being detected as a NodeJS app after performing a git push:

-----> Heroku receiving push
-----> Node.js app detected
-----> Fetching Node.js binaries
-----> Vendoring node 0.4.7
-----> Installing dependencies with npm 1.0.94

       Dependencies installed
-----> Discovering process types
       Procfile declares types -> web
-----> Compiled slug size is 5.0MB
-----> Launching... done, v7

... however it then crashes with:

Error: No such file or directory - node main.js

Trying to run the Node REPL also suggests the binary doesn't exist:

> heroku run node
Running node attached to terminal... up, run.1
sh: node: not found

Is there any way to reinitialise a Cedar stack app, without creating a new instance?

Scott Christopher
  • 6,458
  • 23
  • 26
  • why would you not just create a new app entirely and push to that? – John Beynon Dec 05 '11 at 07:57
  • @JohnBeynon - The main reason was to prevent having to update DNS records and/or clients that are connecting to the existing instance. If the recommended approach is to simply create a new instance and kill off the old one, it could be helpful to notify the user of this when a different application type is detected during deployment. – Scott Christopher Dec 05 '11 at 08:15
  • you wouldn't in fact have to change any DNS records - it's just a matter of moving the custom domain from one app instance to the other on Heroku. If you're changing the underlying language from PHP to Node it seems wise to have a new app that you can test before letting users loose on it? – John Beynon Dec 05 '11 at 09:26
  • We're testing this out on our staging instance, which is how we came to discover the issue. Anyway, it looks like it may be easier to create a fresh new instance. Thanks. – Scott Christopher Dec 05 '11 at 12:04

2 Answers2

2

I know it's an old question but I ran into this problem changing my app from PHP to NodeJs. The first time I run the git push heroku master I got an error saying that it couldn't use PHP buildpack.

So I went in my app Settings tab in Heroku dashboard and remove the PHP buildpack from the Buildpacks list. Finally whe I ran git push heroku master, Heroku auto detected the NodeJS buildpack.

Thierry D.
  • 338
  • 3
  • 11
  • 2
    You're a life saver! I did just this and my app worked! :) – Alexandra Oct 28 '18 at 21:46
  • I believe that's a more appropriate answer to the question than the accepted one. "Delete buildpack", push new version and it will auto-detect new buildpack is an elegant solution that doesn't require instance recreation. – BinaryButterfly Oct 02 '19 at 02:11
2

Create a new instance application instance. It is probably not a good idea to try to morph one into the other. DNS will update for you automatically as that's handled by the routing mesh, and you'll be much happier and better off for it.

I (although a slightly different use case) migrated an application from Bamboo to Cedar and the whole process took me less than five minutes. The only downtime was a couple of seconds while I relocated the custom domain setup on the application.

Neil Middleton
  • 22,105
  • 18
  • 80
  • 134