From d3c7e444ea08fdd817615a19924bc740fae9568d Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Tue, 5 Jan 2016 00:48:49 +0300 Subject: [PATCH] big update for deployment system --- deploy.sh | 23 ++++++++++++++++------- install.sh | 15 ++++++++++----- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/deploy.sh b/deploy.sh index f510c129..54d523a6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,10 +1,16 @@ #!/bin/sh +echo "Deploying art.shburg.org" + NODE_ENV=production gulp -tarfile=build.tar.gz +server="art.shburg.org" +app_port=1800 +tarfile="build.tar.gz" tarpath=$TMPDIR$tarfile +destpath="~/www/art.shburg.org" +echo "Packing..." env GZIP=-9 tar -czf $tarpath \ --disable-copyfile \ --exclude=node_modules \ @@ -14,11 +20,14 @@ env GZIP=-9 tar -czf $tarpath \ --exclude=deploy.sh \ --exclude=install.sh . -echo "build file: $tarpath" +echo "Build file: $tarpath" + +ssh hoster.et "rm -rf $destpath/*" +scp $tarpath hoster@$server:$destpath +echo "Build file successfully uploaded on server" + +echo "Installing..." +ssh hoster.et "bash -s" -- < ./install.sh $destpath $tarfile $app_port -ssh shburg.et "rm -rf art/*" -scp $tarpath shburg@146.185.183.243:~ -scp install.sh shburg@146.185.183.243:~ -ssh shburg.et "./install.sh" rm $tarpath -echo "art.shlisselburg.org deployment completed successfully" +echo "Done" diff --git a/install.sh b/install.sh index b5070f36..2f6285f3 100755 --- a/install.sh +++ b/install.sh @@ -1,14 +1,19 @@ #!/bin/sh -gunzip build.tar.gz -tar xf build.tar -C ~/art -rm build.tar +dir_path="$1" +build_file="$2" +port="$3" + +cd $dir_path + +gunzip -c $build_file | tar xopf - + +#rm build.tar -cd ~/art npm install --production --loglevel error export NODE_ENV=production -export PORT=18010 +export PORT=$port #starting www if forever restart bin/www.js; then