Created
July 6, 2016 21:57
-
-
Save shavit/2489128681f8334421a9235d97f8e169 to your computer and use it in GitHub Desktop.
Deploy meteor app on 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/sh | |
# | |
# On your local machine | |
# | |
# local$ npm install --production | |
# local$ meteor build .build --architecture os.linux.x86_64 | |
# | |
# On your server | |
# | |
# Go to the git repository | |
# chmod +x hooks/post-receive | |
METEOR_PATH=/home/meteor/app | |
APP_PATH=/var/meteor/app | |
BUILD_PATH=/var/meteor/build | |
exit_on_err(){ | |
echo "---> Error occurred!" | |
} | |
# Extract files to bundle directory | |
echo "---> Receiving push as $USER" | |
git --work-tree=/var/meteor/app --git-dir=/var/repo/meteor-app.git checkout -f | |
cd ${BUILD_PATH} | |
tar -vzxf .build/MeteorApp.tar.gz | |
# Install dependencies with npm | |
echo "---> Installing with npm packages from `pwd`" | |
cd /var/meteor/build/bundle/programs/server | |
npm install | |
npm prune --production | |
# Move to the programs/server directory | |
echo "---> Moving the bundle directory to ${APP_PATH}" | |
cd /var/meteor | |
rm -rif /var/meteor/app/* | |
# mv /var/meteor/build/bundle/ /var/meteor/app | |
cp -R /var/meteor/build/bundle/* /var/meteor/app | |
echo "---> Restarting meteor app" | |
restart meteor_app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment