Skip to content

Latest commit

 

History

History
159 lines (109 loc) · 6.88 KB

lesson_plan.md

File metadata and controls

159 lines (109 loc) · 6.88 KB

Deployment

Class Structure

  • Welcome to Class
  • Do the warm up exercise
  • Go over Learning Objectives
  • Deliver Lesson
  • Go over Learning Objectives
  • Review the Final Project
  • Closing Questions / Tying up loose ends
  • Exit Tickets

Install Docker for Mac or Docker for Windows

-- https://docs.docker.com/docker-for-mac/install/ -- https://docs.docker.com/docker-for-windows/install/

Single Page Applications

An application delivered to the browser that doesn't reload the page during use.

We can think of a fat client that's loaded from a web server.

Architecture

Weight:

  • we started with just the client
  • we then worked our way backwards, adding a server and then a database
  • then we built full stack applications that used all three of these, but the majority of our logic lived in the middle ( in the server )
  • that's how a lot of applications work today
  • SPAs fatten up or push a lot of logic to the client here

What kind of logic might we want to push to the client?

  • views/rendering
  • simple calculations and data manipulation

Introduction to Microservices and Containers

Monolithic Applications: Single-tiered software applications in which the user interface and data access code are combined into a single program from a single platform - no modularity.

Modularity is desirable, in general, as it supports reuse of parts of the application logic and also facilitates maintenance by allowing repair or replacement of parts of the application without requiring wholesale replacement.

Microservices: Google, Amazon, Netflix etc have all moved to Microservices. Microservices are designed to encapsulate a core business capability. The architecture is a method of developing the application as a suite of independently deployable, small, modular services in which each service runs a unique process and communicates through a well-defined, lightweight mechanism to serve a business goal.

Containers: Containers and Microservices are not the same thing. Containers encapsulate discrete components of application logic provisioned only with the minimal resources needed to do their job.

They are an alternative to virtual machines, which require entire embedded operating systems.

Containers allow you to easily package an application's code, configurations, and dependencies into easy to use building blocks that deliver environmental consistency, operational efficiency, developer productivity, and version control

Containers make calls for OS resources through an API

Containerisation is OS-level virutalisation. VMs run on hypervisors, with fully embedded operating systems.

How do Microservices and Containers relate? A Microservice may run in a container, but it could as run as a fully provisioned VM. A container need not be used for a microservice.

Containers are a good way of developing and deploying microservices, and the tools and platforms for running containers are a good way to manage microservice-based applications.

Start getting familiar with Docker - 10 minutes ( students do on their own )

https://github.com/docker/labs/blob/master/beginner/chapters/setup.md

First do the setup, then proceed to 1.0 - Running your first container

Images - The file system and configuration of our application which are used to create containers.

Containers - Running instances of Docker images — containers run the actual applications. A container includes an application and all of its dependencies. It shares the kernel with other containers, and runs as an isolated process in user space on the host OS.

Docker daemon - The background service running on the host that manages building, running and distributing Docker containers.

Docker client - The command line tool that allows the user to interact with the Docker daemon.

Docker Hub - A registry of Docker images. You can think of the registry as a directory of all available Docker images. You'll be using this later in this tutorial.

Code along with containers

Flask App: Follow along (20 minutes) Starts at 2.3 https://github.com/docker/labs/blob/master/beginner/chapters/alpine.md

  • Navigate to the flask-app folder in exercises
  • Create the necessary files and add the code

Debugging Node.js: Follow along (10 minutes)

Break

Deployment - Quick Intro

Deployment - Now with Dockerfile

Deploy a docker app with Now

https://zeit.co/now#whats-now https://zeit.co/blog/now-dockerfile

-npm install -g now -mkdir -Touch Dockerfile -Touch index.html -Add some content -Add to Dockerfile:

FROM kstaken/apache2 LABEL name "my-docker-deployment" RUN apt-get update && apt-get install -y php5 libapache2-mod-php5 php5-mysql php5-cli && apt-get clean && rm -rf /var/lib/apt/lists/* COPY index.html /var/www EXPOSE 80 CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]

  • Run 'now' every time you want to deploy

Deployment - Github Pages

Github Pages - 10/15 minutes - Exercise 2

Deployment - AWS

Intro to AWS - 15 minutes

Start up our first deployment: 15 minutes

  • $ mkdir HelloWorld
  • $ cd HelloWorld
  • $ eb init -p PHP
  • $ echo "Hello World" > index.html
  • $ eb create dev-env
  • $ eb open

Deploy a more advanced application (we do): 20 minutes

Introduce MLab - 10 mins

  • Have everyone create accounts - Help them integrate it into the tunr solution
  • Remember you have to create a user every time you make a new db so you can access it in code
  • The port must match the deployment configuration - 8081 is AWS common
  • Bundle the application files and save to desktop in a compressed file

Deploy the SPA Tunr solution - we do : ~20 minutes

You Do: Deploy Todo App