@rob_rich

Create Robust Deployments for your SPA and API

by Rob Richardson

  @rob_rich

https://robrich.org/

About Me

Rob Richardson

Rob Richardson is a software craftsman building web properties in ASP.NET and Node, React and Vue. He's a frequent speaker at conferences, user groups, and community events, and a diligent teacher and student of high quality software development. You can find this and other talks on https://robrich.org/presentations and follow him on twitter at @rob_rich.

By separating the UI and the API
we get development and operational efficiency ...
... and system complexity

Docker 101

What is Docker?

Docker is an ecosystem around Container Virtualization

What are Containers?

Light-weight kernel virtualization

What is Docker?

A suite of command-line tools for creating, running, and managing containers

Containers vs VMs

vm vs container

Source: http://www.zdnet.com/article/what-is-docker-and-why-is-it-so-darn-popular/

Containers

Containers virtualize and share the host kernel

Containers must run on the kernel for which they were built:

  • Linux containers run on a Linux host
  • Windows containers run on Windows Server host

Host Docker in a VM

docker nested in a vm

Docker Ecosystem

docker ecosystem

Download: https://robrich.org/slides/welcome-to-docker/docker-ecosystem.pdf

DEMO

Scaffold and dockerize apps

End of Docker 101 talk

Docker architecture design

DEMO

1 container, 1 domain

1 container, 1 domain

Pros

  • Easily deploy whole app to single hosting account

Cons

  • Can't scale front end and back end seperately

DEMO

2 containers, 2 domains

2 containers, 2 domains

Pros

  • Scale containers separately
  • Evolve pieces separately

Cons

  • Need different urls for each environment
  • Developer settings may differ
  • Rebuild images to inject new setting
  • CORS headers are surprisingly hard

DEMO

2 containers, 1 domain

2 containers, 1 domain

Pros

  • Scale containers separately
  • No hard-coded urls
  • No CORS headers

Cons

  • Need kubernetes or other proxy
  • Entire backend must be on one subdomain or proxied to other services

Server-rendered SPA

Pros

  • Great for performance
  • Great for SEO: full html delivered to browser

Cons

  • Best with a Node.js (JavaScript) back-end
  • Generally doesn't use SPA's CLI

Which solution is the best?

It depends