Gae managed vm introduction

Preview:

Citation preview

Introduction

Managed VMs

Cage Chung / GCPUG.TW

https://www.facebook.com/groups/GCPUG.TW/

https://plus.google.com/u/0/communities/116100913832589966421

[您知道”GCPUG”要怎麼唸嗎?為什麼會有一隻狗在 Logo裡面呢? ]

Google Cloud Platform User Group的縮寫是GCPUGGCPUG直接唸成G.C.P.U.G?當然可以!

但它也可以分開來,唸成 G.C. PUG喔~

Pug,指的是巴哥犬,所以 GCPUG的Logo中間才會有一隻可愛的巴哥犬喲。

下次聽到別人說G.C. PUG 的時候,您就可以大聲說:「我也是G.C. PUG社團成員!」

Google App Engine overview

Cloud ComputingGoogle Cloud Platform | Compute

PaasIaaS

ApplicationDataRuntimeMiddlewareOSVirtualizationServersStorageNetworking

ApplicationDataRuntimeMiddlewareOSVirtualizationServersStorageNetworking

Saas

ApplicationDataRuntimeMiddlewareOSVirtualizationServersStorageNetworking

Infrastructure as a Service Platform as a Service Service as a Service

You manage Google manage

GAE ArchitectureApp Engine | overview

● Storage

○ Cloud Storage

○ Cloud SQL

○ Cloud Datastore

● Memcache

● Task Queue

● Cloud Endpoints

App Engine APIsApp Engine | overview

Find more https://cloud.google.com/appengine/

Google App Engine: Platform as a ServiceApp Engine | Standard runtime

Python Java Php Go

Dockeroverview

What’s Docker?Docker | overview

[什麼是 Docker | 《Docker —— 從入門到實踐 》正體中文版](http://philipzheng.gitbooks.io/docker_practice/content/introduction/what.html)

Why Docker?docker | overview

Change Management

Resource Isolation

File system Isolation

Network Isolation

Image Management

Sharing ProcessManagement

[Docker Internals - Google Slides](https://goo.gl/a6Y773)

Image

Container

Registry

Basic ConceptDocker | overview

Managed VMsIntroduction

Managed VMs

App Engine

Beta

Hosting environmentManaged VMs

Standard Runtime vs. Custom RuntimeManaged VMs

Managed VMsComputing

● Extension of App Engine● Use Docker to run containers● Can Use

○ Google configured containers○ Custom containers

Dockerfile

app.yaml

$ gcloud preview app run

$ gcloud preview app deploy

gcloud SDK

Docker registry

container

dockerd

VM*

* A VM running docker

Dockerfile

FROM google/appengine-python27

# Install pandas

RUN apt-get update && apt-get install -y -q --no-install-

recommends python-pandas python-numpy

# Install Google Map APIs, Google Client Library

ADD requirements.txt /app/

RUN pip install --upgrade pip

RUN pip install -r requirements.txt

ADD . /app

Create the App Engine

[Managed VMs - App Engine — Google Cloud Platform](https://goo.gl/4FFSmm)

application: waldo-gcp

module: optimal-waypoints

version: 1

runtime: python27

api_version: 1

threadsafe: yes

vm: true

automatic_scaling:

min_num_instances: 1

max_num_instances: 5

cool_down_period_sec: 60

cpu_utilization:

target_utilization: 0.5

Create the App Engine | app.yaml

application: waldo-gcp

module: screenshot

version: 1

runtime: custome

api_version: 1

threadsafe: yes

vm: true

resources:

cpu: .5

memory_gb: 1.3

manual_scaling:

instances: 1

Standard runtime Custom runtime

Behind the scenes

gcloud deploy

gcloud build

Your awesome docker images

your laptop

Google App Engine

Your awesome docker images

docker container

private Google Cloud Storage

bucket

update start Google Compute Engine Instance

usinggoogle/docker-registry

container

docker run

usinggoogle/docker-registry

container

docker push

docker pull

App Engine for Docker

Simple to manage

Private Registry bucket

APIs and SDK

Loadbalancing

Autoscaling

Use any library

Run any code

Transparency

New runtimes, build your own

Docker for App Engine

Demo

https://github.com/cage1016/managed-vms-lab

Managed VMs | architecture

App EngineSandbox

App Engine

Managed VMs

...

Python Go

default module

Managed VMs module

or

custom runtimes

dispatch.yaml

dispatch: - url: "*/favicon.ico" module: default

- url: "qnap-gcp-lab-003.appspot.com/" module: default

- url: "*/module1/*" module: module1

- url: "*/*" module: "default"

Demo Application | architecture

Application hierarchy

[App Engine Modules in Python](https://goo.gl/p3nl48)[App Engine Modules in Go](https://goo.gl/KpdKpF)

dispatch.yamlGolang

https://qnap-gcp-lab-003.appspot.com (default)

https://1-dot-module1-dot-qnap-gcp-lab-003.appspot.com (module 1) Managed VMs

https://qnap-gcp-lab-003.appspot.com/module1/ (module1) Managed VMs

https://qnap-gcp-lab-003.appspot.com/module1/sayhi (module1 sayhi) Managed VMs

Python

https://qnap-gcp-lab-002.appspot.com/ (default)

https://module1-dot-qnap-gcp-lab-002.appspot.com/ (module1) Managed VMs

https://qnap-gcp-lab-002.appspot.com/module1/ (module1) Managed VMs

https://qnap-gcp-lab-002.appspot.com/module1/income_file (module income_file) Managed VMs

Demo Application | dispatch

[Routing Requests to Modules - Go — Google Cloud Platform](https://goo.gl/CaYpFD)[Routing Requests to Modules - Python — Google Cloud Platform](https://goo.gl/7P5Qfg)

Google App Engine

overview

Thankshttp://gcpug.tw

Q&A