how to restart node application automatically on aws elastic-beanstalk

前端 未结 6 970
后悔当初
后悔当初 2021-02-01 19:34

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 ap

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 20:14

    After playing around with this a bit, and inspecting the process immediately after running

    aws elasticbeanstalk restart-app-server --environment-name my-env
    

    from @Human Love 's comment. I found these two commands for manually starting/stopping the process when ssh'd into the EC2. Not sure if these are recommended, but for quick debugging I find them useful

    # to start the process
    python /opt/elasticbeanstalk/containerfiles/ebnode.py --action start-all
    # to stop the process
    sudo python /opt/elasticbeanstalk/containerfiles/ebnode.py --action stop-all
    

    [NOTE]: this is a nodejs specific solution. Though other application types are probably pretty similar. To inspect the exact command. Open two terminal windows and

    1. in the first, run aws elasticbeanstalk restart-app-server --environment-name my-env
    2. in the second, run ps aux | grep python (I grepped for node because it was a node app)

    to find the specific /opt/elasticbeanstalk script

提交回复
热议问题