45
Public DEV203 – Developing Cloud-Native Apps on SAP HANA Cloud Platform

DEV203 - Developing Cloud-Native Apps on SAP HANA Cloud Platform

Embed Size (px)

Citation preview

Public

DEV203 – Developing Cloud-Native Apps on SAP HANA Cloud Platform

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 2Public

Speakers

Bangalore, October 5 - 7

Abhik Gupta

Las Vegas, Sept 19 - 23

Matthias Steiner

Barcelona, Nov 8 - 10

Rui Nogueira

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 3Public

Disclaimer

The information in this presentation is confidential and proprietary to SAP and may not be disclosed without the permission of SAP. Except for your obligation to protect confidential information, this presentation is not subject to your license agreement or any other service or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or any related document, or to develop or release any functionality mentioned therein.

This presentation, or any related document and SAP's strategy and possible future developments, products and or platforms directions and functionality are all subject to change and may be changed by SAP at any time for any reason without notice. The information in this presentation is not a commitment, promise or legal obligation to deliver any material, code or functionality. This presentation is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. This presentation is for informational purposes and may not be incorporated into a contract. SAP assumes no responsibility for errors or omissions in this presentation, except if such damages were caused by SAP’s intentional or gross negligence.

All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 4Public

Disclaimer II

”Not your grandfather’s SAP…”

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 5Public

Disclaimer II

”…but your Granny’s!”

§ Code Base: Enterprise Granny(HCP Sample – ‘Best practices’ using Java Open-Source)

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 6Public

Agenda

Intro� Context && definition of ‘cloud-native’

Platform� Services, Containers && compute units

Characteristics� Stateless && scaling, 12-factor apps

Cloud-native� Dev && Ops, Resilience� Microservices && APIs

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 7Public

Why cloud? → Business Agility

IDEAminimum

viable product

X.Y

Time to market Fast innovation cycles

Total cost of development (TCD)

Continuousdelivery

open sourcere-use

APIs

DevOps

microservices culture

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 8Public

Adapt or … else!

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 9Public

Cloud native?!?

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 10Public

Cloud native: 1/2

“[...] There is a rough consensus on many Cloud Native traits. Containers as an atomic unit, for example. Micro-services as the means of both construction and communication. Platformindependence. Multiple language support. Automation as a feature of everything from build todeployment. High uptime. Ephemeral infrastructure (cattle not pets). And so on. [...]“

- Stephen O'Grady (RedMonk)

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 11Public

Cloud native: 2/2

“Cloud native systems will have the following properties:

(a) Container packaged. Running applications and processes in software containers as an isolated unit ofapplication deployment, and as a mechanism to achieve high levels of resource isolation. Improves overalldeveloper experience, fosters code and component reuse and simplify operations for cloud native applications.

(b) Dynamically managed. Actively scheduled and actively managed by a central orchestrating process. Radically improve machine efficiency and resource utilization while reducing the cost associated withmaintenance and operations.

(c) Micro-services oriented. Loosely coupled with dependencies explicitly described (e.g. through serviceendpoints). Significantly increase the overall agility and maintainability of applications. The foundation will shape the evolution of the technology to advance the state of the art for application management, and tomake the technology ubiquitous and easily available through reliable interfaces.“

[Charter]

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 12Public

Cloud Maturity Model

- Platform && services

- Containers && compute units

- Stateless && scaling

- 12 factor apps

- Cloud agnostic (Spring Cloud Connectors)- Dev && Ops

- Resilience: (hystrix), monitoring, logging, ex handling

- Microservices && APIs

Source: Allan Beck & John McTeague (JPMorgan Chase & Co.)

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 13Public

SAP HANA Cloud PlatformTechnical and Business Services

SAP HANA Cloud Platform (PaaS)App Center New Apps / App Extensions

Runtimes

Java

XSJS

HTML5

Node.js1

Other1

Dev&

Ops

Service Enablement | API Management

Business Services YaaSCommerce

YaaSMarketing

YaaSService

Platform Services Integration IoT Security Analytics

UX Mobile Collaboration

SAP ASE Redis1Big Data Services:

PostgreSQL1 MongoDB1

Data & Storage Services

On-Premises / Managed

Cloud

SAP S/4HANA

SAP Business Suite

SAP Business Warehouse

IaaS SAP Data CentersSAP HANA Cloud Platform, virtual machines1

Non-SAP Data Centers1

SaaS

SAP S/4HANA

SAP SuccessFactors

SAP Cloud for Customer

SAP Ariba

Concur

SAP Fieldglass

SAP Business ByDesign

1) planned innovations / future direction

1

1

SAP HANA Vora1 / Hadoop1

SAP HANA

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 14Public

SAP HANA Cloud PlatformServices && capabilities

Business ServicesMobileSecurity Data & Storage Dev & Ops

User Experience Internet of ThingsIntegrationCollaboration Analytics

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 15Public

Containers && compute units

containers vs “containers”

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 16Public

Stateless && scaling

§ stateful communicationvia cookies | url-rewriting

§ “sticky” session load-balancing

§ local session state X§ poor scaling/resource consumption

§ preferably stateless communication

§ “round robin”load-balancing

§ no | shared state

§ horizontal scalingX

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 17Public

The 12-factor app [http://12factor.net/]

I. Codebase- One codebase tracked in revision control, many deploys

II. Dependencies- Explicitly declare and isolate dependencies

III. Config- Store config in environment

IV. Backing Services- Treat backing services as attached resources

V. Build, release, run- Strictly separate build and run stages

VI. Processes- Execute the app as one or more stateless processes

VII. Port binding- Export services via port binding

VIII. Concurrency- Scale out via the process model

IX. Disposability- Maximize robustness with fast startup and graceful shutdown

X. Dev/prod parity- Keep development, staging, and production as similar as possible

XI. Logs- Treat logs as event streams

XII. Admin processes- Run admin/management tasks as one-off processes

( )

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 18Public

I. Codebase- One codebase tracked in revision control, many deploys

§ git§ single repo - single app (1:!)§ shared-code via libraries &

explicit dependency handling§ feature branches

Source: http://12factor.net/codebase

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 19Public

II. Dependencies- Explicitly declare and isolate dependencies

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 20Public

recipe

shops

ingredients

cooking instructions

Dependency Management (Java)

<repositories/>

<dependencies/>

<build/>

[http://bit.ly/neogitmaven]

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 21Public

III. Config- Store config in environment

Strict separation of config from code(configuration varies across deploys, code base is the same)

e.g. • store config as environment variables (12-factors) - VCAP_SERVICES• destination service• Spring Cloud Config

/*** Detects the current landscape the application is run on and initializes the Spring {@link ApplicationContext}

accordingly.* * @see ApplicationContextInitializer*/

public class EnvironmentContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext>

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 22Public

Spring: environment && profiles

strict separation of config from codeconfig varies across deploys, code is the same

e.g. • store config as environment variables (12-factors)• destination service• Spring Cloud Config

/*** Detects the current landscape the application is run on and initializes the Spring {@link

ApplicationContext} accordingly.* * @see ApplicationContextInitializer*/

public class EnvironmentContextInitializer implementsApplicationContextInitializer<ConfigurableApplicationContext>

<beans profile="local" ><jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/DefaultDB" />

</beans>

<beans profile="cloud"><cloud:data-source id="dataSource"/>

</beans>

<beans profile="test"><bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource”><property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/><property name="url" value="jdbc:derby:memory:DemoDB;create=true"/><property name="username" value="demo"/><property name="password" value="demo"/>

</bean></beans>

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 23Public

IV. Backing Services- Treat backing services as attached resources

Relational NoSQLIn-memory

messaging,queing,

scheduling

mail, push notifications,

iot

connectivity,integration,

orchestration

tech services

businessservices

APIs

socialnetworks

businessnetworks

digitalmarketplaces

§ lookup§ discovery§ (auto-) wiring§ dependency injection

§ proxies§ networks§ security

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 24Public

V. Build, release, run- Strictly separate build and run stages [http://bit.ly/saphcp_ci]

http://bit.ly/saphcp_jenkins

http://bit.ly/saphcp_di

http://bit.ly/saphcp_travis-ci

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 25Public

VI. Processes- Execute the app as one or more stateless processes

§ preferably stateless communication

§ “round robin”load-balancing

§ no | shared state

§ Horizontal scaling

memcached | redis | …

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 26Public

VIII.Concurrency- Scale out via the process model [http://bit.ly/saphcp_elastic]

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 27Public

IX. Disposability- Maximize robustness with fast startup and graceful shutdown

computeunit

computeunit

computeunit

computeunit

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 28Public

X. Dev/prod parity- Keep dev, staging, and production as similar as possible

runtime | buildpacks | containers

(backing) services

staging

OS | vm

dev (local) prod

stubs proxies

env

= =

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 29Public

XI. Logs- Treat logs as event streams

“A twelve-factor app never concerns itself with routing or storage of its outputstream. It should not attempt to write to or manage logfiles. Instead, each running processwrites its event stream, unbuffered, to stdout. [...]“

http://bit.ly/saphcp_logging

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 30Public

XII.Admin processes- Run admin/management tasks as one-off processes

Separately, developers will often wish to do one-off administrative or maintenance tasksfor the app, such as:

§ Running database migrations [...]§ Running a console [...] to run arbitrary code or inspect the app’s models against the live

database [...]§ Running one-time scripts committed into the app’s [...]“

http://bit.ly/saphcp_liquibase1http://bit.ly/saphcp_liquibase2

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 31Public

Cloud agnostic

SAP HCP …

runtimes| buildpacks | containers

(backing) services

§ lookup§ discovery§ (auto-) wiring§ dependency injection

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 32Public

Spring Cloud Connectors

SAP HCP …

runtime | containers

(backing) services

§ lookup§ discovery§ (auto-) wiring§ dependency injection

[http://bit.ly/spring-cloud-sap]

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 33Public

DevOps

development + operations

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 34Public

Resilience [hystrix – Circuit Breaker]

Source: https://github.com/Netflix/Hystrix/wiki/How-it-Works

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 35Public

Microservices: characteristics [http://martinfowler.com/articles/microservices.html]

§ Componentization via Services

§ Vertical cut (full-stack) based on biz domain vs traditional (silo-ed) functional teams

§ Granularity/size of micro-services

§ DevOps (products/services not projects), ownership over the full life-cycle

§ Smart endpoints (APIs/services) vs complex ESB

§ Decentralized Governance - “SOA done right ?!?”

§ Decentralized Data Management

§ Infrastructure automation

§ Design for failure

§ Evolutionary design

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 36Public

APIs [http://bit.ly/ensw_api]

“An application programming interface (API) is a specification intended to be used asan interface by software components to communicate with each other.“

- Wikipedia

https://api.sap.com

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 37Public

Exemplary: Architecture Blueprint (Java)

Cross-cutting concerns (X

CC

)

REST Façade (JAX-RS)

Business Logic Layer (Services)

Data Access

Connectivity Persistence

Presentation Layer

Domain Model

DTO

JavaBeans

HTTP Client

Apache CXF (+ Olingo)AOP

-Filters,

Interceptors,

Spring Framework

Environment abstractionSpring Cloud Connectors

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 38Public

Questions && answers

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 39Public

Credits

Elderly Man icon designed by Peacock Dream on the @NounProject. https://thenounproject.com/term/elderly-man/9728

Elderly Woman icon designed by Peacock Dream on the @NounProject. https://thenounproject.com/term/elderly-woman/9727

Light Bulb icon designed by Takao Umehara on the @NounProject. https://thenounproject.com/term/light-bulb/14973

Sustainability icon designed by Diego Naive on the @NounProject. https://thenounproject.com/term/sustainability/219630

pull request icon designed by Richard Slater on the @NounProject. https://thenounproject.com/term/pull-request/116191

Dinosaur icon designed by Jennifer Cozzette on the @NounProject. https://thenounproject.com/term/dinosaur/13786

Dinosaur icon designed by Jennifer Cozzette on the @NounProject. https://thenounproject.com/term/dinosaur/13787

meteor icon designed by Erik Kuroow on the @NounProject. https://thenounproject.com/term/meteor/345452

Container hook icon designed by Korawan.M on the @NounProject. https://thenounproject.com/term/container-hook/496239

Browser cloud icon designed by Sergey Demushkin on the @NounProject. https://thenounproject.com/term/browser-cloud/534265

Load Balancer icon designed by Alex WaZa on the @NounProject. https://thenounproject.com/term/load-balancer/43671

network server icon designed by Chad Remsing on the @NounProject. https://thenounproject.com/term/network-server/530820

database icon designed by Rockicon on the @NounProject. https://thenounproject.com/term/database/524054

Cloud icon designed by Gregor Črešnar on the @NounProject. https://thenounproject.com/term/cloud/232545

Share Cloud icon designed by LeftHandedGraphic on the @NounProject. https://thenounproject.com/term/share-cloud/66775

hosting icon designed by Gregor Črešnar on the @NounProject. https://thenounproject.com/term/hosting/232489

Expansion icon designed by Magicon on the @NounProject. https://thenounproject.com/term/expansion/308097

Server icon designed by Creative Stall on the @NounProject. https://thenounproject.com/term/server/105040

Cloud icon designed by TukTuk Design on the @NounProject. https://thenounproject.com/term/cloud/53820

Public

Demo

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 41Public

SAP TechEd Online

Continue your SAP TechEd education after the event!

Access replays of � Keynotes� Demo Jam� SAP TechEd live interviews � Select lecture sessions� Hands-on sessions� …

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 42Public

Further information

Related SAP TechEd sessions:DEV101 - HANA Cloud Platform Now and the Road AheadDEV102 - Extending SAP Business Suite and SAP S/4HANA with SAP HANA Cloud PlatformDEV103 - Cloud LoB extensions with the SAP HANA Cloud PlatformDEV106 - Cloud Application Monitoring and Profiling: Implementation and Tools

ITM212 - Application Lifecycle Management for SAP HANA Cloud PlatformDEV205 - Using Cloud Foundry–Based Features of SAP HANA Cloud PlatformDEV262 - Business Services for SAP Hybris as a Service on SAP HANA Cloud Platform

SAP Public Webhcp.sap.com

openSAPopenSAP courses

Watch SAP TechEd Onlinewww.sapteched.com/online

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 43Public

Please complete your session evaluation forDEV203

Contact information:

Matthias SteinerCloud Platform [email protected]

Feedback

© 2015 SAP SE or an SAP affiliate company. All rights reserved. 44Public

Thank you

Contact information:

Matthias SteinerCloud Platform Evangelist | SAP Mentor AlumnusSAP HANA Cloud Platform

http://twitter.com/steinermatt

http://scn.sap.com/people/steinermatt/

http://about.me/steinermatt

© 2016 SAP SE or an SAP affiliate company. All rights reserved. 45Public

© 2016 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://www.sap.com/corporate-en/about/legal/copyright/index.html for additional trademark information and notices.

Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.

National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.