1

I have deployed a Bitnami AMI of NodeJS on an AWS micro instance. After starting my node app, everything works fine.

After some time without any activity, the app which is attached to port :3000, seems to shut down. When this happens on refreshing the page my browser gives the message:

Network Error (tcp_error) 
A communication error occurred: "Connection refused"
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.

The AWS console shows the instance is still running and the Bitnami build still responds with the standard message on port 80.

zishe
  • 10,665
  • 12
  • 64
  • 103
user2302244
  • 843
  • 2
  • 11
  • 27
  • How do you launch your NodeJS application inside the instance? – supertopi May 29 '14 at 12:29
  • Good question. I have been reviewing possible causes and think I traced the problem to the ssh session terminating and taking the node app with it. I have now started the app using **nohup** and it seems to have stayed up for the last two hours. – user2302244 May 29 '14 at 13:39

3 Answers3

2

Forever (https://github.com/nodejitsu/forever) is also a useful tool for this kind of thing, and it gives you a little more control than nohup or screen.

BenV
  • 1,196
  • 1
  • 12
  • 19
  • Forever is already included in the Bitnami Node.js stack. Bitnami recommends this tool for managing the services. – Beltran May 30 '14 at 09:00
1

As we discussed in comments, the problem was binding the node process to SSH session.

You can use nohup or screen to launch the node process in an instance not bound to session. I suggest using screen because the function of returning to launched instance is essential for maintenance/updating.

Related: How to run process as background and never die

Related: Command-Line Interface tool to run node as a service

Community
  • 1
  • 1
supertopi
  • 3,469
  • 26
  • 38
0

Besides configuring an EC2-instance you can also use the PaaS-solution of AWS, namely Elastic Beanstalk. They have also support for Node.js and it's super easy to deploy your apps using this service.

laurund
  • 21
  • 2