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

How we built a heroku for ourselves

Senthil V S
March 02, 2019
660

How we built a heroku for ourselves

Presentation done at Quarterly Large Scale Production Engineering (LSPE) meet up (https://www.meetup.com/lspe-in/events/qvgqgdyzfbmb/)

Senthil V S

March 02, 2019
Tweet

Transcript

  1. Simpl Virtual CC for users make money simple, so that

    people can live well and do amazing things. PG for merchants We enable payment without banks
  2. Simpl architecture Services Streaming Platform Data Pipeline Dashboards Analytics ML

    models Merchant Apps Simpl Website Different tech stacks Scalability requirements Security requirements services
  3. So… Four tech stacks (RoR, GoLang, Node, Python) Five developers.

    No (Dev)Ops Scaling needs are different Security needs are different Centralized logging Centralized config management
  4. We wanted a solution, that…. Multiple tech stacks No (Dev)Ops.

    Easy to use Standard stack across platform Customizable standard
  5. Possible solutions • Hand-crafted (?!) servers • Config management tools

    (chef, puppet etc.) • PaaS (Heroku, now.sh, AWS ElasticBeanstalk etc.)
  6. Config management tools • Using Chef/puppet/Terraform etc. • Heavy-weight. Highly

    customizable leading to complex codebase. • Platform architecture being reflected. • Every change in service communications could require change in DevOps platform
  7. PaaS • Easier to get started • No way to

    customize • Microservices: Internal vs external • Costly
  8. Cloudformation • Infra as code • AWS specific • Resources

    defined in template and applied • Idempotent
  9. ECS • ECS: Elastic Container Service • Orchestrator engine to

    run containers • Runs on cluster of EC2 instances • Exposes API to run/stop/scale containers • Container repository to push images
  10. Service Task definition ✓ Network mode ✓ Constraints Container definition

    ✓ ECR image version ✓ Env vars ✓ Port mapping ✓ Command to run ✓ Logs ✓ Cluster i.e. set of EC2 instances ✓ Number of tasks ✓ High availability deployment ✓ Task placement ✓ Load balancing (ELB/ALB) ✓ Autoscaling ECS terms ✓ECR: EC2 Container registry ✓ELB: Elastic load balancer ✓ALB: Application load balancer ✓Port mapping ✓ Container port <-> Container instance port ✓ Can be dynamic ✓Task placement ✓ AZ Balanced spread ✓ One Task per Host ✓ BinPack ✓Constraints ✓ allow you to filter the instances ✓ using built-in or custom attributes ✓Network mode ✓ Bridge/Host etc. ✓Tasks run from Task definition ✓Containers run from Container definition
  11. Cloudlift • Built by two developers at Simpl & in

    production use • Used in a heroku style. (Yeah. You can call it heroic style ;)) • Fully customizable • Open sourced
  12. What happens on deploy_service ? Push local docker 
 image

    to ECR Ensure S3 has all required config env.sample Docker registry ECR Update the task definition with image version & env vars ECS runs new containers with updated version Stops the old version once new are up ★ The service name is guessed from current dir ★ image name is same as repo name in 
 spinal case without simpl- prefix ★ latest version is picked to push 1 2 3 4 5
  13. A solution Multiple tech stacks No (Dev)Ops. Easy to use

    Standard stack across platform Customizable standard Docker }Cloudformation CLI
  14. Microservices & DevOps - Keep it lightweight - Treat service

    creation/removal a frequent thing to do - Empower developers
  15. Microservices & DevOps - Build time dependency => library -

    Runtime dependency => another microservice - Lifecycle dependency => DevOps