Skip to content

Instantly share code, notes, and snippets.

@anhang
Created May 3, 2016 07:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anhang/c177e377f044d1bb1c0fd678056224ae to your computer and use it in GitHub Desktop.
Save anhang/c177e377f044d1bb1c0fd678056224ae to your computer and use it in GitHub Desktop.
from: http://blog.anhangzhu.com/2016/05/03/easy-rails-deployment-with-rsync/
First, have an rsync_exclude file:
// my-rails-app/.rsync_exclude
.bundle
tmp
log
Run in localhost:
$ bundle exec rake assets:precompile
$ rsync -a --delete --stats --progress --exclude-from='./.rsync_exclude' ./ your@domain.com:~/your-rails-folder/
Run in production server:
$ rvm use ruby-2.2.2
$ cd ~/your-rails-folder
$ bundle install --without development test
$ rake db:migrate RAILS_ENV="production"
// If needed:
$ RAILS_ENV=production bundle exec rake assets:precompile
Restart server:
$ killall -USR1 dispatch.fcgi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment