microservices in production
TRANSCRIPT
Microservices in Production
Võ Duy TuấnCEO/FounderTeamcrop.com
• Why Microservices?
• DEV:o Micro-framework
o Bounded context
o Inter-service communication
o API gateway
o Single Page App (SPA)
Table of contents
• OPS:o Docker
o Configuration
o Logging & monitoring
o Service discovery
o CI/CD
Why Microservices?
- Website Modules
- 3rd-party Web Service
- Mobile App Web Service
- Small team
- Scalability
DEV(Development)
DEV / Micro-framework
• Easy to learn• Easy to code• Easy to run• Easy to test• Easy to deploy• Easy to upgrade• Restful Web Service• Slim framework
DEV / Bounded context
DEV / Inter-service communication
• Authentication:– Json Web Token (JWT)– Access Trusted Network
• Communications:– Restful (HTTP)– SOAP (HTTP)– AMQP– App specific: Redis…– Protobuf
DEV / API Gateway
CLIENT
SHIPMENTGATEWAY
Giaohangnhanh Viettel Post VNPost
RESTful SOAP SOAP
DEV / Single Page App (SPA)
• Require JS• Backbone JS• React JS• jQuery• Semantic UI• Custom Icon Font• Gulp• Phonegap
OPS(Operations)
OPS / Docker
sudo wget -qO- https://get.docker.com/ | sh
OPS / Configuration
OPS / Configuration (cont.)
OPS / Logging / API Log
Micro-Framework’s Middleware
OPS / Logging / System & Custom Log
• Graphite: metric and log data store.• Collectd: syslog and software metric collector.• Grafana: Front-end, chart builder.• Statsd: graphite proxy for other programming
languages.
OPS / Logging / System & Custom Log
Docker image: voduytuan/tc-graphite
OPS / Monitoring
API Status Monitoring from statuscake.com
OPS / Service discovery
OPS / Service discovery (cont.)
OPS / Service discovery (cont.)
HAProxy
Consul-template
Docker Engine
Backend 01 : Port 32680
Backend 02 : Port 32681
Backend 03 : Port 32682
Update haproxy.cfg& Reload haproxy
CONSUL REGISTRATOR
Notify
Update
Pull1
2
3
45
Client
gliderlabs/registratorgliderlabs/consul-server
OPS / Service discovery (cont.)
Sample template of Haproxy, will parsed by Consul-template
OPS / Continuous Integration / Continuous Deployment