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 Slide

  2. !
    Hello, my name is Wynn.

    View Slide

  3. !
    GitHub

    View Slide

  4. !
    Folks call me @pengwynn.

    View Slide

  5. !
    !

    View Slide

  6. !
    hubot image me razorback car
    >

    View Slide

  7. !
    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 Slide

  8. !
    hubot deploy github
    >

    View Slide

  9. Wait. Wut?
    !

    View Slide

  10. You deploy your site FROM CHAT?
    !

    View Slide

  11. Are you from THE FUTURE?
    !

    View Slide

  12. It sure feels like it.
    !

    View Slide

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

    View Slide

  14. 1989
    10 PRINT "WYNN"
    20 GOTO 10

    View Slide

  15. 1994

    View Slide

  16. 1999
    !

    View Slide

  17. 2004
    !

    View Slide

  18. 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 Slide

  19. Today
    !

    View Slide

  20. !
    Start with a Pull Request.

    View Slide

  21. !

    View Slide

  22. !
    Create a branch.

    View Slide

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

    View Slide

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

    View Slide

  25. !
    Create a branch.

    View Slide

  26. !
    Add commits.

    View Slide

  27. !
    Open a pull request.

    View Slide

  28. !
    Discuss and review.

    View Slide

  29. !
    Merge and deploy.

    View Slide

  30. !
    Or deploy and merge. !

    View Slide

  31. !
    "

    View Slide

  32. !

    View Slide

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

    View Slide

  34. !
    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 Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  40. !
    Get up to date with master. ⏳

    View Slide

  41. !
    Wait on the CI server. $

    View Slide

  42. !
    hubot tv me
    >

    View Slide

  43. !

    View Slide

  44. !
    hubot tv me
    >

    View Slide

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

    View Slide

  46. !
    Start over.

    View Slide

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

    View Slide

  48. !
    Release the kraken! %

    View Slide

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

    View Slide

  50. !
    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 Slide

  51. !
    "The first transport is away!"

    View Slide

  52. !
    Test and observe.

    View Slide

  53. !

    View Slide

  54. !

    View Slide

  55. !

    View Slide

  56. !

    View Slide

  57. !

    View Slide

  58. !
    Problem? ABORT. '

    View Slide

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

    View Slide

  60. !
    Philosophy

    View Slide

  61. !
    Fail forward vs. rollback

    View Slide

  62. !
    ✨Everything )? MERGE.✨

    View Slide

  63. !

    View Slide

  64. !

    View Slide

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

    View Slide

  66. !
    >
    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 Slide

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

    View Slide

  68. !
    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 Slide

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

    View Slide

  70. !
    Deployments API !
    Preview

    View Slide

  71. !
    Script # 3rd Party Server "

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  81. !

    View Slide

  82. !
    Thanks. ❤️

    View Slide

  83. !
    EOF

    View Slide