是否需要在 Procfile 中提供 'worker' 信息?如果是,那么它实际上是什么?我已经在 Procfile
中添加了 web: node server/server.js
详细信息。
最佳答案
Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform.
来自 Process Types and the Procfile ,这是一个很好的介绍,但基本上你使用 Procfile 来告诉 Heroku 如何运行你的应用程序的各个部分。每行冒号左边的部分是进程类型;右边的部分是启动该进程的命令。
进程类型可以是任何类型,尽管 web
很特殊,因为 Heroku 会将 HTTP 请求路由到以 web
名称开头的进程。其他进程(例如后台工作进程)可以任意命名,您可以使用 Heroku 工具带通过引用其名称来启动或停止这些进程。
所以,简而言之,worker
是不必要的,除非你想通过controlling process with the heroku ps
command 在后台运行一些其他进程.
https://stackoverflow.com/questions/16128395/