Skip to content

Instantly share code, notes, and snippets.

@tlack
tlack / vhosted-node.sh
Created March 26, 2012 21:47
Idea for auto-deployment system for vhosted node.js apps
for DIR in /home/*/node; do
PORT=[generate port based on crc32 of $DIR]
# somehow check if not running
NODE_ENV=dev NODE_PORT=$PORT node-dev $DIR/app.js
cat /etc/nginx/configs.avail/default-node.conf | \
sed -e s/DIR/$DIR/ | \
sed -e s/PORT/$PORT > /etc/nginx/configs.enabled/node-$DIR.conf
# somehow check if we actually created/changed a config here
if [ $changed -eq 1 ]; then
service nginx restart
@tlack
tlack / express-js-dust-x-example.js
Created March 23, 2012 20:16
express-js and dust-x example app
/**
* Module dependencies.
*/
var express = require('express')
, dustx = require('dust-x')
/**
* Create the Express application.
*/