Quick Deployment with Rsync and Ruby
As I’ve mentioned before, I’m a huge fan of using rsync for deployment. When working on smaller sites and projects, I find that the other deployment method that I use; capistrano, is a bit of overkill, I rarely, if ever need to rollback revisions or share assets across deployments on simple websites. Since I use git, I can rollback revisions and ignore certain files using .gitignore. With that said, I think that I’ve come up with the most simple and perfect way to deploy small projects. This assumes that you use the following:
- OSX or any *nix variety OS (haven’t tested it on ubuntu, but I assume this’ll work the same)
- rsync / ssh
- git
- and of course ruby
- textmate or any other editor that accepts textmate’s bundle snippet system
- Add the following snippet to your bundles:
- Assign the word
deployfor the snippet expansion. - Add a file called
deploy.rbto the root of your project, make sure andchmod 755it. - Type
deployand expand the snippet and fill in your deployment details. - Once you are ready, just run
./deploy.rbin the terminal.
The great thing about this is that you ignore files on deployment simply by using .gitignore and rollback using git. Why attempt to re-do those things when git does such a good job of it itself? Enjoy!
