Skip to content

Instantly share code, notes, and snippets.

@CallumJHays
Created September 9, 2016 12:52
Show Gist options
  • Select an option

  • Save CallumJHays/9b14827e61795a256d28ec9eb655f2ce to your computer and use it in GitHub Desktop.

Select an option

Save CallumJHays/9b14827e61795a256d28ec9eb655f2ce to your computer and use it in GitHub Desktop.
#!/bin/bash
ssh ubuntu@54.206.64.114 'bash ~/delivery-webapp/scripts/on_server.sh && exit'
#!/bin/bash
# change into project dir
cd ~/delivery-webapp/
# stash changes that may cause issues
git stash
echo 'changes stashed'
# pull changes from git
git pull origin master
echo 'pulled updates'
# install dependencies
./bin/bundle install --quiet
echo 'installing bundle'
# run migrations
./bin/rake db:migrate
echo 'migrating database'
# add default values <admin, employees, users> to database
# these are found in the /db/seeds.rb file
./bin/rake db:seed
echo 'seeding database'
# install vendor dependencies
./bin/rake bower:install
echo 'installing bower stuff'
# restart the server
echo 'reading the server PID'
PID=$(<tmp/pids/server.pid)
echo 'PID'
echo "$PID"
if [[ "$PID" ]]
then
rvmsudo kill -9 "$PID"
sleep 1
fi
rvmsudo ./bin/rails server -p 80 -b 0.0.0.0 > ~/server.log &
exit
logout
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment