h tu ps://github.com/adobe-apiplatform Be a Microservices Hero | ContainerCon’15 Dragos Dascalita Haut | Adobe Presentation scripts: h tu ps://gist.github.com/ddragosd/608bf8d3d13e3f688874
A CreativeCloud Microservice Sample: Content-Aware fj ll
A CreativeCloud Microservice Sample: send to Photoshop from the mobile device
Lifecycle of a microservice
Growing the microservices ecosystem
API Platform
API Platform
api1 api2
How to make it easier to scale Microservices in this model ?
Microservices Microservices , , Containers Containers & Apache & Apache Mesos Mesos write containerize & deploy write containerize & deploy write containerize & deploy
Apache Apache Mesos Mesos
Apache Apache Mesos Mesos “Program for the data center “Program for the data center Just like you program for the OS” Just like you program for the OS” & & Microservices Microservices Computer: Computer: Data Center Data Center Kernel: Kernel: Mesos Mesos OS: OS: Mesos Frameworks, Marathon, Mesos Frameworks, Marathon, Mesosphere’s DCOS Mesosphere’s DCOS Services: Services: Microservices Microservices Tra ffi Tra ffi c Ctrl: c Ctrl: API Gateway API Gateway • Facilitates inter-API communication Facilitates inter-API communication • Routing, Tra Routing, Tra ffi ffi c Shaping, Filtering c Shaping, Filtering
#DEMO #DEMO Apache Apache Mesos Mesos SETUP A MINI-DATA-CENTER SETUP A MINI-DATA-CENTER & & Microservices Microservices 4 VMs , 1 Leader, 2 Slaves, 1 Admin 4 VMs , 1 Leader, 2 Slaves, 1 Admin
#DEMO #DEMO Apache Mesos Apache Mesos SETUP A MINI-DATA-CENTER SETUP A MINI-DATA-CENTER & Microservices & Microservices 4 VMs , 1 Leader, 2 Slaves, 1 Admin 4 VMs , 1 Leader, 2 Slaves, 1 Admin Simple ways to get started: Simple ways to get started: - h tu tu ps://mesosphere.com/product/ ps://mesosphere.com/product/ - h tu tu ps://open.mesosphere.com/ge ps://open.mesosphere.com/ge tu tu ing-started/ ing-started/ datacenter/install/ datacenter/install/ - h tu tu ps://www.digitalocean.com/community/ ps://www.digitalocean.com/community/ tutorials/how-to-con fj tutorials/how-to-con fj gure-a-production-ready- gure-a-production-ready- mesosphere-cluster-on-ubuntu-14-04 mesosphere-cluster-on-ubuntu-14-04
#DEMO #DEMO Apache Apache Mesos Mesos THE “KERNEL”: MESOS THE “KERNEL”: MESOS 3 VMs , 1 Leader 3 VMs , 1 Leader & & Microservices Microservices
#DEMO #DEMO Apache Apache Mesos Mesos THE “OS” : MARATHON THE “OS” : MARATHON ( it will start our ( it will start our microservices microservices ) ) & & Microservices Microservices
#DEMO #DEMO Apache Mesos Apache Mesos START A “SERVICE” IN THE “OS”: START A “SERVICE” IN THE “OS”: Hello-world Hello-world microservice microservice & & Microservices Microservices { � "id": "hello-world", � "container": { � "type": "DOCKER", � "docker": { � "image": "tutum/hello-world", � "forcePullImage": true, � "network": "BRIDGE", � "portMappings": [ � curl "http://<marathon_url>/v2/apps" \ � { � "containerPort": 80, � -H "Content-Type: application/json" \ � "hostPort": 0, � "protocol": "tcp" � -H "Accept:application/json" \ � } � ] � --data @/tmp/hello_world_app.json � } � }, � "cpus": 0.5, � "mem": 512, � "instances": 1 � } �
#DEMO #DEMO Apache Mesos Apache Mesos START A “SERVICE” IN THE “OS”: START A “SERVICE” IN THE “OS”: hello-world hello-world microservice microservice & & Microservices Microservices
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY - DESIGN PRINCIPLES - - DESIGN PRINCIPLES - & & Microservices Microservices Simple Scalable Secure Super fast
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY & & Microservices Microservices OPENRESTY Custom Modules NGINX • Nginx Lua Module • NAXSI – WAF • Upstream • Nginx Redis • api-gateway request- • HTTP Proxy • Headers more • PCRE • Set misc validation • SSL • LuaJIT • api-gateway-async-logger • …. • ….
#DEMO #DEMO Apache Mesos Apache Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY Simple con Simple con fj fj guration blending in Nginx guration blending in Nginx & & Microservices Microservices con fj con fj guration guration server { � listen 80; � server_name hello-world.api.container-con.org ; � � location / { � # ------------------------------------------------- � # Specify what to validate for this location � # ------------------------------------------------- � set $ validate_api_key on; � set $ validate_oauth_token on; � set $ validate_user_profile on; � set $ validate_service_plan on; � ... � # ------------------------------------------------- � # Proxy the request to the actual microservice � # ------------------------------------------------- � proxy_pass $microservice$request_uri ; � } � } �
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY Service Discovery Example Service Discovery Example & & Microservices Microservices hello-world .api.containercon.org � server { listen 80; server_name ~^(?<app_name>.[^\.]+) \.api\.(?<domain>.+); � … � } �
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY ( OPENRESTY & NGINX based) ( OPENRESTY & NGINX based) & & Microservices Microservices
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY DEPLOYMENT DEPLOYMENT & & Microservices Microservices curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data ' � { � "id": "api-gateway", � "container": { � "type": "DOCKER", � "docker": { � "image": "adobeapiplatform/apigateway:latest", � "forcePullImage": true, � "network": "HOST" � } � }, � "cpus": 4, � "mem": 4028.0, � "env": { "MARATHON_HOST": "http://<marathon_host>" }, � "acceptedResourceRoles": ["slave_public"], � "constraints": [ [ "hostname", "UNIQUE" ] ], � "ports": [ 80 ], � "instances": 1 � } �
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY DEPLOYMENT DEPLOYMENT & & Microservices Microservices curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data ' � { � "id": "api-gateway", � "container": { � "type": "DOCKER", � "docker": { � "image": "apiplatform/apigateway:latest", � Optionally you can include health-check � "forcePullImage": true, � "network": "HOST" � "healthChecks": [ } � { }, � "protocol": "HTTP", "cpus": 4, � "portIndex": 0, "mem": 4028.0, � "path": "/health-check", "env": { "MARATHON_HOST": "http://<marathon_host>" }, � "gracePeriodSeconds": 3, "acceptedResourceRoles": ["slave_public"], � "intervalSeconds": 10, "constraints": [ [ "hostname", "UNIQUE" ] ], � "timeoutSeconds": 10 "ports": [ 80 ], � } "instances": 1, � ] � <health_check_block> � } �
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY & & Microservices Microservices • Demo: API KEY Management Demo: API KEY Management
#DEMO #DEMO Apache Apache Mesos Mesos THE “TRAFFIC CTRL” : API GATEWAY THE “TRAFFIC CTRL” : API GATEWAY API KEY Management with Redis API KEY Management with Redis & & Microservices Microservices curl -X POST -H "Content-Type:application/json" ${MARATHON_HOST}/v2/apps?force=true --data ' � { � "id": "api-gateway-redis", � "container": { � "type": "DOCKER", � "docker": { � "image": "redis:latest", � "forcePullImage": true, � "network": "HOST" � } � }, � "cpus": 0.5, � "mem": 1024.0, � "constraints": [ [ "hostname", "UNIQUE" ] ], � "ports": [ 6379 ], � "instances": 1 � }' �
Recommend
More recommend