$30 off During Our Annual Pro Sale. View Details »

DevOps: Python tools to get started

DevOps: Python tools to get started

Presented at Mini PyCon Malaysia 2014 (March 15)

Victor Neo

March 15, 2014
Tweet

More Decks by Victor Neo

Other Decks in Technology

Transcript

  1. DevOps
    Python tools to get started

    View Slide

  2. DevOps is …
    “… development and operations teams work
    on software releases in tandem, rather than
    throwing code back and forth across a silo.”

    View Slide

  3. Make no mistake
    DevOps is a culture
    In [1]: “tools make a culture”
    Out [1]: False

    View Slide

  4. Background

    View Slide

  5. Perspective
    Startup culture, but tools are useful
    everywhere

    View Slide

  6. Carousell
    P2P Marketplace App
    iOS, Android
    (Web?)

    View Slide

  7. Pony Powered
    Django + Django Rest Framework

    View Slide

  8. Not too long ago
    1 Technical Co-founder
    !
    Edits code on production server
    Live reload

    View Slide

  9. Moments ago
    4 Engineers:
    iOS, Android, CTO,
    Backend + Infrastructure
    !
    Every engineer somewhat involved with
    Backend code

    View Slide

  10. TODO
    • Deploy
    • Monitor
    Make it easy to:
    • Break things
    Make it difficult to:

    View Slide

  11. Deployment

    View Slide

  12. Deployment options
    - Fabric + git / svn /…
    !
    - Salt / Ansible / Chef
    !
    - Native packaging (.rpm, .deb)

    View Slide

  13. Fabric (i)
    from fabric.api import env, run
    !
    hosts = [‘app.server.com’]
    !
    def deploy():
    run(“git pull && … ”)
    fabfile.py

    View Slide

  14. Fabric (ii)
    $ fab deploy
    [app.server.com] run: git pull && …
    [app.server.com] out: [output]

    View Slide

  15. Fabric: the good parts
    Simple, easy to start with
    !
    @parallel to speed up
    for multiple servers

    View Slide

  16. Salt
    Configuration management,
    commonly used for server
    provisioning
    !
    Chef, Puppet, etc

    View Slide

  17. Salt + Git

    View Slide

  18. Fabric + Salt + Git
    fab deploy
    salt “app*.server.com” …
    app1.server.com app2.server.com

    View Slide

  19. TODO
    • Deploy
    • Monitor
    Make it easy to:
    • Break things
    Make it difficult to:

    View Slide

  20. Monitor and Control

    View Slide

  21. Controlling processes
    Tools: Supervisor, Circus
    Allows you to control and monitor
    your app processes

    View Slide

  22. Supervisor (i)
    [program:my_app]
    command=python my_app.py

    View Slide

  23. Supervisor (ii)
    $ supervisorctl status
    my_app RUNNING pid 7910, uptime 01:36:44

    View Slide

  24. Supervisor (iii)
    Supervisor exposes a XMLRPC interface
    Allows remote monitoring and control of
    processes

    View Slide

  25. TODO
    • Deploy
    • Monitor
    Make it easy to:
    • Break things
    Make it difficult to:

    View Slide

  26. Continuous Integration

    View Slide

  27. Continuous Integration
    Popular CIs:
    Jenkins, TravisCI, CircleCI

    View Slide

  28. http://buildbot.net/

    View Slide

  29. Jenkins + Django

    View Slide

  30. Automated Feedback

    View Slide

  31. Done!
    • Deploy
    • Monitor
    Make it easy to:
    • Break things
    Make it difficult to:

    View Slide

  32. All together now

    View Slide

  33. Github Workflow
    Pull Request
    Continuous Integration
    Automatic Deployment

    View Slide

  34. pull request
    Jenkins CI Test
    Deployment Report on Github
    salt
    [success] [fail]

    View Slide

  35. Beyond Python
    Docker
    Vagrant Virtual Machines!
    (LXC) Containers!

    View Slide

  36. Thanks!
    @victorneo
    (psst. we are looking for web devs)

    View Slide