Dockerizing CS50: From Cluster to Cloud to Appliance to Container by David Malan and David...

50

Transcript of Dockerizing CS50: From Cluster to Cloud to Appliance to Container by David Malan and David...

Dockerizing CS50From Cluster to Cloud to Appliance to Container

David J. Malan [email protected]

Dan Armendariz [email protected]

• CS50 • 800 students at Harvard College • 350 students at Yale College • 300 students at Harvard Extension

• CS50 for MBAs • 90 students at Harvard Business School

• CS50x • 700,000 registrants • Kansas City, Miami, Rhode Island, St. Louis, ... • Bolivia, Chile, Netherlands, Ukraine, ...

• CS50 AP • 40 high schools • 1,500 students

• CS50 • 800 students at Harvard College • 350 students at Yale College • 300 students at Harvard Extension

• CS50 for MBAs • 90 students at Harvard Business School

• CS50x • 700,000 registrants • Kansas City, Miami, Rhode Island, St. Louis, ... • Bolivia, Chile, Netherlands, Ukraine, ...

• CS50 AP • 40 high schools • 1,500 students

• CS50 • 800 students at Harvard College • 350 students at Yale College • 300 students at Harvard Extension

• CS50 for MBAs • 90 students at Harvard Business School

• CS50x • 700,000 registrants • Kansas City, Miami, Rhode Island, St. Louis, ... • Bolivia, Chile, Netherlands, Ukraine, ...

• CS50 AP • 40 high schools • 1,500 students

• CS50 • 800 students at Harvard College • 350 students at Yale College • 300 students at Harvard Extension

• CS50 for MBAs • 90 students at Harvard Business School

• CS50x • 700,000 registrants • Kansas City, Miami, Rhode Island, St. Louis, ... • Bolivia, Chile, Netherlands, Ukraine, ...

• CS50 AP • 40 high schools • 1,500 students

on-campus cluster1989 – 2007

+ managed by university

+ familiar to students

– no root access

–  outdated software

– no support after hours

off-campus cloud2008

+ root access + examine students' code in situ + no need for space, power, or cooling + more reliable + more scalable + topical for class

– time-consuming to administer –  difficult (at the time) to configure – unfamiliar to students –  latency

on-campus cloud2009 – 2010

+ root access + examine students' code in situ + lower latency

– time-consuming to administer – need for space, power, or cooling –  less scalable – less reliable

client-side appliance2011 – 2014

Fedora Linux, Xfce

Kickstart

Boxgrinder

yum

VirtualBox

Xubuntu

apt-get

VMware Fusion, VMware Workstation

+ more familiar environment + graphical tools + distributed load + Apache, MySQL + students could add software + anyone could engage actively

– time-consuming to prepare –  virtualization overhead –  brickable (hypervisor bugs) –  slow to boot, resume

TeamViewer

Guest Additions, VMware Tools

Dropbox

containers2015 –

development environment

production environment

students' environment

docker-machine

docker-compose

docker

cs50/phphub.docker.com/r/cs50/php

docker-compose.yml

app:...memcached:...mysql:...

docker-compose.yml

memcached:container_name:memcachedimage:memcached

docker-compose.yml

mysql:container_name:mysqlimage:mysqlenvironment:MYSQL_DATABASE:appMYSQL_ROOT_PASSWORD:12345

docker-compose.ymlapp:build:.container_name:appenvironment:CACHE_HOST:memcachedCACHE_PORT:11211DB_HOST:mysqlDB_NAME:appDB_PASS:12345DB_USER:rootlinks:-memcached-mysqlports:-"80:80"volumes:-.:/srv/www

Makefiledefault:up

pull: dockerlogin dockerpullcs50/app

build: docker-composebuild

rebuild: docker-composebuild--no-cache

up:build docker-composeup

bash: dockerexec-itappbash

cs50/clihub.docker.com/r/cs50/cli

$dockerrun-i--rm-v"$(pwd)":/root-tcs50/cli ThisisCS50CLI.#

development environment

production environment

students' environment

GitHub

Codeship

Amazon Elastic Beanstalk

CACHE_HOST

CACHE_PORT

DB_HOST

DB_NAME

DB_PASS

DB_USER

development environment

production environment

students' environment

c9.io/new

cs50/ide50-offlinehub.docker.com/r/cs50/ide50-offline

D O C K E R I N S TA N C E2. communicate with instance

C D N

1. load GUI and plugins

O N L I N E

D O C K E R I N S TA N C E

2. communicate with instance1. load GUI and plugins

O F F L I N E

DockerfileFROMide50

#installCS50pluginsADD./files/harvard.cs50.catplugins/c9.ide.cs50.cat[..]

#Populateoffline-specificenvironmentvariablesRUNecho"exportUSER=ubuntu\n\exportC9_PROJECT=ide50-offline\n\exportC9_USER=jharvard\n\exportC9_HOSTNAME=\$OFFLINE_IP\n\exportC9_PORT=\$OFFLINE_PORT\n\exportIDE_OFFLINE=1”>/etc/profile.d/offline.sh

#installCloud9SDKRUNgitclonehttps://github.com/c9/core.gitc9sdk

CS50 Sandbox

CS50 Sandbox

CS50 Run

HTTP API

CS50 Check

version 1Fedora Linux SELinux node.js strace pam_limits nice iptaples ...

version 2Docker Ubuntu Linux node.js strace pam_limits nice iptaples ...

what's next

Docker Cloud

Docker for Mac, Windows

Kitematic

Ubuntu 16.04

...

recommendations

+ large courses

+ OpenCourseWare

+ web programming– cutting bleeding edge

Dockerizing CS50From Cluster to Cloud to Appliance to Container

David J. Malan [email protected]

Dan Armendariz [email protected]