Created
April 1, 2016 12:38
-
-
Save marktyers/96673f9caa7b783e991fdc731bc92f25 to your computer and use it in GitHub Desktop.
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
set -v | |
echo "startup-script.sh has run" >> working.txt | |
apt-get update | |
apt-get install -yq ca-certificates git nodejs build-essential supervisor | |
curl https://nodejs.org/dist/v5.9.1/node-v5.9.1-linux-x64.tar.gz | tar xvzf - -C /opt/nodejs --strip-components=1 | |
ln -s /opt/nodejs/bin/node /usr/bin/node | |
ln -s /opt/nodejs/bin/npm /usr/bin/npm | |
git clone https://source.developers.google.com/p/autonect-api/ /opt/app | |
cd /opt/app/autonect-api | |
npm install | |
useradd -m -d /home/nodeapp nodeapp | |
chown -R nodeapp:nodeapp /opt/app | |
cat >/etc/supervisor/conf.d/node-app.conf << EOF | |
[program:nodeapp] | |
directory=/opt/app/7-gce | |
command=npm start | |
autostart=true | |
autorestart=true | |
user=nodeapp | |
environment=HOME="/home/nodeapp",USER="nodeapp",NODE_ENV="production" | |
stdout_logfile=syslog | |
stderr_logfile=syslog | |
EOF | |
supervisorctl reread | |
supervisorctl update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment