Created
June 13, 2015 17:55
-
-
Save llaine/38cb1e8a8345925da3a8 to your computer and use it in GitHub Desktop.
Meteor deploy 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/bash | |
| # Global var | |
| readonly APACHE_DIR="/home/nicetomateyou" | |
| readonly SERVER_DIR="$APACHE_DIR/bundle/programs/server" | |
| readonly ARGC="$#" | |
| readonly VERSION="$1" | |
| readonly TARGET="prod" | |
| removingArchive() { | |
| echo "[!] Removing old archive" | |
| rm nicetomateyou.tar.gz | |
| echo "[!] Removing OK" | |
| } | |
| removingArchive | |
| echo "Deploying nicetomateyou.com" | |
| echo "---------------------------" | |
| echo "[!] Compressing archive ..." | |
| meteor build . | |
| echo "[!] Archive, compressed, deploying ... " | |
| scp nicetomateyou.tar.gz root@nicetomateyou.com:~ | |
| echo "[!] Deploying done, now connecting the server" | |
| ssh root@nicetomateyou.com /bin/sh <<\EOF | |
| APACHE_DIR="/home/nicetomateyou" | |
| SERVER_DIR="$APACHE_DIR/bundle/programs/server" | |
| cd ~ | |
| service nginx stop | |
| stop nicetomateyou | |
| rm -rf deploy | |
| mkdir deploy | |
| tar -zxf nicetomateyou.tar.gz -C deploy | |
| cp /home/nicetomateyou/nicetomateyou.log logs/nicetomateyou.log | |
| rm -rf /home/nicetomateyou/* | |
| echo "[!] removing old folder" | |
| mv deploy/* /home/nicetomateyou/ | |
| chown nicetomateyou:nicetomateyou /home/nicetomateyou -R | |
| cd $SERVER_DIR | |
| echo "[!] Installing dependencies ..." | |
| sudo npm install | |
| echo "[!] Removing bcrypt" | |
| sudo rm -rf npm/npm-bcrypt/node_modules/bcrypt/ | |
| sudo npm install bcrypt | |
| cp -r $SERVER_DIR/node_modules/bcrypt $SERVER_DIR/npm/npm-bcrypt/node_modules/bcrypt/ | |
| echo "[!] bcrypt install ---> OK" | |
| service nginx start | |
| start nicetomateyou | |
| exit 1 | |
| >> | |
| echo "[!] Deploying done, exiting" | |
| exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment