Skip to content

Instantly share code, notes, and snippets.

@sublimecoder
Last active June 24, 2016 19:21
Show Gist options
  • Save sublimecoder/f9061313c7060334ff59 to your computer and use it in GitHub Desktop.
Save sublimecoder/f9061313c7060334ff59 to your computer and use it in GitHub Desktop.
#!/bin/bash +x
MYDIR=/home/username
# force load new code
cd $MYDIR
git fetch origin
git reset --hard origin/master
# move domain specific files
rm -f /home/username/config/database.yml
ln -s /database.yml /home/Rails-App/config/database.yml
touch /home/username/log/production.log
chown -R rails:www-data $MYDIR
# install missing gems, update database, compile assets
RAILS_ENV=production bundle install
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake db:seed
RAILS_ENV=production bundle exec rake assets:precompile
service unicorn restart
echo "deployed on `date`" >> /var/log/deploy.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment