I have googled this question for a while but can't find the answer. My question is while deploying the nodejs application on aws elastic-beanstalk servers, I want the nodejs application would be restart automatically if the application crash.
Actually there're few nodejs package already support this by command line, such as forever, but there's no easy way from console management or awscli to install this package and execute it to achieve restart automatically.
I am wondering how do you resolve the restart issue on aws eb?
You simply use the AWS Management Console, a Git repository, or an integrated development environment (IDE) such as Eclipse or Visual Studio to upload your application, and Elastic Beanstalk automatically handles the deployment details of capacity provisioning, load balancing, auto-scaling, and application health ...
You can go to EC2 -> Auto Scaling Groups . Then change the Health Check Type of the load balancer from EC2 to ELB . By doing this, your instances of the Elastic Beanstalk will be terminated once they are not responding. A new instance will be created to replace the terminated instance.
I've confirmed (as of Mar 11, 2015) that EB does indeed restart node for you.
To confirm, I added a hidden query param to my app:
if (req.query.testcrash == 'true') { setTimeout(function(){ undefined.crashMe(); }, 100); }
Then verified in the log that the exception happened, and that my app was restarted.
For reference:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With