Managing Microservices in Production with Lagom by Christopher Hunt (@huntchr)
Managing Microservices in Production with Lagom
by Christopher Hunt (@huntchr)
Hybrid Cloud
Recap
•Reactive Microservices framework for the JVM • Focus on right sized services • Asynchronous IO and communication as first class •Highly productive development environment • Takes you through to production deployment
Lagom for Java Enterprises
Today
•Deploy Chirper on 3 EC2 nodes • Lagom, ConductR and 12 factor apps
Lagom for Devops
Deploy
12 Factor Apps with Lagom & ConductR 12factor.net
I. Codebase One codebase tracked in revision control, many deploys
• Lagom • single repository • many services per “project”
I. Codebase
II. Dependencies Explicitly declare and isolate dependencies
•Bundles • self contained • verifiable and immutable • Docker and other containers • meta info including ACLs, resource requirements and startup config
II. Dependencies
III. Config Store config in the environment
• separate • verifiable and immutable • per bundle or across bundles
III. Config
IV. Backing services Treat backing services as attached resources
• no distinction to other services • local or remote services • service location • Amazon RDS, external service, JDBC (dynamic-data-source)
IV. Backing services
V. Build, release, run Strictly separate build and run stages
• build - sbt, “bundle:publish”, bintray • release - “conduct load”, resolvers, build artifact + config • run - “conduct run”
V. Build, release, run
VI. Processes Execute the app as one or more stateless processes
• bundle has components, components == process • share-nothing is a bit of a fallacy • DBs are shared • distributed pub-sub • CRDTs
VI. Processes
VII. Port binding Export services via port binding
• bind port • host port • proxy port (if a proxy is required) • *very* sophisticated proxy configuration (again, if required)
VII. Port binding
VIII. Concurrency Scale out via the process model
• scale up down at will • “conduct run x —scale y”
• resilient processes • automatically restarted
VIII. Concurrency
IX. Disposability Maximize robustness with fast startup and graceful shutdown
• replication • fast startup
• graceful termination • 10 seconds - sigkill
• auto scaling • 1.2 • process metrics based • statsd
IX. Disposability
X. Dev/prod parity Keep development, staging, and production as similar as possible
• sandbox cluster for development • uses Docker
• bundle publishing to bintray • resolver mechanism to support other repos
X. Dev/prod parity
XI. Logs Treat logs as event streams
• Elasticsearch • consolidated • “conduct logs”
• syslog
XI. Logs
XII. Admin processes Run admin/management tasks as one-off processes
• runAll for operations •CLI is composable • idempotent • composition the Unix way
XII. Admin processes