Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Google Managed VMs Sudoku Lab

Google Managed VMs Sudoku Lab

Basic App engine tutorial, Docker introduction and Managed VMs tutorial.

GoogleCloudPlatform

November 13, 2014
Tweet

More Decks by GoogleCloudPlatform

Other Decks in Programming

Transcript

  1. 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
  2. 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
  3. Storage Cloud Storage Cloud SQL Cloud Datastore Compute Compute Engine

    App Engine App Services BigQuery Cloud Endpoints Google Cloud Platform Container Engine
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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.
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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.
  18. 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
  19. 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...