For some backstory and reference, here are some quotes from a few Heroku documentation pages.
From the Heroku Node.js Support > Activation:
The Heroku Node.js buildpack is employed when the application has a
package.json
file in the root directory.
From Heroku Node.js Support > Default web process type:
First, Heroku looks for a Procfile specifying your process types.
If no
Procfile
is present in the root directory of your app during the build process, your web process will be started by runningnpm start
, [...]
From Process Types and the Procfile > Process types as templates:
A Procfile contains a number of process type declarations, each on a new line. Each process type is a declaration of a command that is executed when a dyno of that process type is started.
For example, if a
web
process type is declared, then when a dyno of this type is started, the command associated with theweb
process type, will be executed. This could mean starting a web server, for example.
I have a package.json
file in the root (which will activate the Node.js buildpack), and I've also included a Procfile
in the root with the following contents:
service: npm start
I would assume that not defining a web
dyno would cause it to not be created; only the service
dyno should be created, following the configuration declared in the Procfile
.
Instead, what happened is that an active web
dyno was automatically created using npm start
and an inactive service
dyno was created using the definition in Procfile
. I then had to:
heroku ps:scale web=0
heroku ps:scale service=1
I can definitely imagine wanting to run a Node.js "service" application on Heroku that does not accept any incoming connections, only making outgoing ones. Is there a way to configure the Node.js buildpack to not automatically create a web
dyno when one is not defined? I've looked through lots of documentation looking for a way to either: (1) define it as such or (2) remove the automatically generated web
dyno; but, I haven't found anything.
Thanks for the help!
heroku.yml
file instead of Procfile. Any idea what do i do in this case? – Higginson