Created
December 10, 2013 16:30
-
-
Save digilord/7893496 to your computer and use it in GitHub Desktop.
localdeploy.sh for a Meteor app. This script assumes that you are using upstart scripts, nginx with SSL, and nodejs from http://ppa.launchpad.net/chris-lea/node.js/ubuntu
This file contains 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 | |
function test { | |
"$@" | |
status=$? | |
if [ $status -ne 0 ]; then | |
echo "error with $1" | |
fi | |
return $status | |
} | |
APP_HOME=/home/meteor/myapp | |
git pull | |
echo "Update node" | |
# Need to update the package catalog. | |
apt-get update > /dev/null | |
# Need to clean up unused packages. | |
apt-get autoremove -y > /dev/null | |
# Finally install the latest version of node. | |
apt-get install -y nodejs | |
cd $APP_HOME/superslick-app/ | |
echo "Updating meteorite packages..." | |
test mrt install | |
test rm -rf packages/npm/.npm/ | |
echo "Bundling your app...." | |
test meteor bundle ../bundle.tgz | |
cd $APP_HOME | |
test rm -rf bundle | |
echo "Deploying bundled app." | |
test tar -xzf bundle.tgz | |
OldWD=`pwd` | |
cd bundle/programs/server | |
npm install fibers | |
cd $OldWD | |
echo "Updating upstart jobs." | |
cp upstart/* /etc/init/ | |
echo "Restarting the app service." | |
sudo service mymeteorapp restart | |
echo "Updating the nginx configuration." | |
sudo cp nginx/*.conf /etc/nginx/sites-available/ | |
sudo cp nginx/ssl/* /etc/nginx/ssl/ | |
sudo ln -sf /etc/nginx/sites-available/meteor.conf /etc/nginx/sites-enabled/meteor.conf | |
echo "Restarting nginx." | |
sudo /etc/init.d/nginx stop | |
sudo /etc/init.d/nginx start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment