Upgrade to Pro — share decks privately, control downloads, hide ads and more …

> hubot deploy GitHub

> hubot deploy GitHub

Continuous deployment at GitHub using the GitHub Flow, the GitHub API, open source, and copious amounts of metrics.

Wynn Netherland

January 31, 2014
Tweet

More Decks by Wynn Netherland

Other Decks in Programming

Transcript

  1. > hubot deploy GitHub
    !

    View full-size slide

  2. !
    Hello, my name is Wynn.

    View full-size slide

  3. !
    Folks call me @pengwynn.

    View full-size slide

  4. !
    hubot image me razorback car
    >

    View full-size slide

  5. !
    hubot who is pengwynn
    >
    pengwynn is going to fix the API, might've broken the site, CAN'T
    HANDLE THE HEAT, Lex Luther, Lex Luthor, dabesssss, gives
    zero ☐'s, trusted, wynning - DUH, rolls in his api rapper mobile,
    definitely not in Los Angeles, plays dependency dominoes, ".

    View full-size slide

  6. !
    hubot deploy github
    >

    View full-size slide

  7. You deploy your site FROM CHAT?
    !

    View full-size slide

  8. Are you from THE FUTURE?
    !

    View full-size slide

  9. It sure feels like it.
    !

    View full-size slide

  10. How" has !'d over the years.
    !

    View full-size slide

  11. 1989
    10 PRINT "WYNN"
    20 GOTO 10

    View full-size slide

  12. 2009
    !
    # General configuration settings, required for all recipes!
    set :application, "project-name"
    set :domain, "project-domain"
    set :extra_domains, %w() # Add something like www.project-domain.com
    role :app, domain
    role :web, domain
    role :db, domain, :primary => true
    !
    # set :user, "user"
    !
    # Deployment Settings
    set :repository, "repository url"
    set :deploy_to, "/absolute/path/to/location/your/server"
    set :deploy_via, :checkout
    set :config_files, %w()
    !
    # SSH Keys for caching (you must generate these first.)
    ssh_options[:keys] = %w(~/.ssh/mykey1 ~/.ssh/mykey2)
    !
    # Change this to :thin if you want to use Thin instead.
    set :app_server, :mongrel
    !
    # Change this to :merb if you want to use Merb instead. (experimental)
    set :app_framework, :rails
    !
    # =============================================================
    # Application Server Settings (Thin or Mongrel)
    # =============================================================
    set :app_servers, 1
    set :app_server_port, 7007
    set :app_environment, 'production'
    set :app_server_address, '127.0.0.1'
    set :app_server_conf, "#{shared_path}/config/thin.yml"
    !
    # =============================================================
    # Nginx Settings

    View full-size slide

  13. !
    Start with a Pull Request.

    View full-size slide

  14. !
    Create a branch.

    View full-size slide

  15. !
    "Git branches are like unlimited lives."
    !
    - @tlberglund

    View full-size slide

  16. !
    ↑ ↑ ↓ ↓ ← → ← → B A

    View full-size slide

  17. !
    Create a branch.

    View full-size slide

  18. !
    Add commits.

    View full-size slide

  19. !
    Open a pull request.

    View full-size slide

  20. !
    Discuss and review.

    View full-size slide

  21. !
    Merge and deploy.

    View full-size slide

  22. !
    Or deploy and merge. !

    View full-size slide

  23. !
    The following deployments are based on actual events. Branch names
    and SHAs have been changed to protect the innocent.

    View full-size slide

  24. !
    hubot where can I deploy?
    >
    Environments for github
    -----------------------------------------------------
    production: unlocked
    lab-one: locked 6 hours ago by jasonrudolph
    lab-two: unlocked
    sekret-lab: unlocked
    playground: unlocked

    View full-size slide

  25. !
    hubot deploy github/api-my-feature to production
    >

    View full-size slide

  26. !
    hubot deploy github/api-my-feature to production
    >
    project

    View full-size slide

  27. !
    hubot deploy github/api-my-feature to production
    >
    branch

    View full-size slide

  28. !
    hubot deploy github/api-my-feature to production
    >
    environment

    View full-size slide

  29. !
    hubot deploy github/api-my-feature to production
    >
    Merge master into api-my-feature for pengwynn - hubot github/github@deadbeef

    View full-size slide

  30. !
    Get up to date with master. ⏳

    View full-size slide

  31. !
    Wait on the CI server. $

    View full-size slide

  32. !
    hubot tv me
    >

    View full-size slide

  33. !
    hubot tv me
    >

    View full-size slide

  34. !
    hubot deploy github/api-my-feature to production
    >
    Build #8675309 (deadbeef) of github/api-my-feature failed (203s)

    View full-size slide

  35. !
    Start over.

    View full-size slide

  36. !
    hubot deploy github/api-my-feature to production
    >
    Build #8675309 (deadbeef) of github/api-my-feature
    was successful (203s)

    View full-size slide

  37. !
    Release the kraken! %

    View full-size slide

  38. !
    hubot deploy github/api-my-feature to production
    >

    View full-size slide

  39. !
    hubot deploy github/api-my-feature to production
    >
    pengwynn is deploying github/api-my-feature (beefdead..deadbeef) to production
    pengwynn's production deployment of github is NOW &&&! (22s)

    View full-size slide

  40. !
    "The first transport is away!"

    View full-size slide

  41. !
    Test and observe.

    View full-size slide

  42. !
    Problem? ABORT. '

    View full-size slide

  43. !
    hubot deploy github
    >
    pengwynn is deploying github/master to production

    View full-size slide

  44. !
    Fail forward vs. rollback

    View full-size slide

  45. !
    ✨Everything )? MERGE.✨

    View full-size slide

  46. !
    >
    pengwynn: it looks like you merged "api-my-feature" branch
    into master, so I've unlocked production.

    View full-size slide

  47. !
    >
    pengwynn is deploying github/master to production
    pengwynn is deploying github/master to lab-one
    pengwynn is deploying github/master to lab-two
    pengwynn is deploying github/master to sekret-lab

    View full-size slide

  48. !
    But wait. There's MORE. *

    View full-size slide

  49. !
    hubot help deploy
    >
    /auto-deploy on - enable or disable autodeploys to 's on successul builds
    /deploy - show detailed deploy usage, including apps and environments
    /deploy / to / - deploy 's to the environment's servers
    /deployed [app/env] - List all recent deploys or deploys to an app/env
    /haystack-notify - notify Haystack that an app was deployed.
    /lock on - prevent deployments to 's
    /migrate / to - deploy branch to aux1 and run migrations
    /sha show the currently deployed SHA1
    /undeployed > - see what's undeployed on .com
    /unlock on - re-enable deployments to 's
    /where can I deploy - see what environments you can deploy app
    /where can I release - see what environments you can deploy app

    View full-size slide

  50. !
    How do I get this flow for my team?

    View full-size slide

  51. !
    Deployments API !
    Preview

    View full-size slide

  52. !
    Script # 3rd Party Server "

    View full-size slide

  53. !
    Script # 3rd Party Server
    Create deployment
    "

    View full-size slide

  54. !
    Script # 3rd Party Server
    Create deployment
    Deployment created
    "

    View full-size slide

  55. !
    Script # 3rd Party Server
    Create deployment
    Deployment created
    Deployment event
    "

    View full-size slide

  56. !
    Script # 3rd Party Server
    Create deployment
    Deployment created
    Deployment event
    SSH+Deploy
    "

    View full-size slide

  57. !
    Script # 3rd Party Server
    Create deployment
    Deployment created
    Deployment event
    SSH+Deploy
    Deployment status
    "

    View full-size slide

  58. !
    Script # 3rd Party Server
    Create deployment
    Deployment created
    Deployment event
    SSH+Deploy
    Deployment complete
    Deployment status
    "

    View full-size slide

  59. !
    Script # 3rd Party Server
    Create deployment
    Deployment created
    Deployment event
    SSH+Deploy
    Deployment complete
    Deployment status
    Deployment status
    "

    View full-size slide

  60. !
    Hubot
    http://hubot.github.com

    View full-size slide

  61. !
    Janky
    https://github.com/github/janky

    View full-size slide

  62. !
    Thanks. ❤️

    View full-size slide