I am trying to deploy nodejs in a windows environment. As far as I can see nodejs is just a standard application run through the command-line. However running it that way is not very practical in a server environment. Is there a way to run it as a windows service, so you get all the benefits of controlling the execution as you have with other services? I found similar forum entries about this subject, however they are all related to running nodejs in a linux environment, how would you go about doing this in a window environment?
-
What's not practical?hexacyanide– hexacyanide2013-09-16 16:41:01 +00:00Commented Sep 16, 2013 at 16:41
-
1It's not practical, since it requires you to constantly be logged into the server in a session with a command line, and if the server is rebooted or nodejs crashes, you need to rerun the command, so you need to constantly monitor it.aggaton– aggaton2013-09-16 16:43:35 +00:00Commented Sep 16, 2013 at 16:43
-
3possible duplicate of How to install node.js as windows service?hexacyanide– hexacyanide2013-09-16 16:49:21 +00:00Commented Sep 16, 2013 at 16:49
-
2You might want to read this, hanselman.com/blog/… It basically solves all the problems you mentioned.Rosdi Kasim– Rosdi Kasim2014-03-10 17:01:18 +00:00Commented Mar 10, 2014 at 17:01
Add a comment
|
1 Answer
Nodejs application is not like mongodb, redis, nginx ... It's not supposed to run as an os service.
As a best practice, people usually use a process management tool like pm2 to run production nodejs applications. You can give it a try by creating a deploy.sh or deploy.bat as an execution file which trigger pm2 command to start or restart the application.
1 Comment
DollarAkshay
How about the MongoDB that goes along with the Node.js server ?