Created
November 23, 2014 20:56
-
-
Save arthur-feral/95c264fc0655dbe84e8f to your computer and use it in GitHub Desktop.
Git hook for deploying rails application
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 -l | |
APP_NAME="rpi_server" | |
APP_PATH=/home/pi/Web/${APP_NAME} | |
GIT_PATH=/home/pi/usbdrv/${APP_NAME}.git | |
# Production environment | |
export RAILS_ENV="production" | |
echo "[DEPLOY] - Updating application working tree" | |
git --work-tree=${APP_PATH} --git-dir=${GIT_PATH} checkout -f | |
cd ${APP_PATH} | |
echo "[DEPLOY] - Linking Configuration and directories" | |
if [[ -f "config/database.yml.template" ]]; then | |
cp -v config/database.yml.sample config/database.yml | |
fi | |
echo "[DEPLOY] - Deplying application" | |
bundle install --deployment --without=development:test | |
bundle exec rake server:stop | |
bundle exec rake db:migrate | |
bundle exec rake assets:precompile | |
mkdir -p tmp/ | |
bundle exec rake server:start | |
touch tmp/restart.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment