Skip to content

Commit

Permalink
Update deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Oct 24, 2019
1 parent b1907d6 commit 0de53ac
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/bin/bash
# Update code and restart server (run from app server)
# Update code and restart server (run on server)
set -e

if [ -d "/home/feross/www/instant.io-build" ]; then
if [ -d "/home/feross/www/build-instant.io" ]; then
echo "ERROR: Build folder already exists. Is another build in progress?"
exit 1
fi

cp -R /home/feross/www/instant.io /home/feross/www/instant.io-build
if [ -d "/home/feross/www/old-instant.io" ]; then
echo "ERROR: Old folder exists. Did a previous build crash?"
exit 1
fi

cp -R /home/feross/www/instant.io /home/feross/www/build-instant.io

cd /home/feross/www/instant.io-build && git pull
cd /home/feross/www/instant.io-build && rm -rf node_modules
cd /home/feross/www/instant.io-build && npm install
cd /home/feross/www/instant.io-build && npm run build
cd /home/feross/www/instant.io-build && npm prune --production
cd /home/feross/www/build-instant.io && git pull
cd /home/feross/www/build-instant.io && npm install --no-progress
cd /home/feross/www/build-instant.io && npm run build
cd /home/feross/www/build-instant.io && npm prune --production --no-progress

sudo supervisorctl stop instant

cd /home/feross/www && mv instant.io instant.io-old
cd /home/feross/www && mv instant.io-build instant.io
cd /home/feross/www && mv instant.io old-instant.io
cd /home/feross/www && mv build-instant.io instant.io

sudo supervisorctl start instant

cd /home/feross/www && rm -rf instant.io-old
cd /home/feross/www && rm -rf old-instant.io

0 comments on commit 0de53ac

Please sign in to comment.