26
Introduction Managed VMs Cage Chung / GCPUG.TW

Gae managed vm introduction

Embed Size (px)

Citation preview

Page 1: Gae managed vm introduction

Introduction

Managed VMs

Cage Chung / GCPUG.TW

Page 2: Gae managed vm introduction

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社團成員!」

Page 3: Gae managed vm introduction

Google App Engine overview

Page 4: Gae managed vm introduction

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

Page 5: Gae managed vm introduction

GAE ArchitectureApp Engine | overview

Page 6: Gae managed vm introduction

● Storage

○ Cloud Storage

○ Cloud SQL

○ Cloud Datastore

● Memcache

● Task Queue

● Cloud Endpoints

App Engine APIsApp Engine | overview

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

Page 7: Gae managed vm introduction

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

Python Java Php Go

Page 8: Gae managed vm introduction

Dockeroverview

Page 9: Gae managed vm introduction

What’s Docker?Docker | overview

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

Page 10: Gae managed vm introduction

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)

Page 11: Gae managed vm introduction

Image

Container

Registry

Basic ConceptDocker | overview

Page 12: Gae managed vm introduction

Managed VMsIntroduction

Page 13: Gae managed vm introduction

Managed VMs

App Engine

Beta

Page 14: Gae managed vm introduction

Hosting environmentManaged VMs

Page 15: Gae managed vm introduction

Standard Runtime vs. Custom RuntimeManaged VMs

Page 16: Gae managed vm introduction

Managed VMsComputing

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

○ Google configured containers○ Custom containers

Page 17: Gae managed vm introduction

Dockerfile

app.yaml

$ gcloud preview app run

$ gcloud preview app deploy

gcloud SDK

Docker registry

container

dockerd

VM*

* A VM running docker

Page 18: Gae managed vm introduction

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)

Page 19: Gae managed vm introduction

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

Page 20: Gae managed vm introduction

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

Page 21: Gae managed vm introduction

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

Page 22: Gae managed vm introduction

Demo

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

Page 23: Gae managed vm introduction

Managed VMs | architecture

App EngineSandbox

App Engine

Managed VMs

...

Python Go

default module

Managed VMs module

or

custom runtimes

Page 24: Gae managed vm introduction

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)

Page 25: Gae managed vm introduction

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)

Page 26: Gae managed vm introduction

Google App Engine

overview

Thankshttp://gcpug.tw

Q&A