Your SlideShare is downloading. ×
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

36,875

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
36,875
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
    • 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

×