api-gateway bringt ordnung in microservices-wildwuchs · © materna gmbh 2016 the great baltimore...

38
Frank Pientka, Dortmund API-Gateway bringt Ordnung in Microservices-Wildwuchs

Upload: others

Post on 09-Jun-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

Frank Pientka, Dortmund

API-Gateway bringt Ordnung in Microservices-Wildwuchs

Page 2: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de 3

Warum sind Verbindungen wichtig?

Page 3: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Agenda

APIs regieren die Welt – Schnittstellenprobleme Microservices und Qualitätsmerkmale (NFRs) Microservices und Design Patterns Das API-Gateway Design Pattern API-Gateway Implementierungen Fazit

4

Page 4: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

The Great Baltimore Fire of 1904

5

Page 5: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Schnittstellenprobleme gestern, wie heute sind gefährlich und teuer …

6

Page 6: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

APIs are enabling digital integration

Page 7: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Risikopotential APIs

8

Schnittstelle Protokoll Implementierung Infrastruktur Betrieb Überwachung Änderung

Hohe Kosten, Risiken

Besonders Cloud, IoT

Page 8: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de 10

Qualitätsanforderungen an eine API

VertragDesignGovernancePolicyAuthentifizierungAuthorisierungSchutzCachingThrottlingQuotas

API

Änderbarkeit

Langlebigkeit

Sicherheit

WartbarkeitKompatibilität

Versionierbarkeit

Verfügbarkeit

Page 9: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Traditionelle Webarchitektur

11

Browser StoreServer

DBSE

RV

ICE

Mobile App

Page 10: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Microservices

12

Order Entry Service

Order History Service

ProductSearchService

ProductDetail

Service

PriceService

Central services:Metrics

AutorisationAuthentication

CachingThrottlingAuditingLogging

Page 11: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Aus der Musterküche: Microservice Design Patterns (C. Richardson)

13

Page 12: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de 14

Gateway Pattern of Enterprise Application Architecture (EAA) 2003

An object that encapsulates access to an external system or resource. (see EAA page 466)Similar Remote Façade, Filter, Router, Proxy

http://martinfowler.com/eaaCatalog/gateway.html

Page 13: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Service-Nutzung ohne API-Gateway

15

Web browser

Mobile client

Order Entry Service

Order History Service

ProductSearchService

ProductDetail

Service

PriceService

Page 14: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

API-Gateway

16

API-Gateway

Web browser

Mobile client

Order Entry Service

Order History Service

ProductSearchService

ProductDetail

Service

PriceService

Page 15: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Microservices Architektur

17

Browser

Order function

ProductDB

OrderDB

UserDB

Search function

API-Gateway

Authentication

BaaSFaaS

Serverless architectures

Mobile App

BfF

Page 16: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

API-Gateway – API-First Strategy

18

API

V 1.x

V 2.x

Impl

MetricsAuthorisationCachingThrottlingAuditingLogging

Page 17: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Gartner Magic Quadrant for Application Services Governance

21

23.06.2016 Red Hat übernimmt API-Manager 3scale09.09.2016 Google kauft API-Management-Provider Apigee

Page 18: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

API-Gateway-Lösungen: public vs. private

Amazon API Gateway JBoss API Gateway 3scale's API Management platform

22

Netflix Zuul Proxy Filter

Page 19: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Netflix Zuul: API Edge Service

23

Page 20: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

https://aws.amazon.com/de/api-gateway/

24

Page 21: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

3scale + Amazon API Gateway = Full Complement API Program Management

25

Page 22: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

APIman Architektur

26

RESTClient

ServiceDeveloper

API Realm

APIman Realm

APIman ManagerAutorisierung

APIman Gateway

Load Balancer

KeycloakAuthentifizierung

ServiceEndpoint

RDBMS

ElasticSearch API Metrics

ElasticSearch APIs

APIman REST API

APIman UI

APIman Gateway

APIman Gateway API

1..*

1..*

1..1

1..*

1..*

REST API

1..1

1..1

1..1

1..1

SysAdmin1..1

Page 23: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Getting Started APIman

27

localhost:8080/apimanui/ 1.2.6 http://localhost:8080/apimanconf/apiman.properties, tomcat-users.xml

<role rolename="apiuser"/><role rolename="apiadmin"/><role rolename="apipublisher"/><user username="admin" password="admin123!" roles="apiuser,apiadmin"/><user username="apimanager" password="apiman123!" roles="apipublisher"/>

</tomcat-users>

Page 24: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de 28

Page 25: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

API Catalog

29

Page 26: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

http://localhost:8080/apimanui admin/admin123!

30

Page 27: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Vertrag erstellen

32

Page 28: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Apiman Plugins

33

Page 29: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Apiman Policy

34

Page 30: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

APIman Systemstatus

35

http://www.apiman.io/latest/api-manager-restdocs.html

Page 31: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

apiman.plugins.repositories=http://mvnrepository.com/artifact/io.apiman.plugins

37

Page 32: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

History, Policies & Metrics

38

Page 33: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

DEMO: Verwalten der Tomcat Manager REST-Schnittstelle mit APIman

39

Self managed versioned system

http://localhost:8080/manager/text/list/apimanui:running:0:apimanui

/apiman-plugins-keycloak-oauth-policy-1.2.1.Final:running:0:apiman-plugins-keycloak-oauth-policy-1.2.1.Final

/apiman-gateway-api:running:0:apiman-gateway-api

/apiman:running:0:apiman

/apiman-es:running:0:apiman-es

/apiman-gateway:running:0:apiman-gateway

/manager:running:1:manager

Page 34: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de 40

http://localhost:8080/manager/text/list

https://localhost:8443/apiman-gateway/MATERNA/manager/1.0

DEMO: Tomcat manager App versionieren

Page 35: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

API-Gateway – horcht was kommt von draußen rein

45

Page 36: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

„Ein guter Zaun schafft gute Nachbarn“ Robert Frost

„Ein guter Vertrag schafft gute Nachbarn“

46

Page 37: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de

Aktuell API-man mehr zum Evaluieren - 3scale-OS-Version abwarten Qualitätsanforderungen steigen Stärkere Entkopplung (Aufruf, Ressource) Unterschiedliche API-Granularitäten für unterschiedliche Clients NFRs zentral und einheitlich NICHT lokal in jedem Microservice API-(Lifecycle-)Management wird immer wichtiger (IoT, Cloud, mobile,

Web, BfF) API-Gateway erzeugt neue Komplexität, verbessert jedoch Service-

Management und -Nutzung

Ausblick

47

Page 38: API-Gateway bringt Ordnung in Microservices-Wildwuchs · © Materna GmbH 2016  The Great Baltimore Fire of 1904 5

© Materna GmbH 2016 www.materna.de 48

Weitere Infos

API Gateway design pattern, Chris Richardsonhttp://microservices.io/patterns/apigateway.html

APIman http://www.apiman.io Keycloak Reference Guide http://www.keycloak.org APIman Roadmap http://www.apiman.io/latest/roadmap.html Frank Pientka: Horcht, was kommt von draußen rein - API-Management

mit apiman, JavaSPEKTRUM 07/16