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

Automation Automation Automation - ScotlandPHP

Automation Automation Automation - ScotlandPHP

A good rule of thumb to have as a developer is that if you have to do something three times or more, you should automate it. Imagine that a task takes you a minute to do, twice a day. Now imagine that you could write something that does it for you, but it would take an hour. Initially, you'll have lost an hour, but after the first month you'll be breaking even, as you've saved those two minutes per day. Then after the second month, you've essentially gained a free hour.

Automation is a developer's best friend. Some things are easier to automate than others, but almost anything can be automated. In this talk, we'll take a look at what can be automated, what tools are available to help us and crucially, *if* we should automate it. Surprisingly, sometimes the answer to the question "should we?" is "no".

Michael Heap

October 29, 2016
Tweet

More Decks by Michael Heap

Other Decks in Technology

Transcript

  1. Automation Automation Automation
    Michael Heap (@mheap)
    Presented at PHPScotland, Oct 2016

    View Slide

  2. Me!
    I’m Michael
    I’m @mheap
    Infrastructure at digi.me

    View Slide

  3. Automation

    View Slide

  4. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  5. 0. XKCD
    1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  6. View Slide

  7. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  8. What is automation?

    View Slide

  9. ./scr_u -v -S 1024 -t -d /tmp

    View Slide

  10. ./generate_stock_update.sh

    View Slide

  11. What is automation?

    View Slide

  12. Why Automate?

    View Slide

  13. #1 Reason

    View Slide

  14. #1 Reason
    People...

    View Slide

  15. #1 Reason
    People...
    Have good intentions, but no time

    View Slide

  16. #1 Reason
    People...
    Have good intentions, but no time
    Don't write tests

    View Slide

  17. #1 Reason
    People...
    Have good intentions, but no time
    Don't write tests
    Don't run tests

    View Slide

  18. #1 Reason
    People...
    Have good intentions, but no time
    Don't write tests
    Don't run tests
    Don't write/read documentation

    View Slide

  19. #1 Reason
    People...
    Have good intentions, but no time
    Don't write tests
    Don't run tests
    Don't write/read documentation
    Are not deterministic

    View Slide

  20. What other reasons?

    View Slide

  21. Make money with
    less effort

    View Slide

  22. Your company wants
    less overhead

    View Slide

  23. Spend more
    time with
    partner / kids /

    View Slide

  24. Spend more
    time with
    partner / kids /
    Civilization 6

    View Slide

  25. Automation
    is about...

    View Slide

  26. Fear

    View Slide

  27. Fear costs £££

    View Slide

  28. Fear makes people
    reckless

    View Slide

  29. Fear leads to
    bad decisions

    View Slide

  30. Fear leads to
    bad productivity

    View Slide

  31. Automation
    isn't about being
    lazy

    View Slide

  32. Automation
    is about being
    efficient

    View Slide

  33. So, we should
    automate
    everything right?

    View Slide

  34. No

    View Slide

  35. Feel the pain

    View Slide

  36. Security upgrades

    View Slide

  37. Anything you
    need to see

    View Slide

  38. What should
    we automate?

    View Slide

  39. Everything else

    View Slide

  40. Deployments

    View Slide

  41. Reporting

    View Slide

  42. CRUD
    Generation

    View Slide

  43. Anything
    &
    Everything

    View Slide

  44. Arguments
    against
    automation

    View Slide

  45. “Our system is too
    complicated to automate”

    View Slide

  46. “We don't have time
    to automate”

    View Slide

  47. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  48. When should
    we automate?

    View Slide

  49. View Slide

  50. A step by
    step guide

    View Slide

  51. Do it by hand
    (make notes)

    View Slide

  52. Automate the
    first part

    View Slide

  53. Automate the
    second part

    View Slide

  54. All automated

    View Slide

  55. Run unattended

    View Slide

  56. That's all
    5 steps

    View Slide

  57. What to automate

    View Slide

  58. Start small

    View Slide

  59. Start with the whining

    View Slide

  60. “Deploying is too hard”

    View Slide

  61. $ git checkout staging
    $ git pull origin staging
    $ git merge feature/new-awesomeness
    $ git push origin staging
    $ cap staging deploy:full

    View Slide

  62. Ignore it?

    View Slide

  63. $ deploy-staging feature/new-awesomeness

    View Slide

  64. $ git checkout staging
    $ git pull origin staging
    $ git merge feature/new-awesomeness
    $ git push origin staging
    $ cap staging deploy:full

    View Slide

  65. $ deploy-staging feature/new-awesomeness

    View Slide

  66. Start with the whining

    View Slide

  67. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  68. Centralised
    automation

    View Slide

  69. Enter CI!

    View Slide

  70. Code changes
    => Run tests

    View Slide

  71. Code changes
    => Compile Assets

    View Slide

  72. Assets Change
    => Publish to CDN

    View Slide

  73. New servers

    View Slide

  74. Report generation

    View Slide

  75. Not just for builds

    View Slide

  76. CI == Automation

    View Slide

  77. Continuous
    Integration

    View Slide

  78. Centralised
    Information

    View Slide

  79. Public
    Information

    View Slide

  80. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  81. Us

    View Slide

  82. Us

    View Slide

  83. Docblocks

    View Slide

  84. Generators

    View Slide

  85. Bootstrapping

    View Slide

  86. Composer
    packages

    View Slide

  87. Us
    The box

    View Slide

  88. Crazy ideas

    View Slide

  89. DEMO TIME

    View Slide

  90. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  91. Business buy in

    View Slide

  92. It's hard work

    View Slide

  93. Quick wins

    View Slide

  94. Keep it quick

    View Slide

  95. Developer buy in

    View Slide

  96. Automation is debt

    View Slide

  97. Error handling

    View Slide

  98. Idempotency

    View Slide

  99. Build on the
    shoulders of giants

    View Slide

  100. Triggering actions

    View Slide

  101. Visibility

    View Slide

  102. Slack

    View Slide

  103. 1. What is automation?
    2. A step by step guide to automation
    3. Making it institutionalised
    4. Thinking outside the box
    5. I'm convinced! Let's automate
    6. Useful tools

    View Slide

  104. Available tools

    View Slide

  105. Vagrant/Virtualbox

    View Slide

  106. Openstack

    View Slide

  107. Puppet
    Chef
    Ansible

    View Slide

  108. IDEs

    View Slide

  109. Doctrine Migrations

    View Slide

  110. Jenkins / GoCD

    View Slide

  111. Amazon AWS

    View Slide

  112. Terraform

    View Slide

  113. Consul

    View Slide

  114. Bash / Python / Other

    View Slide

  115. Slack

    View Slide

  116. Final considerations

    View Slide

  117. Manual tasks

    View Slide

  118. Security

    View Slide

  119. Pipelines

    View Slide

  120. Implementation

    View Slide

  121. Recommended
    starting point

    View Slide

  122. In summary

    View Slide

  123. Non-programmers don’t trust computers
    to do something they can do
    Programmers don’t trust themselves to do
    something that a computer can do
    - @djcoreynolan

    View Slide

  124. Thanks!
    I’ve been @mheap, you’ve been awesome.
    Please leave feedback on Joind.in
    https://joind.in/talk/53d7d

    View Slide