Microservices
WIP
Bottom Line
Ideally...
- All services are configured programmatically by an API.
- Events are the driving force (event-driven, pub/sub model, trigger/action)
- Documentation is a first-class citizen.
- Live and die with 12-factor
- Services should have a single purpose (do one thing and do it well), be loosely coupled (know little about each other), and have high cohesion (encapsulates all related functionality and data together).
APIs, events, and docs!
Big pieces
- Application
- Pipelines
- Platform
Application
Where the services themselves live...
Big pieces
- APIs
- Storage
- Docs
APIs
- Powered by web frameworks (Java/Spring Boot, Python/Flask, Node/Express)
- Languages and frameworks don't matter as much as solid API contracts
- Single Responsibility (think
ls
, do one thing and do it well) - 12 Factor
- Immutability!!!
- Documentation is key - Swagger / OpenAPI spec
- How do you handle auth? Do service talk on each other or to a single API Gateway?
Storage
Tools:
- Databases (Mongo, Postgres, Redis)
- Task Queues
- Message Brokers (RabbitMQ, Kafka)
Issues:
- Storage is a hard problem.
- Containers are ephemeral, data is not.
- Do you have a database per service or a shared database?
- Disaster recovery? Testing?
Platform
Infrastructure management...
Big Pieces
- Software defined networks
- Service discovery
- Health checks (side cars approach)
- Logging
- Monitoring
- Load balancing
- Path-based routing
- Circuit breaking
Tools
- Kubernetes
- Docker Swarm
- Mesos
- Nomad
- Fully-managed: EKS, GKE, ECS
- Ubuntus MAAS (metal as a service)
- OpenStack
Pipelines
Continuos Integration
Triggers:
- Commit to source repo, build and test project
- What else?
Tools
- Github, GitLab, Git
- Jenkins, Travis, Circle
- AWS, GCP, Azure
- Docker Repos
- Linters, static code analysis
Continuous Delivery
Triggers:
- On successful build, deploy
- What else?
Tools
- Shell scripts (yuk!)
- Fabric (shell scripts on steroids)
- Terraform templates
- AWS (CodeDeploy, CodePipeline, CloudFormation), GCP, Azure
- Concourse
- Spinnaker
- Old school (Ansible, Chef, Puppet)