Slide 1

Slide 1 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Project Helidon Akihiro Nishikawa Oracle Corporation Japan Java Libraries for Microservices 1

Slide 2

Slide 2 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2

Slide 3

Slide 3 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Program Agenda What’s Helidon? Demo Diving a little bit deeply... Helidon can also run on Custom JRE! Resources 1 2 3 4 5 3

Slide 4

Slide 4 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. What’s Helidon? 4

Slide 5

Slide 5 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 5

Slide 6

Slide 6 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 6 • Microframework • Functional Style • Reactive • Transparent • MicroProfile • Declarative Style • CDI, JAX-RS, JSON-P • Familiar to Java EE developers

Slide 7

Slide 7 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 7 Java Microservice Frameworks Smaller Larger Spring Boot Microframeworks MicroProfile Based Open Liberty Full-Stack Dropwizard

Slide 8

Slide 8 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 8 Architecture Helidon SE Netty WebServer Security Config Helidon MP CDI JAX-RS JSON-P

Slide 9

Slide 9 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Eclipse MicroProfile • Java EE,!".#1($0*.) !-2016 • RedHatIBMTomitribePayara$%1' • ,!".#1($*.) !- • Java EE APIMicroProfile API – JAX-RS, CDI, JSON-P, JSON-B – MP Config, Metrics, Health Check, Fault Tolerance, JWT Auth – Open API, OpenTracing, RestClient • +/&1 9 2.1 (2018/10/19)

Slide 10

Slide 10 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Reactive WebServer • BF7(D-?8BG A',7(F9 Config • ! ?8B • #8F32F0 • ?8B • !'5=8F9 • 10 Security • E • '*9;*D:E1+@A7( • • • %#=C;)4 – OIDC – JWT – Google Login Helidon SE

Slide 11

Slide 11 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Helidon SE import io.helidon.webserver.Routing; import io.helidon.webserver.WebServer; public static void main(String[] args) { WebServer.create( Routing.builder() .get("/greet", (req, res) -> res.send("Hello World!")) .build()).start(); } Helidon MP import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; public class GreetService { @GET @Path("/greet") public String getMsg() { return "Hello World!"; } } 11 SE/MPHello World

Slide 12

Slide 12 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 12 CDI ExtensionsPreview !!#&0.10.5 Helidon MP Helidon SE Microprofile 1.2 • WebServer, Config, Security • JSON-P • Metrics • OpenTracing • HTTP/2 (experimental) CDI Extensions MicroProfile ConfigCDI 2.0 # CDI Extension$" #%

Slide 13

Slide 13 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. • MicroProfile 2.x • Reactive HTTP Client • GraalVM • Project Starter UI • Reactive storage (NoSQL, ADBA) • Open API • Eventing 13

Slide 14

Slide 14 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Demo 14

Slide 15

Slide 15 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Demo • Quickstart • Server config and startup • Basic Routing • Basic JSON handling • Docker Container Creation • Running on Kubernetes 15

Slide 16

Slide 16 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 16 Archetype Helidon SE mvn archetype:generate -DinteractiveMode=false ¥ -DarchetypeGroupId=io.helidon.archetypes ¥ -DarchetypeArtifactId=helidon-quickstart-se ¥ -DarchetypeVersion=0.10.5 ¥ -DgroupId=io.helidon.examples ¥ -DartifactId=quickstart-se ¥ -Dpackage=io.helidon.examples.quickstart.se Helidon MP mvn archetype:generate -DinteractiveMode=false ¥ -DarchetypeGroupId=io.helidon.archetypes ¥ -DarchetypeArtifactId=helidon-quickstart-mp ¥ -DarchetypeVersion=0.10.5 ¥ -DgroupId=io.helidon.examples ¥ -DartifactId=quickstart-mp ¥ -Dpackage=io.helidon.examples.quickstart.mp

Slide 17

Slide 17 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 17

Slide 18

Slide 18 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 18 mvn package java -jar target/quickstart-se.jar

Slide 19

Slide 19 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Dockerfile #FROM openjdk:8-jre-slim FROM openjdk:8-jre-alpine RUN mkdir /app COPY libs /app/libs COPY quickstart-se.jar /app CMD ["java", "-jar", "/app/quickstart-se.jar"] 19

Slide 20

Slide 20 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 20 Docker docker build -t quickstart-se target docker run --rm -p 8080:8080 quickstart-se

Slide 21

Slide 21 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. kind: Service apiVersion: v1 metadata: name: quickstart-se labels: app: quickstart-se spec: type: NodePort selector: app: quickstart-se ports: - port: 8080 targetPort: 8080 name: http --- kind: Deployment apiVersion: extensions/v1beta1 metadata: name: quickstart-se spec: replicas: 1 template: metadata: labels: app: quickstart-se version: v1 spec: containers: - name: quickstart-se image: quickstart-se:12alpine-custom imagePullPolicy: IfNotPresent ports: - containerPort: 8080 --- 21 app.yaml

Slide 22

Slide 22 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 22 Kubernetes kubectl create -f target/app.yaml kubectl get service

Slide 23

Slide 23 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Diving a little bit deeply... 23

Slide 24

Slide 24 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 24 Module $ jar --file=target/libs/helidon-common-0.10.5.jar --describe-module io.helidon.common jar:file:///Users/oracle/Documents/Helidon/quickstart- se8/target/libs/helidon-common-0.10.5.jar/!module-info.class exports io.helidon.common requires java.base mandated requires java.logging

Slide 25

Slide 25 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Server (SE) # application.yaml app: greeting: "Hello" server: sockets: - secure: port: 443 backlog: 1024 receive-buffer: 0 timeout: 60000 ssl: .... - another: port: 12041 25 ServerConfiguration serverConfig = ServerConfiguration.fromConfig(config.get("server"));

Slide 26

Slide 26 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. # 3 default MicroProfile Config sources: # System.getProperties() # System.getenv() # META-INF/microprofile-config.properties # default is localhost server.host=some.host # default is 7001 server.port=7011 # Helidon configuration (optional) # Length of queue for incoming connections. server.backlog: 512 # TCP receive window (Default:0) server.receive-buffer: 256 # Socket timeout (msec) defaults:0 (infinite) server.timeout: 30000 # Default is CPU_COUNT * 2 server.workers=4 # Default is not to use SSL ssl: private-key: keystore-resource-path: "certificate.p12" keystore-passphrase: "abcd" 26 Server (MP)

Slide 27

Slide 27 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Routing (SE) 27 MPJAX-RS 2.0 private static Routing createRouting() { return Routing.builder() .register(JsonSupport.get()) .register("/greet", new GreetService()) .build(); } public class GreetService implements Service { ... public final void update(final Routing.Rules rules) { rules .get("/", this::getDefaultMessage) .get("/{name}", this::getMessage) .put("/greeting/{greeting}", this::updateGreeting); } }

Slide 28

Slide 28 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. JSON 28 SEJSON-P private static Routing createRouting() { return Routing.builder() .register(JsonSupport.get()) .register("/greet", new GreetService()) .build(); } public class GreetService implements Service { ... public final void update(final Routing.Rules rules) { rules .get("/", this::getDefaultMessage) .get("/{name}", this::getMessage) .put("/greeting/{greeting}", this::updateGreeting); } }

Slide 29

Slide 29 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Metrics • Prometheus • maven 29 io.helidon.microprofile.metrics helidon-metrics-se

Slide 30

Slide 30 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 30 import io.helidon.metrics.MetricsSupport; ... final MetricsSupport metrics = MetricsSupport.create(); ... // Endpoint final MetricsSupport metrics = MetricsSupport.create(); greetService = new GreetService(); return Routing.builder() .register(JsonSupport.get()) .register(metrics) .register("/greet", greetService) .get("/alive", Main::alive) .get("/ready", Main::ready) .build(); ...

Slide 31

Slide 31 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 31 import io.helidon.metrics.RegistryFactory; import org.eclipse.microprofile.metrics.Counter; import org.eclipse.microprofile.metrics.MetricRegistry; ... private final MetricRegistry registry = RegistryFactory.getRegistryFactory() .get() .getRegistry(MetricRegistry.Type.APPLICATION); ... // Counter private final Counter greetCounter = registry.counter("accessctr"); ... // Counter greetCounter.inc(); ...

Slide 32

Slide 32 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 32 PrometheusJSON

Slide 33

Slide 33 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. OpenTracing • Reactive Web ServerOpenTracing Zipkin • ZipkinTracing • 33 io.helidon.webserver helidon-webserver-zipkin

Slide 34

Slide 34 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 34 // OpenTracing Tracer ServerConfiguration.builder() .tracer(new ZipkinTracerBuilder.forService("Tracing ") .zipkin("ZipkinURL") .build()) .build()

Slide 35

Slide 35 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 35 Routing Routing.builder() .register(webSecurity) .register(JsonSupport.get()) .register(MetricsSupport.create()) .get("/ready", (req, res) -> { res.status(Http.Status.OK_200); res.send("Ready!"); }) .register(StaticContentSupport.builder("/WEB", Main.class.getClassLoader()) .welcomeFileName("index.html") .build()) .register("/greet", new GreetService()) .build(); /resources

Slide 36

Slide 36 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. • • • • Audit 36

Slide 37

Slide 37 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Authentication artifactId JWT Provider helidon-security-provider-jwt HTTP Basic Authorization helidon-security-provider-http-auth HTTP Digest Authorization helidon-security-provider-http-auth Header Assertion helidon-security-provider-header-atn HTTP Signatures helidon-security-provider-http-signature ABAC (Attribute based access control) Authorization helidon-security-provider-abac Google Login Authentication Provider helidon-security-provider-google-login OIDC (Open ID Connect) Authentication provider helidon-security-provider-oidc IDCS Role Mapping Provider helidon-security-provider-idcs-mapper 37

Slide 38

Slide 38 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 38 • • Reactive Web Server • Jersey io.helidon.security helidon-security io.helidon.security helidon-security-integration-webserver io.helidon.security helidon-security-integration-jersey

Slide 39

Slide 39 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. • 39 private static WebSecurity createWebSecurity(final Config config) { Security security = Security.builder() .addProvider(GoogleTokenProvider .builder() .clientId( config.get("security.properties.google-client-id") .asString())) .build(); return WebSecurity.from(security); }

Slide 40

Slide 40 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. (2) • Routing • 40 Routing.builder().register(webSecurity) .register(JsonSupport.get()) .register(MetricsSupport.create()) .register("/greet", new GreetService()) .build(); final Routing.Rules rules; rules.any(this::counterFilter) .get("/", this::getDefaultMessageHandler) .get("/greeting",this::getGreetingHandler) .get("/{name}", this::getMessageHandler) .put("/greeting/{greeting}", WebSecurity.authenticate(), this::updateGreetingHandler);

Slide 41

Slide 41 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Etcd • • 41 Etcd io.helidon.config helidon-config-etcd Config config = Config.from( EtcdConfigSourceBuilder.from(URI.create("http://my-etcd:2379"), "/config.yaml", EtcdConfigSourceBuilder.EtcdApi.v3));

Slide 42

Slide 42 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Helidon can also run on Custom JRE! 42

Slide 43

Slide 43 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 43 Java 8, 11, 12... $ docker images quickstart-se REPOSITORY TAG IMAGE ID CREATED SIZE quickstart-se 12-oracle 35675acf14d4 7 days ago 468MB quickstart-se 11-oracle c3d347de8d23 7 days ago 469MB quickstart-se 8-alpine fae858de0489 7 days ago 88.6MB quickstart-se 8-slim 3a505f8068dc 7 days ago 210MB

Slide 44

Slide 44 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 44 Java 8, 11, 12... $ docker images quickstart-se REPOSITORY TAG IMAGE ID CREATED SIZE quickstart-se 12-oracle 35675acf14d4 7 days ago 468MB quickstart-se 11-oracle c3d347de8d23 7 days ago 469MB quickstart-se 8-alpine fae858de0489 7 days ago 88.6MB quickstart-se 8-slim 3a505f8068dc 7 days ago 210MB

Slide 45

Slide 45 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. JRE • jdeps • jlink JRE 45 $ jdeps --list-deps quickstart-se.jar $ jlink --compress=2 --module-path /opt/openjdk-12/jmods ¥ --add-modules ¥ java.base,java.logging,java.sql,java.desktop ¥ --no-header-files ¥ --no-man-pages ¥ --output /linked

Slide 46

Slide 46 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 46 FROM openjdk:11.0.1-jdk-oraclelinux7 AS jlink-package RUN jlink --compress=2 --module-path /usr/java/openjdk-11/jmods ¥ --add-modules java.base,java.logging,java.sql,java.desktop ¥ --no-header-files ¥ --strip-debug ¥ --no-man-pages ¥ --output /linked FROM oraclelinux:7-slim COPY --from=jlink-package /linked /usr/java/openjdk-11 ENV JAVA_HOME= /usr/java/openjdk-11 ENV PATH="$PATH:$JAVA_HOME/bin" RUN mkdir /app COPY libs /app/libs COPY quickstart-se.jar /app CMD ["java", "-jar", "/app/quickstart-se.jar"]

Slide 47

Slide 47 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 47 1/3 $ docker images quickstart-se REPOSITORY TAG IMAGE ID CREATED SIZE quickstart-se 12-oracle-custom edafa9a43204 7 days ago 172MB quickstart-se 12-oracle 35675acf14d4 7 days ago 468MB quickstart-se 11-oracle-custom acc0127977c8 7 days ago 172MB quickstart-se 11-oracle c3d347de8d23 7 days ago 469MB quickstart-se 8-alpine fae858de0489 7 days ago 88.6MB quickstart-se 8-slim 3a505f8068dc 7 days ago 210MB

Slide 48

Slide 48 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 48 1/3 $ docker images quickstart-se REPOSITORY TAG IMAGE ID CREATED SIZE quickstart-se 12-oracle-custom edafa9a43204 7 days ago 172MB quickstart-se 12-oracle 35675acf14d4 7 days ago 468MB quickstart-se 11-oracle-custom acc0127977c8 7 days ago 172MB quickstart-se 11-oracle c3d347de8d23 7 days ago 469MB quickstart-se 8-alpine fae858de0489 7 days ago 88.6MB quickstart-se 8-slim 3a505f8068dc 7 days ago 210MB

Slide 49

Slide 49 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. • JDKAlpine Linux • Musl libc 49 Project Portola https://www.musl-libc.org/

Slide 50

Slide 50 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 50 Alpine Linux... $ docker images quickstart-se REPOSITORY TAG IMAGE ID CREATED SIZE quickstart-se 12-alpine-custom d948b732d796 7 days ago 58.4MB quickstart-se 12-alpine ba31e688dcb6 7 days ago 341MB quickstart-se 12-oracle-custom edafa9a43204 7 days ago 172MB quickstart-se 12-oracle 35675acf14d4 7 days ago 468MB quickstart-se 11-oracle-custom acc0127977c8 7 days ago 172MB quickstart-se 11-oracle c3d347de8d23 7 days ago 469MB quickstart-se 8-alpine fae858de0489 7 days ago 88.6MB quickstart-se 8-slim 3a505f8068dc 7 days ago 210MB

Slide 51

Slide 51 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Resources 51

Slide 52

Slide 52 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Resources 52 https://github.com/oracle/helidon @helidon_project https://helidon.slack.com https://helidon.io

Slide 53

Slide 53 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 53

Slide 54

Slide 54 text

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 54

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content