Slide 1

Slide 1 text

Sudoku Solver Codelab On Google App Engine Managed VMs

Slide 2

Slide 2 text

Ludovic Champenois Guillaume Binet Éamonn McManus Mandy White Martin Gorner Alexis Moussine Pouchkine

Slide 3

Slide 3 text

Google App Engine Python, Java, PHP, Go, ...

Slide 4

Slide 4 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm

Slide 5

Slide 5 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm

Slide 6

Slide 6 text

IaaS Infrastructure-as-a-Service PaaS Platform-as-a-Service SaaS Software-as-a-Service Exploring the Cloud

Slide 7

Slide 7 text

Storage Cloud Storage Cloud SQL Cloud Datastore Compute Compute Engine App Engine App Services BigQuery Cloud Endpoints Google Cloud Platform Container Engine

Slide 8

Slide 8 text

Simple to Scale - Autoscale Easy to develop - Free to start - Build and test locally - Focus on App Code Google App Engine Trivial to manage - Fully managed - No patches/updates - 24x7 operation by Google SREs

Slide 9

Slide 9 text

build and deploy vm images • Curated runtimes • Rich services • Auto-everything • … just add code ● Managed collections ● Declarative + Dynamic Reimagining Compute Compute as a Continuum Platform Cluster • Basic atom • Run anything VM Manage less, get more Fewer constraints build and deploy containers build and deploy apps

Slide 10

Slide 10 text

The Continuum of Computing Managed VMs IaaS Infrastructure-as-a-Service PaaS Platform-as-a-Service Virtualized hardware Abstracted computing power

Slide 11

Slide 11 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm

Slide 12

Slide 12 text

Hello World Check and decompress the devkit from the USB key: $ cp /usb_mount_point/appengine-offline-devkit-v3.zip* ˜ # Check with the "mount" command where it is mounted # The copy will take a while $ cd $ shasum -c appengine-offline-devkit-v4.zip.sha1 $ unzip appengine-offline-devkit-v4.zip [Win] Copy the file into your home directory and unzip it in place. $ cd appengine-offline-devkit Follow the README there and specific steps for your platform. $ boot2docker up

Slide 13

Slide 13 text

Hello World Clone the codelab repo in a working directory with: $ git clone https://github.com/GoogleCloudPlatform/appengine-java-vm-sudoku-sample.git $ cd appengine-java-vm-sudoku-sample Ask to be added to one of the devoxx2014-[1-25].appspot.com projects. login using gcloud with: gcloud auth login Set your application ID with: $ gcloud config set project devoxx2014-XX

Slide 14

Slide 14 text

Hello World Checkout the helloworld branch with: $ git checkout helloworld Check README.md to copy paste the commands. 1. Run the app locally Dig out the logs with: $ boot2docker ssh $ cd /var/log/app_engine/sd-solver-java/default/1/0/ $ ls -la 2. Deploy the app

Slide 15

Slide 15 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm

Slide 16

Slide 16 text

Sudoku V1 $ git checkout textbased Your mission: 1. Pass the content of the file to the solver and return it directly as a flat string representation of 81 chrs : “000002034…” with 0 = empty spots to solve. 2. Store the solution in the Datastore and return it from the Datastore if it already exists. 3. Use Objectify to cache the result before trying the Datastore and otherwise solve it if it is the first time we have seen this puzzle.

Slide 17

Slide 17 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm

Slide 18

Slide 18 text

Introduction to Docker > docker images > docker run -i -t busybox /bin/sh # touch tmp/hello ← within the container > $(boot2docker shellinit) ← from another terminal > docker ps # exit ← this exits the container

Slide 19

Slide 19 text

Introduction to Docker $ docker ps -a | head $ docker logs e80719744b02 $ docker commit e80719744b02 busybox/touched $ docker images | grep busybox/touched Those steps can be "programmed" in a kind of Makefile : Dockerfile $ git checkout docker $ cat opencv_build/Dockerfile

Slide 20

Slide 20 text

GCE instance Introduction to Docker Dev machine boot2docker virtual machine (VirtualBox) gcloud preview app run Docker daemon Docker client boot2docker docker container (module) docker container (module) docker container (module) docker registry Private docker registry docker push docker pull APIs Emulated APIs Proxy / LB Proxy

Slide 21

Slide 21 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm

Slide 22

Slide 22 text

Sudoku V2 with a Custom Runtime $ docker inspect google/appengine-java [...] "Entrypoint": [ "/home/vmagent/jetty_run.sh" ], ← what we run [...] "ExposedPorts": { "8080/tcp": {} }, ← what we expose $ git checkout docker $ cat src/main/webapp/Dockerfile Your mission : - Fix the Dockerfile to make the native version run. - Run locally, Deploy to the Cloud. - Try your app from your mobile phone.

Slide 23

Slide 23 text

Advanced Cloud Debugging Push your project to a github repo In the Admin Console https://console.developers.google.com - See the Source Code/ Browse Menu - Register your git repo - Navigate to a Java Class. Click the “eye”-like button - Set a Watch Point - Make your application hit this code path More info at https://cloud.google.com/tools/cloud-debugger

Slide 24

Slide 24 text

Hello World Sudoku V1 Introduction to docker Sudoku V2 with a Custom Runtime 2:30 pm 2:45 pm 3:30 pm 4:00 pm Introduction 2:00 pm Congrats! Done...

Slide 25

Slide 25 text

App Engine Managed VMs https://cloud.google.com/free-trial/index Free trial for 60 days… (new users only)