Re: [nodejs] Re: How i can deploy nodejs in vps
I know this maybe be overkill for a little/single/attempt application, but check docker.io and dokku, it's very easy to set up and a joy to deploy :) Nuno Job has written a very good post how to get it started here: https://medium.com/code-adventures/438bce155dcb Cheers, David On Tuesday, August 27, 2013 1:04:28 AM UTC+1, Michael Pisarski wrote: Tim, I have a simple script in /etc/init.d (on CentOS/RHEL 5+) Looks something like this: #!/bin/sh # # chkconfig: 235 90 10 # description: Starts YOUR_SERVICE to control application. # source function library . /etc/rc.d/init.d/functions NAME=YOUR_SERVICE DAEMONDIR=/usr/bin DAEMON=/usr/bin/forever DAEMON_ARGS=-l /var/log/YOUR_SERVICE --append --silent --spinSleepTime 1000 --minUptime 1000 APPDIR=/usr/lib/node_modules/Your_APP APP_ARGS= # Exit if the package is not installed [ -x $DAEMON ] || exit 1 fail() { failure echo echo $1 } # # Function that starts the daemon/service # start() { echo -n $Starting $NAME: $DAEMON start $DAEMON_ARGS $APPDIR $APP_ARGS RETVAL=$? [ $RETVAL -eq 0 ] success || failure echo return $RETVAL } # # Function that stops the daemon/service THIS IS A LITTLE BRUTE FORCE but it works for me. # stop() { echo -n $Signaling $NAME to stop: $DAEMON stopall RETVAL=$? [ $RETVAL -eq 0 ] success || failure echo return $RETVAL } case $1 in start) start ;; stop) stop ;; restart) stop start RETVAL=$? ;; *) echo Usage: $NAME {start|stop|restart} exit 1 ;; esac exit $RETVAL That is all, then I can also use $ service YOUR_SERVICE stop|start|restart On Mon, Aug 26, 2013 at 7:34 PM, Dylan Hassinger d...@dylanized.comjavascript: wrote: For machine reboots, I think you would need a boot script that re-launches Forever. On Mon, Aug 26, 2013 at 5:35 PM, Tim Caswell t...@creationix.comjavascript: wrote: On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspi...@gmail.comjavascript: wrote: I use forever and have not had any issues. Does forever handle machine reboots? On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when i run with the command node, and i close my ssh program, my nodejs app is stopped. How i can deploy and keep running my app? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nod...@googlegroups.comjavascript: To unsubscribe from this group, send email to nodejs+un...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nod...@googlegroups.comjavascript: To unsubscribe from this group, send email to nodejs+un...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nod...@googlegroups.comjavascript: To unsubscribe from this group, send email to nodejs+un...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to a topic in the Google Groups nodejs group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/S8ujZwF6zXQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to
Re: [nodejs] Re: How i can deploy nodejs in vps
On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspis...@gmail.comwrote: I use forever and have not had any issues. Does forever handle machine reboots? On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when i run with the command node, and i close my ssh program, my nodejs app is stopped. How i can deploy and keep running my app? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [nodejs] Re: How i can deploy nodejs in vps
For machine reboots, I think you would need a boot script that re-launches Forever. On Mon, Aug 26, 2013 at 5:35 PM, Tim Caswell t...@creationix.com wrote: On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspis...@gmail.comwrote: I use forever and have not had any issues. Does forever handle machine reboots? On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when i run with the command node, and i close my ssh program, my nodejs app is stopped. How i can deploy and keep running my app? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [nodejs] Re: How i can deploy nodejs in vps
Assuming your on linux: http://stackoverflow.com/questions/11275870/how-can-i-automatically-start-a-node-js-application-in-amazon-linux-ami-on-aws Also, wrap your process in forever to keep it up and running in case of faults. If you want to go all out, services like AppFog, NodeJitsu, and etc have opensourced the source to their systems. You could always stand it up on your VIP On Mon, Aug 26, 2013 at 4:35 PM, Tim Caswell t...@creationix.com wrote: On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspis...@gmail.comwrote: I use forever and have not had any issues. Does forever handle machine reboots? On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when i run with the command node, and i close my ssh program, my nodejs app is stopped. How i can deploy and keep running my app? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [nodejs] Re: How i can deploy nodejs in vps
Tim, I have a simple script in /etc/init.d (on CentOS/RHEL 5+) Looks something like this: #!/bin/sh # # chkconfig: 235 90 10 # description: Starts YOUR_SERVICE to control application. # source function library . /etc/rc.d/init.d/functions NAME=YOUR_SERVICE DAEMONDIR=/usr/bin DAEMON=/usr/bin/forever DAEMON_ARGS=-l /var/log/YOUR_SERVICE --append --silent --spinSleepTime 1000 --minUptime 1000 APPDIR=/usr/lib/node_modules/Your_APP APP_ARGS= # Exit if the package is not installed [ -x $DAEMON ] || exit 1 fail() { failure echo echo $1 } # # Function that starts the daemon/service # start() { echo -n $Starting $NAME: $DAEMON start $DAEMON_ARGS $APPDIR $APP_ARGS RETVAL=$? [ $RETVAL -eq 0 ] success || failure echo return $RETVAL } # # Function that stops the daemon/service THIS IS A LITTLE BRUTE FORCE but it works for me. # stop() { echo -n $Signaling $NAME to stop: $DAEMON stopall RETVAL=$? [ $RETVAL -eq 0 ] success || failure echo return $RETVAL } case $1 in start) start ;; stop) stop ;; restart) stop start RETVAL=$? ;; *) echo Usage: $NAME {start|stop|restart} exit 1 ;; esac exit $RETVAL That is all, then I can also use $ service YOUR_SERVICE stop|start|restart On Mon, Aug 26, 2013 at 7:34 PM, Dylan Hassinger d...@dylanized.com wrote: For machine reboots, I think you would need a boot script that re-launches Forever. On Mon, Aug 26, 2013 at 5:35 PM, Tim Caswell t...@creationix.com wrote: On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski mspis...@gmail.comwrote: I use forever and have not had any issues. Does forever handle machine reboots? On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote: Hi. I need help, im very newbie about how deploy my nodejs app in production,i have always worked in localhost, but i dont know how i can deploy an app and run always, when i run with the command node, and i close my ssh program, my nodejs app is stopped. How i can deploy and keep running my app? -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to a topic in the Google Groups nodejs group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/S8ujZwF6zXQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Michael S. Pisarski --- mspis...@gmail.com phone: 704.900.3130 --- I cannot imagine how the clockwork of the universe can exist without a clockmaker. - Voltaire -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines:
Re: [nodejs] Re: How i can deploy nodejs in vps
This is incorrect, screen allows you to partition a console but will not guarantee your service is automatically started at boot time or restarted if it fail. As Ryan said, it depends what OS are you targeting. The way you do services in ubuntu is with upstart. You put an script under /etc/init/your-app.conf : description your-app author you setuid some-user start on (local-filesystems and net-device-up IFACE=eth0) stop on shutdown respawn respawn limit 15 5 script exec /var/log/$UPSTART_JOB.log 21 echo starting\ $UPSTART_JOB\ `date` cd /usr/local/lib/node_modules/your-app NODE_ENV=production CONFIG_FILE=/etc/your-app.json npm start end script You can store your application in any path, usually /opt, the one i used for this example assumes you install your-app as a global node module. This will redirect stdout and stderr to /var/log/your-app.log, make sure you create a logrotate rule. It also assumes you have some sort of config file in /etc/your-app.json. Then the service will be started when booting the OS, and restarted if it fails. You can also start/stop/restart manually as follows: service your-app stop/start/restart If you symlink /etc/init/your-app.conf to /etc/init.d/your-app, you will get also tab-completion in bash when writing service yo. Every SO has a different way of doing this : - initng - launchd - upstart - Service Management Facility - systemd - OpenRC - runit - daemontools to name a few. regards El ago 25, 2013 10:41 a.m., Ashutosh Das areos...@gmail.com escribió: You can use screen . Here is a tutorial : how-to-install-and-use-screen-on-an-ubuntu-cloud-serverhttps://www.digitalocean.com/community/articles/how-to-install-and-use-screen-on-an-ubuntu-cloud-server -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups nodejs group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups nodejs group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.