简体   繁体   English

什么是Procfile? 和 Web 和 Worker

[英]What is Procfile? and Web and Worker

Is it necessary to give 'worker' information in Procfile?是否有必要在 Procfile 中提供“工人”信息? If yes then what it is actually - couldn't find nice article regarding this.如果是,那么它实际上是什么 - 找不到关于此的好文章。 I hope you guys might have idea.我希望你们能有想法。 I have already added web: node server/server.js detail in the Procfile.我已经在 Procfile 中添加了 web: node server/server.js 详细信息。 Any help would be appreciated!任何帮助,将不胜感激!

Procfile is a mechanism for declaring what commands are run by your application's dynos on the Heroku platform. Procfile 是一种机制,用于声明您的应用程序的 dynos 在 Heroku 平台上运行哪些命令。

From Process Types and the Procfile , which is a good introduction, but basically you use the Procfile to tell Heroku how to run various pieces of your app.来自Process Types 和 Procfile ,这是一个很好的介绍,但基本上您使用 Procfile 来告诉 Heroku 如何运行应用程序的各个部分。 The part to the left of the colon on each line is the process type;每行冒号左边的部分是进程类型; the part on the right is the command to run to start that process.右侧的部分是运行以启动该进程的命令。

Process types can be anything, although web is special, as Heroku will route HTTP requests to processes started with the web name.进程类型可以是任何类型,尽管web是特殊的,因为 Heroku 会将 HTTP 请求路由到以web名称开头的进程。 Other processes, such as background workers, can be named anything, and you can use the Heroku toolbelt to start or stop those processes by referring to its name.其他进程,例如后台工作人员,可以任意命名,您可以使用 Heroku 工具带通过引用其名称来启动或停止这些进程。

So, in short, worker is not necessary, unless you want to run some other process in the background by controlling process with the heroku ps command .因此,简而言之, worker不是必需的,除非您想通过使用heroku ps命令控制进程在后台运行其他一些进程。

You would only need a 'worker' entry in your Procfile if you plan on using some sort of background job system (ie queuing long running tasks for later).如果您计划使用某种后台作业系统(即,将长时间运行的任务排队以备后用),则您只需要在Procfile一个“worker”条目。 Heroku has more information here: Heroku 在此处提供更多信息:

https://devcenter.heroku.com/articles/procfile https://devcenter.heroku.com/articles/procfile

I was following Udemy course regarding nestjs and aws Elastic Beanstalk to deploy however it keeps failing to deploy until I created Procfile with following:我正在关注有关 nestjs 和 aws Elastic Beanstalk 的 Udemy 课程进行部署,但是在我使用以下内容创建 Procfile 之前,它一直无法部署:

web: npm install && npm run-script build && npm run-script start:prod web: npm install && npm run-script build && npm run-script start:prod

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM