Jun 21, 2016 - GitHub. Codeship. Amazon Elastic Beanstalk ... DOCKER INSTANCE. 2. communicate with instance. CDN. 1. loa
Dockerizing CS50 From 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 cluster 1989 – 2007
+ managed by university + familiar to students
– no root access – outdated software – no support after hours
off-campus cloud 2008
+ + + + + +
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 cloud 2009 – 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 appliance 2011 – 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
containers 2015 –
development environment production environment students' environment
docker-machine docker-compose docker
cs50/php hub.docker.com/r/cs50/php
docker-compose.yml
app: ... memcached: ... mysql: ...
docker-compose.yml
memcached: container_name: memcached image: memcached
docker-compose.yml
mysql: container_name: mysql image: mysql environment: MYSQL_DATABASE: app MYSQL_ROOT_PASSWORD: 12345
docker-compose.yml app: build: . container_name: app environment: CACHE_HOST: memcached CACHE_PORT: 11211 DB_HOST: mysql DB_NAME: app DB_PASS: 12345 DB_USER: root links: - memcached - mysql ports: - "80:80" volumes: - .:/srv/www
Makefile default: up pull: docker login docker pull cs50/app build: docker-compose build rebuild: docker-compose build --no-cache up: build docker-compose up bash: docker exec -it app bash
cs50/cli hub.docker.com/r/cs50/cli
$ docker run -i --rm -v "$(pwd)":/root -t cs50/cli
This is CS50 CLI.
#
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-offline hub.docker.com/r/cs50/ide50-offline
ONLINE 1. load GUI and plugins CDN
2. communicate with instance
D O C K E R I N S TA N C E
OFFLINE
D O C K E R I N S TA N C E
1. load GUI and plugins 2. communicate with instance
Dockerfile FROM ide50 # install CS50 plugins ADD ./files/harvard.cs50.cat plugins/c9.ide.cs50.cat [..] # Populate offline-specific environment variables RUN echo "export USER=ubuntu\n\ export C9_PROJECT=ide50-offline\n\ export C9_USER=jharvard\n\ export C9_HOSTNAME=\$OFFLINE_IP\n\ export C9_PORT=\$OFFLINE_PORT\n\ export IDE_OFFLINE=1” >/etc/profile.d/offline.sh # install Cloud9 SDK RUN git clone https://github.com/c9/core.git c9sdk
CS50 Sandbox
CS50 Run
CS50 Check HTTP API
CS50 Sandbox
version 1 Fedora Linux SELinux node.js strace pam_limits nice iptaples ...
version 2 Docker 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 CS50 From Cluster to Cloud to Appliance to Container
David J. Malan
[email protected] Dan Armendariz
[email protected]