Devops for A Busy Developer - XP Days 2016

Devops for A Busy Developer - XP Days 2016

Our minds are bright, our thoughts are clear, our eyes are lit with passion, but we’ve got no time!

We thought frontend churn was terrible but DevOps space is so much worse! What tools to use? Which direction to take? What movement to follow? Every single day new tools emerge with a promise to solve the challenges we have and the ones we don’t know we have! We don’t have enough time to learn to use them properly, and each time we try them they either don’t work as expected, or do so inconsistently. Yet at the same time we face tight deadlines and have work to do!

The task at hand is clear: we’ve got a pile of code, and we want to run it on a bunch of servers. I will show you how I do it with as little sweat and tears as possible.

Transcript

  1. None
  2. Russian Introductory For Developers

  3. You’re a Developer

  4. You’ve build an App

  5. You Want to Share It

  6. Now What?

  7. 1. Get a Server 2. Put your App to it

    3. PROFIT!!!
  8. [App + DB]

  9. Website (Landings + Payments) App UI - SPA CRUD API

    Admin UI Background processes DB Cache ...
  10. Release It!

  11. Dev + Ops

  12. Build Deploy Monitor

  13. Code with Infrastructure in Mind

  14. Build Infrastructure with Code in Mind

  15. AWS Azure Google Cloud

  16. Artifacts

  17. Language-Specific (.jar, .py) OS-specific (.deb, .rpm) Containers (Docker, VMs)

  18. Amazing Tools!

  19. None
  20. Worse than Frontend!

  21. Choice is Hard

  22. Feature-rich vs Specialized Provider-Specific vs Universal Simple vs Flexible

  23. Apps Servers

  24. Mesos? Kubernetes? Kubernetes on Mesos? Neither?

  25. No Time! What to do?

  26. Select 1 tool that does everything

  27. Select 1 tool that does 1 thing well Face a

    task - pick a laser-focused tool for it Repeat
  28. Terraform Nomad Ansible Docker Swarm Etcd Vault

  29. “Ain’t nobody got time for that!”™ Method

  30. Select the tool most likely suitable for a job Use

    it for everything while it’s easy Hit a wall? Pick something most likely to help you
  31. You may end up with several tools They may be

    redundant You will learn very little about them
  32. StackOverflow-driven DevOps™

  33. You Will Save Time Most tools will operate in their

    Sweet Spots Operational issues are extremely unlikely
  34. Let’s Do it!

  35. Heroku

  36. PaaS

  37. git push heroku master

  38. App-Centric Architecture Conventions (12factor)

  39. Process Isolation Ephemeral State Fast Start & Graceful Shutdown Config

    via Env Vars Expose 1 port Log to StdOut
  40. CD with Pipelines Review Apps Major Languages (Java, PHP, etc)

  41. Runs on AWS Addons Buildpacks

  42. If your app is a web app Try Heroku first

  43. Dev time ~$100/h 40h? 80h?

  44. 1 DO instance $5 1 Smallest Heroku tier $7

  45. Product Hunt Rails 2015 3 PL $1500 12 people

  46. Heroku Apps are easy to migrate

  47. AWS

  48. Azure? Google Cloud? At this stage you probably can afford

    a person with DevOps experience
  49. DigitalOcean? Linode? Same idea

  50. 1. Database

  51. DB as a Service

  52. Heroku Postgres mLab (Mongo) Amazon Aurora (MySQL)

  53. Dashboards Backups Slow Queries and Indexes Runs in your AWS

    Region You get a connection URL
  54. RDS Bring your EC2

  55. Should I put my Database into Docker Containers? No. Don’t

    bother.
  56. But we’re running our DBs on Docker and are happy!

    Good for you, keep doing that.
  57. 2. CRUD-like API Backend

  58. EC2?

  59. ELB VPC Subnets Internet Gateways Availability Zones Autoscaling Groups EC2

    instance Types EBS Volumes
  60. Elastic Beanstalk

  61. Instance type Min … Max Env Variables (DB Url) App

    Url
  62. EC2 t2.nano … t2.small c4.large … c4.8xlarge

  63. I need a server to do X I need an

    EB app to do X
  64. eb init my-app eb create my-app-staging eb use my-app-staging eb

    setenv DATABASE_URL='...' eb getenv eb deploy
  65. It doesn’t support my platform! It supports Docker

  66. Dockerfile FROM node:7.1-onbuild EXPOSE 3000 CMD npm start

  67. Now you can claim you use Docker in production

  68. 3. SPA UI

  69. Frontend vs Backend

  70. Separate Build Separate Releases

  71. S3

  72. Lightning Deploys

  73. None
  74. 1. JS, CSS, assets => S3 + CDN Fingerprint, pre-gzip

    2. HTML references them => Redis 3. Default Active Version Flag => Redis 4. Backend goes to Redis to serve HTML
  75. Ready-made plugin for your UI build tools

  76. ember install ember-cli-deploy ember install ember-cli-deploy-lightning-pack edit deploy/config.js ember deploy

    staging
  77. Simple S3 also works pretty well

  78. 4. Separate services

  79. Beanstalk AWS Lambda

  80. Apex Serverless Gordon

  81. One HTTP call One App

  82. Overkill for CRUD

  83. API Gateway URL -> Lambda DB Connection Run Code (subprocess?)

    Release the connection
  84. Node + Redis Node + Dynamo Go + Mongo

  85. 4. Realtime

  86. Say no to WebSockets

  87. Humans are slow HTTP Polling is fast enough HTTP is

    easy WebSockets don’t play well with HTTP2
  88. When using them Code for disconnects

  89. How do I write my app so that devops is

    easy?
  90. 12factor Separate SPA with S3 Treat your database as external

    resource Docker for Packaging only Heroku AWS ElasticBeanstalk AWS Lambda
  91. Select the tool most likely suitable for a job Use

    it for everything while it easy Hit a wall? Pick something most likely to help you
  92. BUSY DEV LAW

  93. Law of old technology Older tech tend to stick around

    longer
  94. Kubernetes might be a thing

  95. Kubernetes might be a thing That you can ignore for

    the next 5-10 years
  96. @listochkin https://gitter.im/dev-ua #xpdays