Scale with Microservices
-
Upload
vo-duy-tuan -
Category
Technology
-
view
1.441 -
download
2
Transcript of Scale with Microservices
Scale with Microservices
Võ Duy Tuấn CEO/Founder Teamcrop.com
Vo Duy Tuan CEO/Founder @ Teamcrop.com
§ PHP
§ Web Scalability & Optimization
§ Data Mining
§ E-Commerce
§ Docker & Microservices
Interests
WHY we choose Microservices?
1. ERP System
2. Multi-platform
3. Separation of concerns
A design principle for separating a computer program into distinct sections, such that
each section addresses a separate concern. - Wikipedia
4. Resource allocation
5. Trend
HOW we implement Microservices?
1. Bounded context
2. Inter-service communication
• Authentication: – Json Web Token (JWT) – Access Trusted Network
• Communications: – Restful (HTTP) – SOAP (HTTP) – AMQP – App specific: Redis… – Protobuf
3. 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
4. Single Page App (SPA)
5. Configuration
5. Configuration (cont.)
6. Logging
6. Logging (cont.)
7. Monitoring
API Status Monitoring from statuscake.com
7. Monitoring (cont)
8. Docker
8. Docker overview
8. Docker keywords
• Container • Image • Registry • Port • Volume • Dockerfile
8. Docker Container CLI
docker run -ti -d \
-h tc-todo \
--restart=always \
--name tc-todo-$RANDOM -p :80 \
-e SERVICE_TAGS=tc-todo \
-e CONFIG_URL=http://configurl.com/?abc \
-e GRAPHITE_IP=127.0.0.1 \
-v /services/tc-todo/private:/var/www/private \
-v /services/tc-todo/src:/var/www/src \
voduytuan/tc-microservice
9. Service discovery
OPS / Service discovery (cont.)
9. 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
NoSfy
Update
Pull 1
2
3
4 5
Client
gliderlabs/registrator gliderlabs/consul-‐server
9. Service discovery (cont.)
Sample template of Haproxy, will parsed by Consul-‐template
10. Continuous Integration / Continuous Deployment
10. Continuous Integration / Continuous Deployment