Created
April 24, 2018 17:00
-
-
Save AFlowOfCode/70ca8079d7bf36eb2a35ec956e97fae2 to your computer and use it in GitHub Desktop.
Simple bash script to update & restart a rails app on a live dev server when triggered by a webhook set to repo push. Args to script are: head_commit.id, pusher.name, pusher.email
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 | |
echo "commit: $1 by: $2 $3" | |
cd your/git_rails/project_root #REPLACE THIS | |
git pull | |
if [ -f tmp/pids/server.pid ]; then | |
echo "killing rails server" | |
kill -9 $(cat tmp/pids/server.pid) | |
fi | |
bundle install | |
rails db:migrate RAILS_ENV=development | |
rails s -b 0.0.0.0 -d | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment