Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
#!/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