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".

Bbf9decfbfc2ab5b450ec503749ded28?s=128

Michael Heap

October 29, 2016
Tweet

Transcript

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

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

  3. Automation

  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
  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
  6. None
  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
  8. What is automation?

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

  10. ./generate_stock_update.sh

  11. What is automation?

  12. Why Automate?

  13. #1 Reason

  14. #1 Reason People...

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

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

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

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

    write tests Don't run tests Don't write/read documentation
  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
  20. What other reasons?

  21. Make money with less effort

  22. Your company wants less overhead

  23. Spend more time with partner / kids /

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

  25. Automation is about...

  26. Fear

  27. Fear costs £££

  28. Fear makes people reckless

  29. Fear leads to bad decisions

  30. Fear leads to bad productivity

  31. Automation isn't about being lazy

  32. Automation is about being efficient

  33. So, we should automate everything right?

  34. No

  35. Feel the pain

  36. Security upgrades

  37. Anything you need to see

  38. What should we automate?

  39. Everything else

  40. Deployments

  41. Reporting

  42. CRUD Generation

  43. Anything & Everything

  44. Arguments against automation

  45. “Our system is too complicated to automate”

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

  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
  48. When should we automate?

  49. None
  50. A step by step guide

  51. Do it by hand (make notes)

  52. Automate the first part

  53. Automate the second part

  54. All automated

  55. Run unattended

  56. That's all 5 steps

  57. What to automate

  58. Start small

  59. Start with the whining

  60. “Deploying is too hard”

  61. $ git checkout staging $ git pull origin staging $

    git merge feature/new-awesomeness $ git push origin staging $ cap staging deploy:full
  62. Ignore it?

  63. $ deploy-staging feature/new-awesomeness

  64. $ git checkout staging $ git pull origin staging $

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

  66. Start with the whining

  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
  68. Centralised automation

  69. Enter CI!

  70. Code changes => Run tests

  71. Code changes => Compile Assets

  72. Assets Change => Publish to CDN

  73. New servers

  74. Report generation

  75. Not just for builds

  76. CI == Automation

  77. Continuous Integration

  78. Centralised Information

  79. Public Information

  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
  81. Us

  82. Us

  83. Docblocks

  84. Generators

  85. Bootstrapping

  86. Composer packages

  87. Us The box

  88. Crazy ideas

  89. DEMO TIME

  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
  91. Business buy in

  92. It's hard work

  93. Quick wins

  94. Keep it quick

  95. Developer buy in

  96. Automation is debt

  97. Error handling

  98. Idempotency

  99. Build on the shoulders of giants

  100. Triggering actions

  101. Visibility

  102. Slack

  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
  104. Available tools

  105. Vagrant/Virtualbox

  106. Openstack

  107. Puppet Chef Ansible

  108. IDEs

  109. Doctrine Migrations

  110. Jenkins / GoCD

  111. Amazon AWS

  112. Terraform

  113. Consul

  114. Bash / Python / Other

  115. Slack

  116. Final considerations

  117. Manual tasks

  118. Security

  119. Pipelines

  120. Implementation

  121. Recommended starting point

  122. In summary

  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
  124. Thanks! I’ve been @mheap, you’ve been awesome. Please leave feedback

    on Joind.in https://joind.in/talk/53d7d