Can I use two languages โ€‹โ€‹in Heroku app?

I want to use Node.js as a Share.js and Ruby server for an interface. As far as I know, Heroku allows only one web process called "web". Anyone have experience trying to do something like this?

+6
source share
3 answers

No, Heroku detects the type of application when you click your code on Heroku and it compiles the slug. You will need to have them as separate applications with a specific API between them (not always bad)

UPDATE: you can โ€œstackโ€ buildpacks these days, like Ruby + PHP, so you can do both. See https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app for using multiple build packages in one application.

+8
source

As a caution, you can technically install two languages โ€‹โ€‹in one application, but I'm not sure if they will run them at the same time. I made this buildpack to combine NodeJS and PHP (so that I can run Grunt at compile time):

https://github.com/gcpantazis/heroku-buildpack-php-gruntjs

Detecting a language is usually pretty dumb; it will search for a file pointing to the language, i.e. index.php or rakefile. You will need to change the detection box for your code to pass.

Update:

Think better using https://github.com/ddollar/heroku-buildpack-multi ; this will allow you to install buildpacks sequentially. Depending on your application, you may need to find language packs that do not have validation steps, i.e. Checking the package.json file in a NodeJS application.

+3
source

Yes, basically I can assume if you are not doing something very complicated. I once deployed a Flask (Python) application that used Stanford CoreNLP - all written in Java. You will need heroku-buildpack-multi .

After adding this file, be sure to create a .buildbacks file and add all the assemblies you need from Heroku github .

This circumvents Heroku by detecting your application type and installs all the necessary assemblies from the .buildpacks file.

+1
source

Source: https://habr.com/ru/post/910626/


All Articles