Your SlideShare is downloading. ×
0
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Fabric:  A Capistrano Alternative
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Fabric: A Capistrano Alternative

37,282

Published on

Fabric: A lightweight deployment tool for Rubyists and Pythonists alike

Fabric: A lightweight deployment tool for Rubyists and Pythonists alike

Published in: Technology
0 Comments
37 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
37,282
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
0
Likes
37
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. Fabric - A Lightweight Deployment Tool for Rubyists and Pythonists Alike <ul><li>Mike Leone - Panoptic Development, Inc </li></ul>
  2. Why Fabric? <ul><li>Capistrano is elegant, powerful, extensible
  3. but...
  4. Too many features for small, simple projects
  5. If you're using a DSL, the implementation language isn't so important
  6. If you know Ruby, you already know enough Python for a simple fabric script! </li></ul>
  7. <ul><li>Can you teach a Rubyist how Capistrano works in 3 minutes? </li></ul><ul><li>Probably not!
  8. Makes assumptions about your version control system
  9. Release directory structure
  10. The way your server restarts
  11. In typical Ruby fashion, there's lots of ”magic” </li></ul>
  12. Fabric is two things <ul><li>API for streamlining the use of SSH for app deployment or sys admin tasks
  13. Command-line interface for calling Python methods </li></ul>
  14. Example $ fab free_space
  15. Write a deploy script in 3 minutes <ul><li>We want a script that will:
  16. test our code
  17. deploy it to our server in the /mnt directory
  18. restart the web server </li></ul>
  19. Install Fabric <ul>$ sudo apt-get install python-setuptools $ sudo easy_install fabric </ul>
  20. Add Fabric to your Ruby App <ul>$ cd my/awsome/rails_app $ touch fabfile.py </ul>
  21. Three Lines of Boilerplate <ul>from fabric.api import * env.hosts = ['myserver.com'] env.user = ”mike” </ul>
  22. Run the tests <ul>def test(): local('rake spec') <li>If tests fail, deployment will stop </li></ul>
  23. Send your App Code Over <ul>def pack_code(): local('tar czf /tmp/latest.tgz') def upload_code(): put('/tmp/latest.tgz', '/tmp/') with cd('/mnt/rails_app'): run('tar xzf /tmp/latest.tgz') </ul>
  24. Restart the Web Server <ul>def restart(): sudo('/etc/init.d/apache2 restart') </ul>
  25. Put it all Together <ul>def deploy(): test() pack_code() upload_code() restart() </ul>
  26. Your new Deploy Script
  27. Deploy! <ul>$ fab deploy </ul>
  28. Deploy your Release Branch <ul>$ git checkout my-release-branch $ fab deploy </ul>
  29. Advantages <ul><li>Don't have to include branch, repository info
  30. Use any release directory structure you want
  31. Someone knowing nothing about deployment tools can look at your script and understand exactly what's going on </li></ul>
  32. Further Reading <ul><li>Fabric documentation:
  33. http://docs.fabfile.org/0.9.1/
  34. My Company Website and Blog: </li><ul><li>http://panopticdev.com </li></ul></ul>

×