microservices in production
TRANSCRIPT
![Page 1: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/1.jpg)
Microservices in Production
Võ Duy TuấnCEO/FounderTeamcrop.com
![Page 2: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/2.jpg)
• 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
![Page 3: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/3.jpg)
Why Microservices?
- Website Modules
- 3rd-party Web Service
- Mobile App Web Service
- Small team
- Scalability
![Page 4: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/4.jpg)
DEV(Development)
![Page 5: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/5.jpg)
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
![Page 6: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/6.jpg)
DEV / Bounded context
![Page 7: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/7.jpg)
DEV / Inter-service communication
• Authentication:– Json Web Token (JWT)– Access Trusted Network
• Communications:– Restful (HTTP)– SOAP (HTTP)– AMQP– App specific: Redis…– Protobuf
![Page 8: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/8.jpg)
DEV / API Gateway
CLIENT
SHIPMENTGATEWAY
Giaohangnhanh Viettel Post VNPost
RESTful SOAP SOAP
![Page 9: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/9.jpg)
DEV / Single Page App (SPA)
• Require JS• Backbone JS• React JS• jQuery• Semantic UI• Custom Icon Font• Gulp• Phonegap
![Page 10: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/10.jpg)
OPS(Operations)
![Page 11: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/11.jpg)
OPS / Docker
sudo wget -qO- https://get.docker.com/ | sh
![Page 12: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/12.jpg)
OPS / Configuration
![Page 13: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/13.jpg)
OPS / Configuration (cont.)
![Page 14: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/14.jpg)
OPS / Logging / API Log
Micro-Framework’s Middleware
![Page 15: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/15.jpg)
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.
![Page 16: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/16.jpg)
OPS / Logging / System & Custom Log
Docker image: voduytuan/tc-graphite
![Page 17: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/17.jpg)
OPS / Monitoring
API Status Monitoring from statuscake.com
![Page 18: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/18.jpg)
OPS / Service discovery
![Page 19: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/19.jpg)
OPS / Service discovery (cont.)
![Page 20: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/20.jpg)
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
![Page 21: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/21.jpg)
OPS / Service discovery (cont.)
Sample template of Haproxy, will parsed by Consul-template
![Page 22: Microservices in production](https://reader031.vdocuments.net/reader031/viewer/2022021506/587bdff01a28ab834d8b7425/html5/thumbnails/22.jpg)
OPS / Continuous Integration / Continuous Deployment