Created
June 23, 2012 23:51
-
-
Save eladb/2980597 to your computer and use it in GitHub Desktop.
mylittlepaas - ec2 user data
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/bash | |
# install node and friends | |
apt-add-repository -y ppa:chris-lea/node.js | |
apt-get update | |
apt-get install -y python-software-properties nodejs npm git make g++ | |
# install girror (https://github.com/eladb/node-girror) | |
npm install -g girror | |
# create /etc/init/paas.conf | |
echo 'start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
pre-start script | |
exec >> /var/log/paas.log 2>&1 | |
REPO=https://github.com/eladb/mylittlepaas | |
mkdir -p /var/log | |
mkdir -p /var/www | |
echo "Fetching app from $REPO" | |
girror $REPO /var/www | |
if [ -f /var/www/package.json ]; then | |
echo "Installing npm modules" | |
cd /var/www | |
npm install | |
fi | |
end script | |
post-stop script | |
exec >> /var/log/paas.log 2>&1 | |
echo "stopped" | |
end script | |
script | |
exec >> /var/log/paas.log 2>&1 | |
export NODE_ENV=production | |
export port=80 | |
echo "Starting app.js on port 80" | |
cd /var/www | |
node app.js | |
end script' > /etc/init/paas.conf | |
# start it | |
start paas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment