So You Still Cowboy Code Your Infrastructure...

So You Still Cowboy Code Your Infrastructure...

We all know not to cowboy code our applications, yet it’s the Wild West when working on building and maintaining your servers. In my talk, I will discuss provisioning, deployment, and development setup for infrastructure. By working through a case study of rebuilding my company’s infrastructure, I will demonstrate the advantages of building servers in a development environment. Using this workflow, you will be able to see how easy it is to build and maintain infrastructure through sane and logical development practices.

980df66b142b2a067b3f8b67b04352de?s=128

Zack Tollman

July 26, 2014
Tweet

Transcript

  1. So You Still Cowboy Code Your Infrastructure… Zack Tollman |

    The Theme Foundry | @tollmanz
  2. ! Cowboy Coding

  3. No testing

  4. Live edits

  5. No process

  6. Jack Bauer Coding

  7. Crass Unpredictable Collateral Damage

  8. “Sir, I have a way to _______, but it might

    involve _______.”
  9. It started 18 months ago

  10. Manage the servers they said

  11. My history of live edits is not good

  12. ssh this-guy@your-server.com

  13. > top Brain wants

  14. > service nginx stop Fingers type

  15. rewrite ^/punchcut/?$ /wordpress-themes/paperpunch/ permanent

  16. rm /srv/www/wp-config.php

  17. How can I build something that saves me from myself?

  18. Peace of mind with Local Development

  19. Develop in a non-remote environment

  20. Mistakes only hurt my ego

  21. Vagrant

  22. Reproducible development environment

  23. Test server locally

  24. ssh this-guy@local-server.com

  25. Best approximation

  26. Allows me to see what likely happens when I do

    something
  27. Keeping me off the command line with Provisioning

  28. Set of actions to prepare a server

  29. Idempotence Apply the same procedure; get the same result

  30. Guarantees a server’s state

  31. None
  32. None
  33. None
  34. None
  35. None
  36. Documents your server

  37. Allows for versioning

  38. I can still mess this up so let’s talk about

    Deployment
  39. Process of making software available

  40. Clone/pull Move files Handle permissions Run build tasks

  41. Automate the headaches away

  42. Fabric Vlad the! Deployer

  43. None
  44. That’s neat, but how do we Integrate These Tools

  45. Let’s add Fail2Ban to our site

  46. Server software New logs New configs Application changes * Bad

    config blocks everyone
  47. WordPress, plugins, and theme code App

  48. Salt state files that describe the state of the server

    App States
  49. Data for specific servers (e.g., more Memcached RAM for production)

    App States Pillar
  50. Fabric commands for deployment tasks App States Pillar Fab

  51. Server environments App States Pillar Fab Local/Vagrant Staging Production

  52. App States Pillar Fab

  53. App States Pillar Fab Write state

  54. Add config to Pillar App States Pillar Fab

  55. App States Pillar Fab Local Staging Production Deploy server updates

    locally fab local server.update
  56. App States Pillar Fab Local Staging Production

  57. App States Pillar Fab Test that changes were applied Local

    Staging Production
  58. App States Pillar Fab Local Staging Production Install and modify

    WP Fail2Ban plugin
  59. App States Pillar Fab Local Staging Production fab local app.deploy

    Deploy app updates locally
  60. App States Pillar Fab Local Staging Production Test, test, test,

    test, take a break, test, test, test, test
  61. App States Pillar Fab Local Staging Production Changes made to

    3 repos and applied locally
  62. App States Pillar Fab Local Staging Production Apply changes to

    staging environment
  63. App States Pillar Fab Local Staging Production fab staging server.update

    fab staging app.deploy
  64. App States Pillar Fab Local Staging Production Verify changes in

    real environment Verify deployment procedure
  65. App States Pillar Fab Local Staging Production Apply changes to

    production
  66. App States Pillar Fab Local Staging Production fab production server.update

    fab production app.deploy
  67. Adopt procedures that improve stability

  68. Use the tools that work for you and your team

  69. speakerdeck.com/tollmanz/so-you-still-cowboy- code-your-infrastructure-dot-dot-dot