2. About the Authors
Arun is an architect and subject matter expert with a
decade of experience helping commercial,
government, military, and not for profit customers in
a number of complex BPM, SOA and PaaS projects. A
recognized though leader and a loudmouth on
DevOps and PaaS.
@arrunpareek
beatechnologies.wordpress.com
linkedin.com/in/arunpareek
Craig Barr is a Software Engineer with a decade of
experience empowering Enterprises in Banking,
Logistics, Manufacturing and in the three levels of
Australian Government with Service-Oriented
Architecture, Microservices and Cloud Computing.
Arun PareekCraig Barr
@craigbarrau
blog.rubiconred.com/author/craig-barr
blog.rubiconred.com/author/arun-pareek
github.com/craigbarrau
3. What to expect from this session
⢠Introduce MedRec use case and example monolith
⢠Containerise our monolith in place
⢠Create a CI/CD pipeline for our monolith as a foundation for the
future move to Microservices
⢠Introduce API-first microservices for Physicians and Patients to move
away from our monolithic architecture
⢠A look at Container Orchestration
⢠Health wearables demo
4. Microservices. DevOps. Containers.
Problems of yesteryear... Addressed in part by⌠Leading toâŚ
Long Cycles between
Releases
Domain Driven Design
Small Autonomous Teams
Infrastructure Automation
Complex and Manual
Delivery
Microservices
ContainersSystems at Scale
Large upfront planning and
analysis
Monoliths
DevOps
Continuous Delivery
On-Demand Virtualization
5. The âMonolithicâ MedRec Solution
MedRec (Patient/Admin) Application Shared Physician Application
Security
WLDiagnosticFramework
XML
Beans
JSTL
Java Server Pages
Structs
Spring Web
Spring Beans
Web Services
MedRec
Spring Reporting
JSTL
Java Server Pages
Structs
Spring Web
Web
Services
Spring / WLS Java Transaction
Message-
Driven
Enterprise
Java Beans
Java
Management
Extensions
Spring Beans
Spring Reporting
Spring JBDC
Spring
Messaging
Spring
Java
Mail
MySQL
6. Pain points for our
MedRec organisation
ď Operations and developers use inconsistent processes
ď Releases are often delayed just to late integration issues
ď Releases are a âbig ceremonyâ where everyone has to come together
ď Refactoring is painful and thus avoided
ď Ramping up new team members is challenging
ď A failure in one part of the system leads to degradation of everything
ď Use of cloud without re-architecture leads to higher operational costs
7. The Twelve-Factor Application
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes 12factor.net
22. Recap: Containerising our Monolith
1. Put everything in Version Control including MedRec
database changes
2. Used Liquibase so the application can manage any
required data changes on boot
3. Put our MedRec monolith into a Docker image without
any changes to the architecture
4. Automated our build, test and deploy processes and
pushed our container to a Docker Registry
5. Laid the foundation for Continuous Delivery
23. ⢠Increasingly difficult to ship features to the Physicians without
having to disrupt the Patients user base and vice versa
⢠The teams are under pressure to increase the value of their
offering through the interoperability of health wearables and the
establishment of Public APIs
⢠As a move to address challenges the development team will be
split into two Agile teams
⢠Physician Services
⢠Patient Care
Revisiting our
MedRec organisation
24.
25.
26. Microservices
⢠Small services that do one thing well
⢠Deliver features independently
⢠Each service owns its own data
"Gather together those things that
change for the same reason, and
separate those things that change
for different reasons." - Robert C.
Martin
Physician Services
NodeJS + MongoDb Patient Care
Java Spring + MySQL
27. Transitioning MedRec
to Microservices
Physicians API
NodeJS + MongoDb
Patient Care API
Java Spring + MySQL
MedRec UI
+ Monolith Legacy
Other Clients
Next Generation
User Experiencet
Future Services?
28. RESTful API Modeling
⢠GET /physicians to list all Physicians
⢠POST /physicians to add a new Physician and return their ID.
⢠GET /physicians/{id} to get a specific Physician record
⢠PUT /physicians/{id} to update a specific Physician record
⢠DELETE /physicians/{id} to delete a specific Physician record
⢠Related resources
⢠/appointments to manage physician schedules
⢠/observations to record medical observations
⢠/drugs to issue to patients as needed
⢠/prescriptions to write for patients
⢠GET /patients to list all Patients
⢠POST /patients to add a new Patients and return their ID.
⢠GET /patients/{id} to get a specific Patients record
⢠PUT /patients/{id} to update a specific Patients record
⢠DELETE /patients/{id} to delete a specific Patients record
Related Resources
⢠/appointments to manage patient scheduled
⢠/conditions for recording patient medical conditions
30. Docker Compose
version: '2'
services:
web:
image: craigbarrau/medrec-patients
depends_on:
- db
ports:
- 10011:8080
db:
image: mysql
environment:
- MYSQL_DATABASE=medrec
- MYSQL_USER=medrec
expose:
- 3306
version: '2'
services:
web:
image: craigbarrau/medrec-physicians
depends_on:
- db
ports:
- 10010:10010
db:
image: mongo
expose:
- 27017
Try it out!
$ git clone https://github.com/craigbarrau/medrec-physicians
$ cd medrec-physicians && docker-compose up âd
$ curl http://localhost:10010/physicians
Try it out!
$ git clone https://github.com/craigbarrau/medrec-patients
$ cd medrec-patients && docker-compose up âd
$ curl http://localhost:10011/medrec/patients
31. Continuous Delivery for our Microservices
ď
Build +
Unit Test
Integration
Test
Acceptance
Test
Release
Candidate
Triggered on
every code change
ď ď ď ď ď
ď
ď ď ď ď ď
ď
Deploy
Non-Prod
Deploy
Production
Load balancer
Switchover
2311f9
e3dd780
5f517c
ď
Build +
Unit Test
Integration
Test
Acceptance
Test
Release
Candidate
ď ď ď ď ď
ď
ď ď ď ď ď
ď
Deploy
Non-Prod
Deploy
Production
Load balancer
Switchover
c23c86
a5d8c1
dfA1cA
32. Recap #2: Microservices for MedRec
1. Created a Minimal Viable API for Physicians and
Patients using OpenAPI specification
2. Shared generated API documentation with
stakeholders using Swagger
3. Generated code stubs and coded basic
implementation for
⢠NodeJS - Physicians
⢠JAX-RS â Patients
4. Wired our implementations to Backing Services
⢠MongoDb
⢠MySQL
5. Automated our build, test and deploy processes
and pushed our containers to Docker Registry
33. Letâs review against 12 factor
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
34. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âStrictly separate build and run stages.â
Docker Registry
Code Environment
Packaged +
pushed
Pulled +
run
35. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âExecute the app as one or more
stateless processesâ
âAny data that needs to persist must be
stored in a stateful backing service,
typically a database.â
36. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
Stateless NodeJS Stateless Java Spring
Stateful MongoDB Stateful MySQL
Web Clients
37. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âExport services via
port bindingâ
38. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
Option 1: HTTP export by Application
var port = process.env.PORT || 10010;
app.listen(port);
FROM tomcat:8.0
COPY context.xml $CATALINA_HOME/conf/context.xml
# Add MedRec WAR
ADD target/medrec-*.war $CATALINA_HOME/webapps/medrec.war
EXPOSE 8080
Option 2: HTTP export by Docker
39. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
40. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âMaximize robustness
with fast startup and
graceful shutdownâ
41. Container Orchestration
⢠Horizonal scaling
⢠Service discovery and load balancing
⢠Automated Rollouts and Rollback
⢠Secret and Configuration Management
⢠Self-healing
42. Kubernetes
Kubernetes Concepts
⢠Pods
⢠Labels and Selectors
⢠Controllers
⢠Service
High level abstractions to
support robust deployments
for example:
⢠Blue / Green
⢠Rolling Updates
44. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
Quick to scale up
Seconds per container
Resilient to failure
Killed processes restarted
Graceful to shutdown
Seconds per container
45. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âKeep development,
staging, and production as
similar as possibleâ
46. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âTreat logs as event
streamsâ
47. MedRec Twelve-Factor Assessment
i. Codebase
ii. Dependencies
iii. Config
iv. Backing Services
v. Build, release, run
vi. Processes
vii. Port binding
viii. Concurrency
ix. Disposability
x. Dev/prod parity
xi. Logs
xii. Admin processes
âRun admin/management
tasks as one-off
processesâ
48. What we have shown
⢠Introduce MedRec use case and example monolith
⢠Containerise our monolith in place
⢠Create a CI/CD pipeline for our monolith as a foundation for the
future move to Microservices
⢠Introduce API-first microservices for Physicians and Patients to move
away from our monolithic architecture
⢠A look at Container Orchestration
⢠Health wearables demo
49. Leading Innovation through Microservices
Remote Patient Monitoring System
levering Oracle Cloud and MedRec
APIs:
1. Remotely manage a personâs health
and well being (e.g. blood pressure
and oxygen level)
2. Integrate devices and raise an alert
on an anomalous reading
3. Connect patients with pharmacists
and medical practitioners
4. Prescriptions and appointments
management.
Role Background/Job Function Important Needs
Patient
(Bruce Wayne)
Works under stressful circumstances
Has a family history of heart related
disorders
Suffers from Hypertension
(High Blood Pressure)
Wishes to be proactive consulted
and advised from his health
practitioner and pharmacist when
there is a problem.
Pharmacist
(Jenny
Andrews)
Prepares and controls medications by
monitoring blood pressure and advising
interventions
Automatically detects and manages
information when any of her
community patients have a critical
blood pressure reading and
proactive action.
Physician
(Lisa Brown)
Diagnosis, monitoring and treatment of
patients
Analyses patients well being records
over a period of time so that she can
detect patterns, anomalies and
exceptions.
Health
Departments
General Well being of the demography.
Provide and Plan emergency medical aid
to people who have a sudden stroke or
heart attack.
Analytics and correlation of blood
pressure to geographic region,
weather conditions ortime of year
50. MedRec Microservices (APICS)
Container
Node.js + MongoDB
Container
SpringBean+ MySQL
Container
Java + Hibernate
Remote
Patient
BLOOD PRESSURE MEASUREMENT
Container
Node.js
Observations
Alerts
Engage a Physician
IOT CS
REALTIME
EXPLORATIONiHealthDevice
IOT CS
proximityBeacons
WellBeingStream
ProximityStream
Remove Duplicate
Reading
Detect Missing
Reading
AnomalyAlert ProximityBreachAlertCriticalHealthAlert
IOT CS
Real Time Stream
PCS
Remote Patient Health Monitoring using Microservices, Containers and Oracle PaaS
52. Closing remarks
⢠You can put a monolithic application in a container
⢠âŚbut make sure the benefit outweighs the effort
⢠Pick you container use cases sensibly. Microservices is a good use case.
⢠There is no place for Microservices without Continuous Delivery
⢠Agile teams + API-driven microservices. Winning formula!
DevOps or
53. https://rubiconred.github.io/oracle-code
⢠The presentation
⢠The code
⢠MedRec Monolithic Application:
WebLogic application on Docker
⢠Physicians Microservice: Simple
NodeJS API on Docker
⢠Patients Microservice: Simple Java
API example with Liquibase on
Docker
Make your Microservices Sing! The important role of Containers and DevOps
15:05
 - 15:50
 | Doltone House - Parkview 3-4
One of the inherent values in microservices is speed to deliver new functionality. Agile teams can release new versions independently, therefore release automation/continuous delivery, âDevOpsâ, is critical for microservices development. Containers play a key role in enabling DevOps for microservices, providing a self-contained deployment unit. Most microservices apps run in a distributed environment/cluster. Popular container orchestrators, Kubernetes/Docker Swarm or managed container services like Oracle Container Cloud handle failover, rolling upgrades, and dependency management. This session highlights the role of Containers and DevOps in microservices development using the MedRec sandbox to share reference architectures and patterns.
This is not a talk where I am going to talk about âMicroservice Architectureâ and âDevOps and Continuous Delivery Principalsâ in an abstract way. There is plenty of great sessions and books out there about this tings. In the session we are going to transform these things into something real.
Talk about Monolithic
Benefit of Containers + DevOps
Can only get so far. Step up our game and break into initially 2 microservices with the intenion of splitting it out further. Then going to bring Arun to the stage who built something using my microservices
Reflect on earlier stages of my career
Shift from Release in Large batches rarely to Release in Small batches often
Move from horizonal to vertical teams
DevOps mindset has lead to less waste
There would be no container if we didnât first have on-demand virtualisation
People were doing similar things to microservices over 10 years ago with SOA but I think what is different now is just how efficient we have got at doing SOA â that is what microservices is⌠we realised itâs better to have small teams doing one thing well that can deliver without having too much consideration for the broader service oriented architecture
Letâs get into our working example
TODO: Create a new simpler diagram to put hereâŚ. The above is just copied and pasted from some blog somewhere
Yes, itâs a fictious app so itâs canât be a as a good as real ball of mud.
The worst ball of mud software architectures are holding together somehow â no one knows why â no one wants to touch them â no one wantâs change themâŚ
5 years ago Heroku publish a Manifesto called the â12 factor appâ
Collection of principals and best practices that lead to more
Scalable, Maintainable and Portable applications
Version controlled database change sets
Apply incremental database changes on app boot
Generate changes sets from a developer database
Automated rollback management
Refactor your database becomes simple
Before we go too crazy building microservices
We just want to make sure we have a fast feedback process
Creating a basis for delivering a release pipeline with MedRec
TODO: Add screenshot of the pipeline
Demo: Github open + create new application
Like plugging in a powerpoint not like negotiating a complex diplomatic agreement
âwebâ will be a backing service for something else
Research: Use depends_on?
depends_on vs links
Thatâs the first 5 factors
Hacked our existing monolith to work with Continuous Delivery model and to be running in a container
TODO: Add github linkâŚ.
Difficult to ship features to the Physicians without having to disrupt the Patients user base and vice versa
The teams are under pressure to increase the value of their offering through the interoperability of health wearables and the establishment of Public APIs