How can I automatically start a node.js application in Amazon Linux AMI on aws?

前端 未结 8 999
轻奢々
轻奢々 2020-12-07 16:44

Is there a brief guide to explain how to start up a application when the instance starts up and running? If it were one of the services installed through yum th

8条回答
  •  渐次进展
    2020-12-07 17:23

    You can use forever-service for provisioning node script as a service and automatically starting during boots. Following commands will do the needful,

    npm install -g forever-service
    forever-service install test
    

    This will provision app.js in the current directory as a service via forever. The service will automatically restart every time system is restarted. Also when stopped it will attempt a graceful stop. This script provisions the logrotate script as well.

    Github url: https://github.com/zapty/forever-service

    As of now forever-service supports Amazon Linux, CentOS, Redhat support for other Linux distro, Mac and Windows are in works..

    NOTE: I am the author of forever-service.

提交回复
热议问题