von javaee auf microservice in 6 monaten - the good, the bad, and the wtfs

68
Von JavaEE auf Microservice in 6 Monaten The Good, the Bad, and the wtfs... André Goliath

Upload: andre-goliath

Post on 11-Apr-2017

465 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Von JavaEE auf

Microservice in 6 MonatenThe Good, the Bad, and the wtfs...

André Goliath

Page 2: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

ENTERPRISE IT

Page 3: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 4: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

MY VISION(AND MY KEY HOLDER, TOO)

Page 5: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 6: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

SO, HOW TO GET THERE?

Page 7: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

WHEN

WHY

WITH WHOM

TO WHAT EXTENT

SO, HOW TO GET THERE?

Page 8: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

WHEN

WHY

WITH WHOM

TO WHAT EXTENT

SO, HOW TO GET THERE?

Page 9: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Now!

Page 10: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 11: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

„Digitization“

Cloud Computing Internet of Things

Virtual Reality

Microservices

$anything as a Service

fastIndustry 4.0

Web 2.0

Social Media

Big Data

Privacy & Security

Page 12: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

„Digitization“

Cloud Computing Internet of Things

Virtual Reality

Microservices

$anything as a Service

Industry 4.0

Web 2.0

Social Media

Big Data

Privacy & Security

yeah, let´s

do this!

fast

Page 13: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

WHEN

WHY

WITH WHOM

TO WHAT EXTENT

SO, HOW TO GET THERE?

Page 14: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Because we can!

Page 15: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Because we need to!

How long does it take from idea to production?

How long does it need to take from idea to production?

What is the cost of implementing an one-liner feature?

What should the cost be?

Page 16: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Because we need to!

How long does it take from idea to production?

How long does it need to take from idea to production?

What is the cost of implementing an one-liner feature?

What should the cost be?

6 months

Cost to develop x 5

and then some…

Page 17: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

6 Monoliths.600 Services. 15 Clients. 25 Backends.

Featuring code from 1995 till today.(Anyone remember J2EE1.2 ?)

Page 18: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Don´t get me wrong.

Monoliths are not bad.(at least not all of them)

Page 19: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

WHEN

WHY

WITH WHOM

TO WHAT EXTENT

SO, HOW TO GET THERE?

Page 20: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How to code?

How to deploy?

How to use?

SO, HOW TO GET THERE?

Page 21: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How to code?

How to deploy?

How to use?

SO, HOW TO GET THERE?

Page 22: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Spring Boot

Page 23: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

But be careful!

Page 24: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How to catch a 404 error

and wrap it in your own JSON response?

Page 25: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How to catch a 404 error

and wrap it in your own JSON response?It took us about 30 work hours to figure this one out.

And it involves manipulating the embedded Tomcat.

Without a specific Spring Boot API for that feature.

Page 26: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Coding 1 Microservice? Easy.

Coding 100 Microservices? Not so easy.

How do we organize our configuration?

Do we want to share code?

Do we want to force all microservices to use the same Spring Boot version?

Do we allow communication between services?

What aspects do we NEED to be the same for all services?

HATOEAS? Service Boundaries?

Page 27: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Share framework code, nothing else.

Page 28: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Share framework code, nothing else.

If you have no regrets

about sharing your code

on github, it is probably

framework code

Page 29: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Share framework code, nothing else.

Filter (Security, Authentication, Logging, Monitoring)

Error Handling

Profile / Envíronment Configuration

Logging Configuration

Common Documentation

If you have no regrets

about sharing your code

on github, it is probably

framework code

Page 30: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How about communication?

Page 31: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Customer Search Card Management Account Management

„Backend“ Microservices

Mobile App Online Banking Branch

„Gateway“ Microservices

Mobile App Online Banking Branch

Actual Frontends

Page 32: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Customer Search Card Management Account Management

„Backend“ Microservices

Data

Tailoring

Mobile App Online Banking Branch

„Gateway“ Microservices

Mobile App Online Banking Branch

Actual Frontends

HATEOAS

Links

Service

Orchestration

Clientspecific

Security

Page 33: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Spring Cloud„Production-Ready“ Features…

… but only in an ideal world.

Page 34: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Spring CloudActuator endpoints

Good for quick debugging, but how to integrate them in an enterprise monitoring world?

Configserver

You better play by the rules. Don´t use a – in your service name!

Routing Stuff (Eureka, Zuul, Ribbon)

Works. But only if you commit to doing routing the Netflix-way.

Page 35: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How to code?

How to deploy?

How to use?

SO, HOW TO GET THERE?

Page 36: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Automation!Tests

Builds

Provisioning

Deployments

Page 37: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Automation! But…

Strict Hardware and OS Restrictions

No direct communication between development and production environments

No SSH connections to production

„I don´t trust those tools“ (senior dev.)

You want to put something into production?

Fine, here complete these forms,

and have them signed by 10 people,

who have never heard of you,

and have no clue what you are doing.

Page 38: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

The most important rule

Use the same deployment toolchain

for development, UATs, and production!

Page 39: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

So here is what we did.

Page 40: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Step 1: Prepare everything for coding

Page 41: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Code Repo

Developer

Jenkins

Deploy

Scripts

Ansibleansible-playbook create.yml

Page 42: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 43: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Step 2: Code and Test

Page 44: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Code Repo

Developer

Jenkins

Deploy

Scripts

git push origin f-newStuff

git

post-push

hook

ssh

scp

Development / Test Environment

Service

Host A

Service

Host B

Config

Server

Apache

mod_proxy

Page 45: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Step 3: Deploy to Production

Page 46: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Code Repo

Developer

Deploy

Scripts

POTS:

„Please deploy v1, I‘ll mail you the paperwork“

ftp

ssh

Development / Test Environment

Service

Host A

Service

Host B

Config

Server

Apache

mod_proxy

Ops Guy

Production Environment

Gateway

Service

Host B

Config

Server

Apache

mod_proxy

some proprietary protocols…

Service

Host A

Page 47: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Why no Docker?

Page 48: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Why no Docker?Getting into Docker is easy. Even at a later stage.

Getting back from Docker to something else is a hell of a ride.

Page 49: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

How to code?

How to deploy?

How to use?

SO, HOW TO GET THERE?

Page 50: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Working software

over comprehensive documentation

- agilemanifesto.org -

Page 51: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Test-Driven Documentationusing spring-restdocs

Page 52: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 53: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 54: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 55: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Swagger UI

Page 56: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs
Page 57: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

WHEN

WHY

WITH WHOM

TO WHAT EXTENT

SO, HOW TO GET THERE?

Page 58: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

You must overcome Conway‘s Law

Page 59: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Vertical TeamsJust get used to it.

Page 60: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Customer Search Card Management Account Management

„Backend“ Microservices

Mobile App Online Banking Branch

„Gateway“ Microservices

Mobile App Online Banking Branch

Actual Frontends

All developed in

one team!?!

Page 61: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

WHEN

WHY

WITH WHOM

TO WHAT EXTENT

SO, HOW TO GET THERE?

Page 62: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

There is no need for a big bang

Page 63: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

We started with 1 service and 1 client

Page 64: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

There are viable migration pathseven for legacy code

Page 65: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Bottom Line?

Page 66: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

It works. Even in enterprises.

Page 67: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

One step at a time,

and you´ll be fine.

Page 68: Von JavaEE auf Microservice in 6 Monaten - The Good, the Bad, and the wtfs

Thank You!

André Goliath

Senior Technical Consultant

[email protected]