• Save
Fabric:  A Capistrano Alternative
Upcoming SlideShare
Loading in...5
×
 

Fabric: A Capistrano Alternative

on

  • 37,781 views

Fabric: A lightweight deployment tool for Rubyists and Pythonists alike

Fabric: A lightweight deployment tool for Rubyists and Pythonists alike

Statistics

Views

Total Views
37,781
Views on SlideShare
26,151
Embed Views
11,630

Actions

Likes
34
Downloads
0
Comments
0

14 Embeds 11,630

http://leone.panopticdev.com 11164
http://rirug.com 334
http://note.harajuku-tech.org 49
http://translate.googleusercontent.com 29
http://harajuku-tech.posterous.com 22
http://7781964911499645745_73fcfa2288a103bf59aad4aec7f7296adcc6dc5a.blogspot.com 6
http://feeds.feedburner.com 6
http://207.46.192.232 5
https://twitter.com 4
http://blog.mikeleone.com 4
http://webcache.googleusercontent.com 3
http://paper.li 2
http://twitter.com 1
http://www.howtogeek.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Fabric: A Capistrano Alternative Presentation Transcript

  • 1. Fabric - A Lightweight Deployment Tool for Rubyists and Pythonists Alike
    • Mike Leone - Panoptic Development, Inc
  • 2. Why Fabric?
    • 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!
  • 7.
    • Can you teach a Rubyist how Capistrano works in 3 minutes?
    • 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”
  • 12. Fabric is two things
    • API for streamlining the use of SSH for app deployment or sys admin tasks
    • 13. Command-line interface for calling Python methods
  • 14. Example $ fab free_space
  • 15. Write a deploy script in 3 minutes
    • 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
  • 19. Install Fabric
      $ sudo apt-get install python-setuptools $ sudo easy_install fabric
  • 20. Add Fabric to your Ruby App
      $ cd my/awsome/rails_app $ touch fabfile.py
  • 21. Three Lines of Boilerplate
      from fabric.api import * env.hosts = ['myserver.com'] env.user = ”mike”
  • 22. Run the tests
      def test(): local('rake spec')
    • If tests fail, deployment will stop
  • 23. Send your App Code Over
      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')
  • 24. Restart the Web Server
      def restart(): sudo('/etc/init.d/apache2 restart')
  • 25. Put it all Together
      def deploy(): test() pack_code() upload_code() restart()
  • 26. Your new Deploy Script
  • 27. Deploy!
      $ fab deploy
  • 28. Deploy your Release Branch
      $ git checkout my-release-branch $ fab deploy
  • 29. Advantages
    • 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
  • 32. Further Reading
    • Fabric documentation:
    • 33. http://docs.fabfile.org/0.9.1/
    • 34. My Company Website and Blog:
      • http://panopticdev.com