Skip to content

Instantly share code, notes, and snippets.

@gkrizek
Created June 27, 2016 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkrizek/631dc0fcdb13d666f5ee07cbad1fcb46 to your computer and use it in GitHub Desktop.
Save gkrizek/631dc0fcdb13d666f5ee07cbad1fcb46 to your computer and use it in GitHub Desktop.
Script to deploy a Meteor application. Requires the Server side script as well. See: https://blog.gitrandom.com
#!/bin/bash
###
# Script to Deploy Meteor App to server
# This has a counterpart on the server, which is called at the end of this script
###
# create by Graham Krizek on March 28, 2016
###
#
echo "Are you deploying to production or staging?"
read ENV
if [ $ENV == "production" ]; then
echo "DEPLOYING TO PRODUCTION"
echo " "
BRANCH="master"
SSH="SSH-PROD-CONFIG-NAME"
elif [ $ENV == "staging" ]; then
echo "DEPLOYING TO STAGING"
echo " "
BRANCH="development"
SSH="SSH-STAGE-CONFIG-NAME"
else
echo "Not a valid environment"
exit
fi
APP_NAME="APPNAME"
ROOT="/Users/AppleUser/Documents/$APP_NAME"
echo "BUILDING THE APP"
cd $ROOT
git checkout $BRANCH
meteor build ./ --architecture=os.linux.x86_64
if [ -a $ROOT/$APP_NAME.tar.gz ]
then
echo "SENDING THE FILES TO THE SERVER"
scp $ROOT/$APP_NAME.tar.gz $SSH:/home/LINUX-USER
else
echo "$APP_NAME.tar.gz does not exist. Make sure the build was successful."
exit
fi
ssh $SSH "/home/LINUX-USER/gr-deploy-server.sh"
rm -rf $ROOT/$APP_NAME.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment