Skip to content
camposer edited this page Jul 31, 2012 · 6 revisions

I've been reading in the Express Forum about deploying Node.js applications and found some interesting points of view about that. My proposal is to deploy using Capistrano. I hope to comment about it in this space soon.

The thing that takes me to this space now is related to init scripts... Some days ago I was "fighting" against Pentaho BI Server init scripts, and based on my previous work, I propose the following script (init.d/sqlite) for Node.js applications. For installing, you need to change the following variables:

SQLITEAPP_DIR="/home/rodolfo/workspace/express-examples/sqlite"
SQLITEAPP_LOG="$SQLITEAPP_DIR/log/sqlite.log"

After changing that variables to the root directory where you have your Express App, and where you want to leave logs, you just have to follow this steps:

$ sudo cp init.d/sqlite /etc/init.d/sqlite
$ sudo chmod +x /etc/init.d/sqlite

You should change the name of the script and variables depending on your app name. For starting the server:

$ sudo /etc/init.d/sqlite start
$ sudo /etc/init.d/sqlite stop

NOTE: As you can see, my script has the name of the app, that's because I'm assuming one app per Node.js instance, but if you're going to have only one instance for all apps, you can rename all variables and script to something like node.js.

Enjoy!

Clone this wiki locally