Full-stack Microservices

A presentation at Devops DDay in November 2018 in Marseille, France by William Bartlett

Slide 1

Slide 1

Full-stack Microservices

William Bartlett

  • E-mail: w.bartlett@treeptik.fr
  • Twitter: @bartlettstarman
  • LinkedIn: punkstarman
  • GitHub: punkstarman

Treeptik

15 November, 2018

Slide 2

Slide 2

whoami?

William Bartlett, Level 23 programmer

  • Agile Coach, Java dev, Container enthusiast
  • Web Component nut (Polymer)
  • Former doctoral student

“Use the right tool for the job” William Bartlett (Treeptik) Full-stack Microservices 15 November, 2018 2 / 45

Slide 3

Slide 3

Introduction

Slide 4

Slide 4

Microservices

Advantages

  • separation (”divide and conquer”)
  • autonomy
  • automation
  • modularity
  • scaling
  • tech stack transitions

Slide 5

Slide 5

Microservices

Price to pay

  • complex integration
  • consistency or availability
  • hard boundaries

Slide 6

Slide 6

Microservices

Microservices are cool

Slide 7

Slide 7

Microservices

Server-side = fun Client-side = monolithic monstrosity

Slide 8

Slide 8

Microservices

Micro Frontends: https://micro-frontends.org/

Slide 9

Slide 9

Issue

Issue: How to build a large product with entirely autonomous multi-disciplinary teams?

Bring microservices to the front-end

  • Tech solution: distributed web components
  • Org solution: Atomic Design

Slide 10

Slide 10

Outline

  • It’s All Relative
  • Web Components
  • Atomic Design
  • Full-stack Microservices
  • Case Study William Bartlett (Treeptik) Full-stack Microservices 15 November, 2018 10 / 45

Slide 11

Slide 11

It’s All Relative

Slide 12

Slide 12

Micro Frontends

Micro Frontends: https://micro-frontends.org/

Slide 13

Slide 13

Project Mosaic, Zalando

  • Skipper (router), InnKeeper (router config API)
  • Tailor (layout), Quilt (layout storage)
  • Shaker (components)
  • Tessellate (SSR)

https://www.mosaic9.org/

Slide 14

Slide 14

OpenComponents, OpenTable

  • API for UI components
  • SSR or not

https://opencomponents.github.io/

Slide 15

Slide 15

Metaframework, CanopyTax

Single SPA

  • Runtime stitching of micro-frontends.

https://github.com/CanopyTax/single-spa

Example: https://single-spa.surge.sh/

Slide 16

Slide 16

Microservice Websites, Gustaf Nilsson Kotte

Microservice Websites: Scalable development of an evolvable system with great mobile performance.

  • performance

  • autonomy ⇒ heterogeneity and scalability

  • Manifesto

  • Article

  • Tools:

    • Edge-Side Includes
    • Client-Side Includes
    • Caching (Varnish)

Slide 17

Slide 17

Other options

  • JSP/ASP.Net Fragments

Slide 18

Slide 18

Other options

  • JSP/ASP.Net Fragments
  • JSP Tag Library

Slide 19

Slide 19

Other options

  • JSP/ASP.Net Fragments
  • JSP Tag Library
  • Struts Tiles

Slide 20

Slide 20

Other options

  • JSP/ASP.Net Fragments
  • JSP Tag Library
  • Struts Tiles
  • Portlets (Liferay)

Slide 21

Slide 21

Other options

  • JSP/ASP.Net Fragments
  • JSP Tag Library
  • Struts Tiles
  • Portlets (Liferay)
  • <iframe>

Slide 22

Slide 22

Web Components

Slide 23

Slide 23

Web Components

Web Components: Reusable, modular components for the web.

  • 4 W3C specifications
  • started in 2011

Slide 24

Slide 24

Demo

Find this demo on CodePen

https://codepen.io/punkstarman/project/editor/AEKqQg

Slide 25

Slide 25

Custom Elements

Browser support

Slide 26

Slide 26

It’s an HTML element

  • attributes
  • properties
  • events
  • styling

Slide 27

Slide 27

Frameworks

Frameworks:

  • Polymer, SkateJS, Slim.js, x-tag, Bosonic, Stencil, …
  • React, Angular, Vue, …

https://custom-elements-everywhere.com/

Added bonuses:

  • two-way data-binding
  • boilerplate reduction

Slide 28

Slide 28

Component libraries

https://www.webcomponents.org/

  • Polymer (iron, paper, app, gold)
  • Vaadin
  • Google (Maps, YouTube)
  • Predix UI

Slide 29

Slide 29

Web Components in the Wild

  • Google (Polymer)
    • Chrome
    • YouTube, Drive, Contacts
    • Example app: Shop (https://shop.polymer-project.org/)
  • Electronic Arts
  • GitHub
  • Simpla

Slide 30

Slide 30

Atomic Design

Slide 31

Slide 31

Atomic Design

Atomic Design: Methodology for creating and maintaining a graphic design system

Brad Frost, 2016

http://atomicdesign.bradfrost.com/

Slide 32

Slide 32

Atomic Design

  • atoms
  • molecules
  • organisms
  • templates
  • screens

Slide 33

Slide 33

Atom

  • indivisible
  • graphical identity

Slide 34

Slide 34

Molecule

  • connected atoms
  • purpose

Slide 35

Slide 35

Organism

  • composed atoms, molecules or other organisms
  • complexity

Slide 36

Slide 36

Template

  • layout of organisms
  • generic page

Slide 37

Slide 37

Page

  • template + data
  • proof of concept

Slide 38

Slide 38

Full-stack Microservices

Slide 39

Slide 39

Microservices + Web Components

  • integration over HTTP
  • lazy loading
  • fault tolerance

Slide 40

Slide 40

Web Components + Atomic Design

Atomic Design is the methodology needed to develop a system of components efficiently.

Web Components are a solution that can enable Atomic Design.

DNF: integration components (AJAX, state)

Slide 41

Slide 41

Full-stack Microservices

Slide 42

Slide 42

Full-stack Microservices

Slide 43

Slide 43

Full-stack Microservices

Slide 44

Slide 44

Full-stack Microservices

Slide 45

Slide 45

Case Study

Slide 46

Slide 46

O gods of Demo, we beseach thee

Slide 47

Slide 47

Conclusion

Slide 48

Slide 48

Conclusion

  • Autonomous teams
  • expose API and components
  • RAD
  • choice of framework

Slide 49

Slide 49

Conclusion

  • strong coupling between API and UI
  • library design > application design
  • difficult to isolate dependencies

Slide 50

Slide 50

Future Work

  • Dependency and Configuration Injection

Slide 51

Slide 51

Future Work

  • Dependency and Configuration Injection
  • Encapsulation of third party services:

Slide 52

Slide 52

Future Work

  • Dependency and Configuration Injection
  • Encapsulation of third party services:
    • Auth0, Keycloak, Okta, …

Slide 53

Slide 53

Future Work

  • Dependency and Configuration Injection
  • Encapsulation of third party services:
    • Auth0, Keycloak, Okta, …
    • Paypal

Slide 54

Slide 54

Future Work

  • Dependency and Configuration Injection
  • Encapsulation of third party services:
    • Auth0, Keycloak, Okta, …
    • Paypal
  • OAuth2 via Web Components: trust?

Slide 55

Slide 55

Future Work

  • Dependency and Configuration Injection
  • Encapsulation of third party services:
    • Auth0, Keycloak, Okta, …
    • Paypal
  • OAuth2 via Web Components: trust?
  • Logs, monitoring, instrumentation …