如何在生产中不使用docker部署分子项目?
在不使用docker和Kubernetes的情况下,如何在服务器上部署分子微服务项目?
我将更新后的代码拉入服务器并运行 npm run dev 命令项目,按方面运行。
但现在我想为这个项目设置pm2,那么我需要做什么?
我尝试在服务器上运行 npm run start 命令,但输出低于结果,并且项目未运行。
请帮忙。
How should I deploy a molecular microservice project on the server without using docker and Kubernetes?
I pull my updated code into a server and run the npm run dev command project run as per aspected.
But now I want to set up pm2 for this project so, what do I need to do?
I try to run npm run start command on a server but I am getting below output and the project is not running.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的问题是您没有配置要启动的服务。对于 Docker 和 Kubernetes 环境,我们使用 SERVICES 环境变量来配置 Moleculer 节点上应加载哪些服务。
所以你也可以使用这种方式,或者修改
package.json
中的start
脚本并设置你想要加载的服务。例如Your problem is that you didn't configure the services to start. For Docker and Kubernetes environment, we use
SERVICES
env variable to configure what services should be loaded on a Moleculer node.So you can also use this way, or modify the
start
script inpackage.json
and set the services what you want to load. E.g.我得到了解决方案。
如果我们不使用 Docker 和 Kubernetes 来执行 molecularclar 项目,而是直接在服务器上克隆我们的代码,就像普通的 NodeJS(Express) 项目一样。
然后我们需要创建index.js 文件并需要添加以下几行。
因此,使用上述命令 Molecular 启动了我们项目的所有服务。
在索引文件之后,我们可以使用 pm2 服务启动我们的项目。
I got the solution.
If we not use the Docker and Kubernetes for moleclar project and directly clone our code on server same as like normal NodeJS(Express) project.
Then we need to create index.js file and need to put below lines.
So, using above command Molecular started all the service of our project
After, index file we can able to start our project using pm2 service.
我创建了一个启动脚本(api-init.json)如下:
然后使用 pm2 启动:
I created a start script (api-init.json) as below:
Then use pm2 to start: