Recently I created a small Rails app as a sales/marketing site for the startup I am working at. The site is very basic with just a few models and controllers. We time came to deploy the site, Capistrano felt to big, but we didn’t want to have to manually ssh in every time we had a code change. What I wanted was a way to run one command locally that would simply run a few commands on the remote server. To do this I turned to the net/ssh library.
Just drop this code in lib/tasks/deploy.rake and now a simple `$ rake deploy` will push your changes live.
4 Comments
Nice tip.
What ~/.ssh/keys/yourserver.pem do?
Why task depend on :environment? This load rails stack, but it not used in this task
Hi Bradly, take a look at Inploy:
http://www.github.com/dcrec1/inploy
shouldn’t it be lib/tasks/deploy.RAKE instead of .rb?
@runmen That is needed your needs an ssh key to connect. If you don’t use one when ssh’ing to your server, than you won’t need it with net/ssh either.
@Diego That’s great. I hadn’t come across Inploy before. I like the simple config/deploy.rb configuration.
@AnonyMouse Yep, you are right. Fixed!