Created
November 6, 2011 00:36
-
-
Save gabrtv/1342256 to your computer and use it in GitHub Desktop.
Gabrtv's Node.js Build Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# bootstrap application repository | |
cat > /tmp/bootstrap-app <<EOF | |
#!/bin/sh -e | |
git clone https://github.com/gabrtv/nodejs-sandbox.git app | |
cd app | |
npm install | |
EOF | |
chmod +x /tmp/bootstrap-app | |
su -l ubuntu -c /tmp/bootstrap-app | |
# install upstart daemon | |
cat > /etc/init/nodejs.conf <<EOF | |
#!upstart | |
description "node.js server" | |
author "OpDemand" | |
start on startup | |
stop on shutdown | |
script | |
export HOME="/home/ubuntu" | |
exec sudo -u ubuntu node /home/ubuntu/app/app.js 2>&1 >> /var/log/node.log | |
end script | |
EOF | |
# start the daemon | |
start nodejs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment