Using pm2 to deploy multiple node. js projects, pm2node. js

Source: Internet
Author: User

Using pm2 to deploy multiple node. js projects, pm2node. js

Preface

I believe everyone knows that in actual project deployment, the node service needs to be automatically started when the server is started. Previously, it was started using the built-in commands of liunx. However, as the number of backend microservices increases. Each time a new program is released. It is too troublesome to modify the script. So we can change it to pm2. I will not talk about it much below. Let's take a look at the detailed implementation process.

The configuration method is as follows:

1. First install pm2

Npm install-g pm2

2. Generate a configuration file

Pm2 ecosystem

After the generation is complete, an ecosystem. config. js file will be generated,

3. modify the configuration file

Edit ecosystem. config. js

. The master needs to configure the program name, the program STARTUP script. You can.

4. Start the configuration file

Pm2 startOrRestart ecosystem. config. js

5. view the startup status

Pm2 list

Indicates that the program is successfully started.

The script startup command can be combined with nvm to support multiple node versions.

Summary

The above is all the content of this article. There are still many shortcomings in this article. I hope this article will have some reference and learning value for everyone's learning or work. If you have any questions, please leave a message, thank you for your support.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.