java development on bluemix

58
PEJ-5354 Java Development on IBM Bluemix Ram Vennam

Upload: ram-vennam

Post on 09-Jan-2017

611 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Java Development on Bluemix

PEJ-5354 Java Development on IBM BluemixRam Vennam

Page 2: Java Development on Bluemix

Please Note:

2

• IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion.

• Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision.

• The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract.

• The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.

• Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user’s job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

Page 3: Java Development on Bluemix

Agenda

• Bluemix Overview• Java on Bluemix Cloud Foundry• Deep Dive into Liberty buildpack• Java on Bluemix Containers• Cloud applications best practices• Popular services for Java devs• Questions

3

Page 4: Java Development on Bluemix

Bluemix OverviewCloud platform for everyone

Page 5: Java Development on Bluemix

Bluemix is an open-standards, cloud-based platform for building, running, and managing applications.Build your apps, your wayUse the most prominent compute technologies to power your app: Cloud Foundry, Docker, OpenStack.

Extend apps with servicesA catalog of IBM, third party, and open source services allow the developer to stitch an application together quickly.

Scale more than just instancesDevelopment, monitoring, deployment, and logging tools allow the developer to run and manage the entire application.

Layered SecurityIBM secures the platform and infrastructure and provides you with the tools to secure your apps.

Deploy and manage hybrid apps seamlesslyGet a seamless dev and management experience across a number of hybrid implementations options.

Flexible Pricing Try compute options and services for free and, when you’re ready, pay only for what you use. Pay as you go and subscription models offer choice and flexibility.

Page 6: Java Development on Bluemix

6

You managePlatform manages

IaaS vs PaaSPaaS allows the developer to just focus on their code

CodeData

RuntimeMiddleware

OSVirtualization

ServersStorage

Networking

CodeData

RuntimeMiddleware

OSVirtualization

ServersStorage

Networking

JDK

OS

JEE App Server

Infrastructure as a

ServicePlatform

as a Service

Page 7: Java Development on Bluemix

Bluemix worksfor Java Developers.

Page 8: Java Development on Bluemix

Compute Options

8

Infrastructure as a

ServicePlatform

as a Service

Page 9: Java Development on Bluemix

Java Starter Applications

Page 10: Java Development on Bluemix

3 ways to update your code

Page 11: Java Development on Bluemix

Eclipse tools for Bluemix

Page 12: Java Development on Bluemix

Eclipse Development ModeA special mode of an application instance that allows the app developer to conduct various development operations.

Remote debuggingIncremental update

Page 13: Java Development on Bluemix

$ cf push MyAppName –p libertyDBApp.warTail Logs:$ cf logs MyAppName

Past Logs:$ cf logs MyAppName --recent

Command Line Interface to deploy and manage applications

Command line

Page 14: Java Development on Bluemix

git push

Git Repo

Everything you need to manage your code, builds and deployments in the cloud.

DevOps Services

Page 15: Java Development on Bluemix

Deeper DiveLiberty Buildpack

Page 16: Java Development on Bluemix

For Systems of Engagement applications and a lighter weight option for Systems of Record

• Full Java EE 7 Platform• Small footprint (~ 54MB), quick startup (< 3 sec)• Full fidelity to WebSphere Application Server Full

Profile• Distributed caching: Extreme scale as a feature• Add custom features and integrate 3rd party

components via Liberty extensions interface• Install new features from repository (local or remote)

with no server restart

16

WebSphere Application Server Liberty Profile

Page 17: Java Development on Bluemix

Buildpack for running applications on IBM WebSphere Application Server Liberty Profile.

Designed to run "packaged" servers and web applications.

Generates the liberty server configuration for a bound services

Simplify developers’ lives by requiring minimal configuration and making it easy to consume services

Loads into the server only what is needed for a running application

https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack

17

WebSphere Liberty Buildpack

Page 18: Java Development on Bluemix

Standalone jar files (*.jar)Web Applications (*.war)Enterprise Applications (*.ear)Liberty profile server package (*.zip)Liberty profile server directory (dir.)

https://www.ng.bluemix.net/docs/Liberty/LibertyApp.html

18

Supported Application Types

Page 19: Java Development on Bluemix

• Create a server package$ ./bin/server package myServer --include=usr

• Or, simply push a server config directory

$ cd /wlp/usr/servers/myServer$ cf push <appname>

myServer

appsmyWondefulApp1.war

server.xml

myWondefulApp2.ear

Push an entire Liberty server package – complete with application(s), shared libs, drivers and server configuration.

Liberty server packages

Page 20: Java Development on Bluemix

Using Bluemix Services

Page 21: Java Development on Bluemix
Page 22: Java Development on Bluemix

• Create & Bind the service– Command line

• cf marketplace to see available services• cf create-service to create a service instance• cf bind-service to bind the service instance to your application• cf restart, or cf push again

– Web portal

• Read service connection and credentialsSample VCAP_SERVICES environment variable:

22

The plain way to consume a service

Page 23: Java Development on Bluemix

23

Read VCAP_SERVICES env variable and parse credentials

Sample code to connect to a SQL service

Page 24: Java Development on Bluemix

24

Establish connection

Sample code to connect to a SQL service

Page 25: Java Development on Bluemix

The following services have an easier way to consume them

The better way to consume services

SQL Database

Mongo DB

Modern “resource”

BLU Data Warehouse

Data Cache

Session Cache

Elastic MQ

Operational services

Log Analysis

Monitoring and

Analytics

Cloudant

Auto Scaling

Java EE standard “resource”

Page 26: Java Development on Bluemix

Using SQLDB service

26

Page 27: Java Development on Bluemix

The Java EE way – Sample code for using SQLDB

27

public class TestServlet extends HttpServlet { @Resource (name = "jdbc/mydb") private DataSource db;

// Alternatively use InitialContext lookup DataSource lookup = (DataSource) new InitialContext().lookup("jdbc/mydb");

“mydb” is the name of the service instance you create in Bluemix

That’s it! All familiar code, no changes required in order to make it work in cloud!

• No need for a server.xml• Don’t need to read VCAP_SERVICES

“mydb” is the name of the service instance you create in Bluemix

Page 28: Java Development on Bluemix
Page 29: Java Development on Bluemix

Java on IBM Containers

29

Page 30: Java Development on Bluemix

Docker

30

Fast, lightweight, isolated containers “Docker containers spin up fast and provide a layer of isolation from other services running in containers.” “The lightweight containers can spin up in a matter of seconds without consuming a lot of resources.”

docker.com

Page 31: Java Development on Bluemix

Traditional VMs vs Docker Containers

31

http://patg.net/containers,virtualization,docker/2014/06/05/docker-intro/

vs

Page 32: Java Development on Bluemix

Docker Images

32

Read-only template used to create Docker containers

Build new images by modifying existing images

Find and share images on a registry (Docker Hub)

Page 33: Java Development on Bluemix

Sample Dockerfile

33

Page 34: Java Development on Bluemix

CLI: Test locally, push to Bluemix

34

docker build -t my_ibmliberty_image:v1 .

docker run --name my_liberty_container my_liberty_image

docker tag my_liberty_image registry.ng.bluemix.net/my_namespace/my_ibmliberty_image

docker push registry.ng.bluemix.net/my_namespace/my_liberty_image

Page 35: Java Development on Bluemix

DevOps Services

35

git push

Git Repo

https://github.com/rvennam/AuthServer

Page 36: Java Development on Bluemix

Remote Developing with Eclipse

36https://github.com/rvennam/LibertyIBMContainers

Page 37: Java Development on Bluemix

Cloud ApplicationsBest practices

Page 38: Java Development on Bluemix

• Stateless– Ephemeral file system– Ephemeral memory

• Capture logs• Ports• Security

Coding Do’s and Don'ts

Page 39: Java Development on Bluemix

1. One codebase tracked in revision control, many deploys2. Explicitly declare and isolate dependencies3. Store config in the environment4. Treat backing services as attached resources5. Strictly separate build and run stages6. Execute the app as one or more stateless processes7. Export services via port binding8. Scale out via the process model9. Maximize robustness with fast startup and graceful shutdown10. Keep development, staging, and production as similar as possible11. Treat logs as event streams12. Run admin/management tasks as one-off processes

39

The Twelve Factor Apphttp://12factor.net/

Page 40: Java Development on Bluemix

IBM BluemixJava Migration to Cloud

Page 41: Java Development on Bluemix

DayTrader sample

WAS Full Profile application•EE 6•Uses database for persistence•The application or database does not scale•“System of Record”•Nothing cloud about it!

Page 42: Java Development on Bluemix

Migration Toolkit

42

Avoid writing to the local file systemTransport security is terminated at the routerClient certificate authentication is not availableHeadless JRE vs JDK on BlueMixAdvise on porting persistence data to services

HTTPSessions, WXS, JMS, legacy data, MongoDB, DB2 etc.,

Advise on Transaction Recovery and flagging for 2 phase commits

Rules to assist migration of Liberty apps to the cloud

Page 43: Java Development on Bluemix

Tooling to help migrate

IBM WebSphere Application Server Migration Toolkit

Still talks to previous, on-premises database

Value-Add:Application can scale horizontallyLoad balancingHigh availability

Cloud Integration SecureGateway

APIManagement

Deploy to Bluemix

Page 44: Java Development on Bluemix

Scaling

Scale up and down in seconds!

Condition based scaling

Page 45: Java Development on Bluemix
Page 46: Java Development on Bluemix

Auto-Scaling

46

Page 47: Java Development on Bluemix
Page 48: Java Development on Bluemix
Page 49: Java Development on Bluemix

Session persistence and caching

WebSphere eXtreme Scale

Distributed object caching

Session off-load and replication

Page 50: Java Development on Bluemix

Other Application Services

Page 51: Java Development on Bluemix

Database

Powerful wiring features makes it easy to consume!

@Resource (name = "jdbc/mydb") private DataSource db;

“mydb” is the name of the service instance created in Bluemix

ObjectStorage

DataWorksCloudantNoSQL DB

SQL Database ClearDB MySQLDatabase

ElephantSQL MongoLab Redis Cloud mongodb mysql

Use Databases provided by Bluemix

Page 52: Java Development on Bluemix

Make it Engaging!

Consume services

Rules EngineUse ODM to monitor stocks, portfolio and perform actions when criteria is met

Social View friends portfolio.Post tweets and collaborate on stock transactions. Stay connected w/ tweets related to your portfolio

Push/SMS –Instant notifications to buy or sell

API ManagementExport backend interfaces as a serviceDecomposition of application

Single Sign-On – Improve authenticationBlob Service

Store transactional records

Page 53: Java Development on Bluemix

FirewallSQLDB

Session Cache

M&A

Bluemix

WAS Liberty RuntimeIBM JRE

WAS Liberty Buildpack

CloudTrader

Page 54: Java Development on Bluemix

Code

Data

Runtime

Middleware

OS

Virtualization

Servers

Storage

Networking

Code

Data

Runtime

Middleware

OS

Virtualization

Servers

Storage

Networking

Code

Data

Runtime

Middleware

OS

Virtualization

Servers

Storage

Networking

Fully Customer Managed

Platform Managed

Pattern Managed via Console

Code

Data

Runtime

Middleware

OS

Virtualization

Servers

Storage

Networking

Single UI Management for WAS

Code

Data

Runtime

Middleware

OS

Virtualization

Servers

Storage

Networking

On-Premises(BYOH)

Code

Data

Runtime

Middleware

OS

Virtualization

Servers

Storage

Networking

Liberty Buildpack

IBM WebSphere Application

Server WAS Containers

Broader Snapshot: Choose our WAS Platforms

IBM Bluemix

Page 55: Java Development on Bluemix

Entry Points1. Create new cloud native apps & microservices to respond to business needs

Connect existing Java applications to new cloud apps via APIs2. Optimize existing Java apps to Cloud without change and adopt pay-as-you-go3. Enhance existing Java applications with Bluemix services

Interaction TierHybrid Enterprise Tier

Existing Apps New Apps

Cloud Connected WAS as a Service WebSphere LibertyMicro-Services

SoftLayer/BluemixManaged Service

Docker Images

Traditional Management

Model

Cloud Readiness Assessment & Best

PracticesCloud Native Management

Model

Cloud Foundation Services

23

Hybrid Cloud Hybrid Cloud Hybrid Cloud

55

WebSphere LibertyMicro-Services

Hybrid Cloud

WAS On Premises

1 1

Page 56: Java Development on Bluemix

Notices and Disclaimers

56

Copyright © 2016 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM.

U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM.

Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided.

Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.

Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.

References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business.

Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.

It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law

Page 57: Java Development on Bluemix

Notices and Disclaimers Con’t.

57

Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

The provision of the information contained h erein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right.

IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™, FASP®, FileNet®, Global Business Services ®, Global Technology Services ®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®, StoredIQ, Tealeaf®, Tivoli®, Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.

Page 58: Java Development on Bluemix

Thank YouYour Feedback is Important!

Access the InterConnect 2016 Conference Attendee Portal to complete your session surveys from your

smartphone, laptop or conference kiosk.