diff --git a/deploy.sh b/deploy.sh index 98ed4603..87e880ee 100755 --- a/deploy.sh +++ b/deploy.sh @@ -2,33 +2,36 @@ echo "Deploying art.shburg.org" -NODE_ENV=production gulp deploy - server="art.shburg.org" tarfile="build.tar.gz" tarpath=$TMPDIR${tarfile} destpath="~/www/art.shburg.org" -echo "Packing..." +echo "Building..." +npm run out +NODE_ENV=production gulp deploy + +echo "Packing $tarpath" env GZIP=-9 tar -czf ${tarpath} \ --disable-copyfile \ --exclude=node_modules \ --exclude=.git \ --exclude=.idea \ --exclude=.DS_Store \ + --exclude=src \ --exclude=deploy.sh \ --exclude=install.sh \ . -echo "Build file: $tarpath" - +echo "Uploading..." #ssh h "rm -rf $destpath/*" ssh h "rm -rf $destpath/public/*" scp ${tarpath} hoster@${server}:${destpath} -echo "Build file successfully uploaded on server" echo "Installing..." ssh hoster@${server} "bash -s" -- < ./install.sh ${destpath} ${tarfile} +echo "Clear..." rm ${tarpath} + echo "Done" diff --git a/forever.json b/forever.json new file mode 100644 index 00000000..8de4e789 --- /dev/null +++ b/forever.json @@ -0,0 +1,8 @@ +{ + "uid": "hudozka", + "append": true, + "watch": false, + "script": "index.js", + "sourceDir": "/home/hoster/www/art.shburg.org/out", + "wordingDir": "/home/hoster/www/art.shburg.org" +} diff --git a/install.sh b/install.sh index 428f63cc..5ac2b353 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,8 @@ dir_path="$1" build_file="$2" +app="hudozka" +script="forever.json" cd ${dir_path} @@ -12,9 +14,9 @@ gunzip -c ${build_file} | tar xopf - npm install --production --loglevel error #starting www -if forever restart src/bin/www.js; then - echo www.js restarted +if forever restart ${app}; then + echo App restarted else - forever start src/bin/www.js - echo www.js started + forever start ${script} + echo App started fi