Is it possible to deploy the Node.js app to Heroku without a web dino?

For some background and reference, here are some quotes from several pages of Heroku documentation.

From Heroku Node.js Support> Activation :

Heroku Node.js buildpack is used when the application has a file package.jsonin the root directory.

From Heroku Node.js Support> Default Web Process Type :

First, Heroku is looking for a procfile specifying process types.

If the root directory of your application is not in the build process Procfile, your web process will be launched by running npm start, [...]

From Process Types and Procfile> Process Types as Templates :

The Procfile file contains several process type declarations, each of which contains a new line. Each type of process is a declaration of the command that runs when dyno starts this type of process.

For example, if a process type is declared web, then when you start dyno of this type, the command associated with the process type will be executed web. This may mean, for example, starting a web server.


I have a file package.jsonin the root (which activates Node.js buildpack), and I also included Procfilein the root directory with the following contents:

service: npm start

I would suggest that not defining a webdyno would not lead to its creation; you only need to create servicedyno following the configuration declared in Procfile.

, web npm start service Procfile. :

  • heroku ps:scale web=0
  • heroku ps:scale service=1

, "w630".js "service" Heroku, , . Node.js buildpack, web dyno, ? , : (1) (2) web dyno; .

!

+4
1

Heroku. , . Heroku!


: no, heroku scale web=0 service=1, web. :

, Node.js Buildpack Procfile , , web: npm start. -, Procfile, , web .

, buildpacks , . Node - buildpack, Java, Python, PHP Ruby . , Procfile Node , - , Node Procfile (web: npm start), buildpack Procfile . , Procfile , , .

, Procfile default_process_types bin/release. , Procfiles, default_process_types , Procfile, web, Procfile, web

+4

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


All Articles