Last active
August 29, 2015 14:05
-
-
Save timemachine3030/175b44887bf5ff2ea36c to your computer and use it in GitHub Desktop.
Update a rackspace nodejs delopyment
This file contains 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 -e | |
cd /var/apps | |
GIT=`which git` | |
REPO=$1 | |
echo repo: $REPO | |
## Get the hash othe origin/master | |
HASH=$(eval GIT_SSH=/var/apps/deploy-ssh-wrapper $GIT ls-remote $REPO refs/heads/master | awk '{print $1}') | |
## Clone origin master | |
if [ ! -d "releases/$HASH" ]; then | |
echo cloning: releases/$HASH | |
GIT_SSH=/var/apps/deploy-ssh-wrapper $GIT clone $REPO --depth=1 releases/$HASH | |
## Reset symlink | |
rm current | |
ln -s releases/$HASH current | |
## update | |
cd current | |
npm install | |
cd - | |
else | |
echo clone exists: releases/$HASH | |
fi | |
source env.bash | |
## restart server (stop/restart to get new environment) | |
forever stop current/server.js | |
forever start current/server.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment