I’m trying to run an old Node.js project in AWS Elastic Beanstalk. It sometimes crashes and the environment health goes to "Degraded," but instead of restarting the container, EB just leaves it hanging.
Looking at the logs, it appears that the container exits due to some socket.io error.
This question has been asked before, but this answer, this answer, and this reddit comment all suggest configuring a load balancer. However, I have a single-instance application and I have no load balancer at all.
Is it possible to have EB restart single-instance applications automatically?
2
Answers
A ELB (Load Balancer) can be used even with only one instance and might things easier if you want to scale-out in the future or consider other deployment strategies. So there is no technical harm in using one (except that it cost more, but that’s financially).
Instead of restarting the entire EB Application it’s better to Dockerize the app, and restart the Docker itself when it failed.