Skip to content

Instantly share code, notes, and snippets.

@Davidtsang
Forked from S0c5/gist:10330613
Created August 12, 2019 17:41
Show Gist options
  • Save Davidtsang/91829d81f716a4d5072069170d66427b to your computer and use it in GitHub Desktop.
Save Davidtsang/91829d81f716a4d5072069170d66427b to your computer and use it in GitHub Desktop.
git-update-receive
#!/bin/bash -l
APP_PATH=/home/ubuntu/www
GIT_WORK_TREE=$APP_PATH
export GIT_WORK_TREE
export PADRINO_ENV="production"
export RACK_ENV="production"
exit_with_error(){
echo "[DEPLOY] !!!!!!!!!!!!!!!!!!!! Un error ah ocurrido !!!!!!!!!!!!!!!!!!!!!!!"
exit 1
}
echo "**********************************************************************"
echo " Deploying application... "
echo "**********************************************************************"
echo "[DEPLOY] - * Updating application working tree"
git checkout -f
echo "[DEPLOY] - * Running bundle"
cd $APP_PATH
bundle install
echo "[DEPLOY] - * Restarting application"
mkdir -p tmp/
touch tmp/restart.txt
echo "[DEPLOY] - * Update crontab"
whenever --update-crontab
echo "[DEPLOY] - * Successfully deployed application to ${APP_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment