Skip to content

Instantly share code, notes, and snippets.

@tlack
Created March 26, 2012 21:47
Show Gist options
  • Save tlack/2209996 to your computer and use it in GitHub Desktop.
Save tlack/2209996 to your computer and use it in GitHub Desktop.
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
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment