Ever wondered what makes a cloud-native application “cloud-native”? Ever wondered what the unique challenges are and how best to address them on fully-open Java technologies? In this workshop, you’ll learn what it means to be cloud-native and how that impacts application development. You’ll learn about Eclipse MicroProfile, an industry collaboration defining technologies for the development and management of cloud-native microservices. With a full set of MicroProfile workshop modules available to you, you’ll be able to start with the basics of REST services and progress to more advanced topics, or you can jump right in and develop secure, fault tolerant, configurable and monitorable microservices.
Once you’ve developed your microservice, you’ll learn how to package it in a Docker container and deploy it to a Kubernetes cluster. Finally, you’ll learn the role of a service mesh and use Istio to manage your microservice interactions or you can choose to deploy your microservices to OpenShift.
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Codecamp 2020 microservices made easy workshop
1. Microservices Made
Easy Workshop
With MicroProfile, OpenJ9, Open Liberty
and OpenShift
Jamie Lee Coleman
Software Engineer/Developer Advocate @IBM
@Jamie_Lee_C
1
3. Workshop Modules
3
8 Modules each between 15 – 25 mins long.
1. Creating RESTful Web Services
2. Injecting dependencies into a Java
microservices
3. Configuring Java microservices
4. Building fault-tolerant microservices
with the @fallback annotation
5. Containerizing Microservices
6. Introduction to MicroShed Testing
7. Deploying MicroServices to Kubernetes
8. Building and deploying a RESTful web
service on OpenShift 4.x
Extra Reactive Modules
1. Creating reactive Java microservices
2. Testing reactive Java microservices
3. Building and deploying Reactive Java
microservices on OpenShift 4.x
11. Microservices
11
A microservice is an architectural style that
structures an application as a collection of
loosely coupled services
The benefit of having an application made up of
microservices is that it improves modularity and
make it easier to develop, test and more
resilient to changes
Allows teams to work on individual services
Enables continuous delivery and deployment
per microservice
13. 13
What is MicroProfile?
● Eclipse MicroProfile is an open-source community
specification for Enterprise Java microservices
● A community of individuals, organizations, and
vendors collaborating within an open source
(Eclipse) project to bring microservices to the
Enterprise Java community microprofile.io
15. 15
MicroProfile
Community
● Over a dozen vendors and Java user
groups
● 140 individual contributors
● Over half a dozen independent
implementations
16. Locations of some
MicroProfile
Contributors
1
6
• Seattle – USA
• Ontario – Canada
• Canberra – Australia
• Stuttgart – Germany
• Rochester – USA
• Prague – Czech Rep
• Newcastle – UK
• Munich – Germany
• Paris – France
• Hursley – UK
• Centurion – South Africa
• Boston – USA
• Sao Paulo – Brazil
• Rio de Janeiro – Brazil
• Coimbra – Portugal
• Amsterdam – Netherlands
Source: MicroProfile.io
36. Focus on code
Easy to make fast and iterative changes
Easy to write tests
True-to-production testing (as much as possible)
Ready for containers
Not-in-your-way tools and flexibility
Open Liberty Overview
37. Developer Experience: dev mode
• Boosts developer productivity
• Immediate feedback for code and
config changes
• No re-build necessary
mvn liberty:dev
42. 42
Open J9 Overview
Designed from the start to span all the
operating systems needed by IBM products
This JVM can go from small to large
Can handle constrained environments or
memory rich ones
Is used by the largest enterprises on the
planet
If any JVM can be said to be at the heart of
the enterprise – its this one.
44. 44
MicroProfile &
Containers
Containers Kubernetes OpenShift
JSON-B 1.0JSON-P 1.1CDI 2.0
Config 1.4
Fault
Tolerance 2.1
JWT
Propagation
1.1
Health
Check 2.2
Metrics 2.3
Open Tracing
1.3
Open API 1.1
JAX-RS 2.1
Rest Client
1.4
45. 45
Containers
build, ship and run any app,
anywhere
docker build -t ol-runtime --no-cache=true .
docker run -d --name rest-app -p 9080:9080 -p
9443:9443 -v <absolute path to
guide>/start/target/liberty/wlp/usr/servers:/servers ol-
runtime
46. my-
app:latest
(app container)
mongo:4.0
(DB container)
Dev/Test env
Production env
integrati
on tests
end users
my-
app:latest
(app container)
mongo:4.0
(DB container)
Testcontainers
• Integration tests that are easy
to setup, write, and run
• Test your apps the same way
they run in production
• Tests are portable to any
compatible implementation:
• Liberty
• Wildfly
• Payara
• TomEE
• etc…
50. Regain control with Kubernetes
Organize and govern the container chaos
Kubernetes
Intelligent
Scheduling
Self-HealingHorizontal
Scaling
Automated
Rollouts &
Rollbacks
Secret &
Configuration
Management
Service Discovery &
Load Balancing
55. Why should developers care about DevOps?
• Enables the delivery of innovation more often
• Improves quality
• Reduces toil to allow developers to focus on code
• Improves confidence
• Improves time to production
• Improves communication and collaboration
56. OpenShift is a Kubernetes-based
platform with added functions. It
streamlines the DevOps process by
providing an intuitive development
pipeline. It also provides integration
with multiple tools to make the
deployment and management of
cloud applications easier.
57. IDE integration - With OpenShift's
integration with Eclipse, JBoss Developer
Studio, and Visual Studio developers can
stay entirely within the IDE that they
when working with OpenShift.
59. 5
Time To Code
To get started visit the following URL in your browser:
https://ide.skillsnetwork.site/cloud-native-java-
with-microprofile-kubernetes-and-openshift
Please run the cleanup.sh script from the terminal at the end of each lab to
clean up your environment.
60. 60
Recap
MicroProfile
• No vendor lock in
• Full set of cloud ready APIs
• Config
• Health
• Metrics
• Fault Tolerance
• …
• Big community
Open Liberty
• Modular Application server
• Light weight
• Easy to configure
• Jakarta EE 8 certified
• Production ready
• Official Docker images available
• Optimized for development
All Open Source!
Open J9
• Low memory footprint
• Fast startup time
• High application throughput
• Smoother ramp-up in the cloud
• Easy to use Docker images
OpenShift
• Works on all clouds
• Uses Containers for easy portability
• Can run on Private and Public Clouds
• Integration with IDE’s to make
developers lives easier.
61. Thank you
61
Jamie Lee Coleman
Software Engineer/AdvocateTeam Lead
Email: jlcoleman@uk.ibm.com
Twitter: @Jamie_Lee_C
Editor's Notes
Master Draft 1
Provide the APIs and runtime capabilities that help with creating large numbers of collaborating services
Basically having something where you aren't required to do some steps before shutdown - that shooting a container won't leave you in a bad situation
Meaning if you just kill it, you don’t leave stuff hanging around.
The ‘weight’ of your cloud-native application should be proportional to what the application does/uses. You don’t want to be bringing along 0.5GB of runtime to serve up a simple servlet.
https://12factor.net/dev-prod-parity
Make the time gap small: a developer may write code and have it deployed hours or even just minutes later.
Make the personnel gap small: developers who wrote code are closely involved in deploying it and watching its behavior in production.
Make the tools gap small: keep development and production as similar as possible.
https://12factor.net/config
Resource handles to the database, Memcached, and other backing services
Credentials to external services such as Amazon S3 or Twitter
Per-deploy values such as the canonical hostname for the deploy
Dev env where testing is done is the same as production. Using the same OS, Runtime, etc. Docker. Immutable build… to make sure code doesn’t have to change.
Single build form the Dockerfile – don’t re-build.
Explicitly listing version in Dockerfiles
Availability of Docker images, single independent process, etc…
Advice:- This slide should be the last slide created prior to socialization. It should be presented first as a summary of the rest of the WAD.
While containers are great , managing a container infrastructure without a high degree of automation and orchestration can soon become a nightmare …
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery.
Horizontal scaling
Scale your application up and down with a simple command, with a UI, or automatically based on CPU usage.
Self-healing
Restarts containers that fail, replaces and reschedules containers when nodes die, kills containers that don’t respond to your user-defined health check, and doesn’t advertise them to clients until they are ready to serve.
Automated rollouts and rollbacks
Kubernetes progressively rolls out changes to your application or its configuration, while monitoring application health to ensure it doesn’t kill all your instances at the same time. If something goes wrong, Kubernetes will rollback the change for you. Take advantage of a growing ecosystem of deployment solutions.
Service discovery and load balancing
No need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods, and can load-balance across them.
Open source container orchestration platform
Clear governance model with Linux Foundation
Jointed effort by IBM, Google, Huawei, Intel, Red Hat and many others
Operations rather than developer centric
Basic primitives support a rich set of features
Releases new versions every three months
New features preview in alpha/beta
Wide range of deployment options: bare metal, virtualized, private, public, hybrid, …