cloud service and gae for java(gae:j)

40
Cloud Service and GAE for Java(GAE/J) Speaker: Roy Chen

Upload: roy-chen

Post on 16-Apr-2017

70 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: Cloud service and gae for java(gae:j)

Cloud Service andGAE for Java(GAE/J)

Speaker: Roy Chen

Page 2: Cloud service and gae for java(gae:j)

outline

• 1. What’s Cloud Service?• 2. PaaS features (GAE)• 3. IaaS features (EC2)• 4. Comparison: PaaS and IaaS• 5. implement and deme a tiny Project

( 目標 : • gae/j 開發環境設置• 、基本 jave web(servlet, jsp)• 、將專案 deploy 到 google gae)

Page 3: Cloud service and gae for java(gae:j)

•What’s Cloud Service?

Page 4: Cloud service and gae for java(gae:j)

Cloud Service

Because a lot of demand for cloud computing, and technologies of cloud is getting better, many companies have released some services that basic on Cloud, we called it “Cloud Service”.

• Web service (Amazon EC2, GAE…)• Storage (Amazon s3, hicloud s3, Google Cloud

Storage…)• Music, movie (itunes)

Page 5: Cloud service and gae for java(gae:j)

3-layer in Cloud ServiceWeb browser, mobile app…

SaaS (Software as a Service)

PaaS (Platform as a Service)

IaaS (Infrastructure as a Service)

Page 6: Cloud service and gae for java(gae:j)

•PaaS features (GAE)

Page 7: Cloud service and gae for java(gae:j)

Explore features!PaaS - GAE

1. Api 2. Auth3. Monitoring – Logs4. Storage5. …

Page 8: Cloud service and gae for java(gae:j)

1. Support some useful APIs

Based on PaaS, GAE support many useful APIsFor developers

Such as mail, map, youtube, and most powerful is auth!

Page 9: Cloud service and gae for java(gae:j)

2. OAuth2.0Think about this Scenario:

Your app(third party) wants to access user’s photo

placed in Google Storage,

The safest way is by Oauth, but how the Oauth do it?

If you Use a non-OAuth app…

WHAT CONSEQUENCES YOU WILL ENCOUNTER???

Page 10: Cloud service and gae for java(gae:j)

3. Monitoring – Logs

You don’t need to implement a log record system, GAE provides you a log control panel which has a pretty UI, and useful filter.

Page 11: Cloud service and gae for java(gae:j)

4. Storage

Store and manage data using a fully-managed, relational MySQL database

Cloud Datastore provides a managed, NoSQL, schemaless database for storing non-relational data.

provides developers and IT teams with secure, durable, highly-scalable object storage. with a simple web services interface to store and retrieve any amount of data from anywhere on the web.

Page 12: Cloud service and gae for java(gae:j)

Common Architecture

HTTP GET

Page 13: Cloud service and gae for java(gae:j)

IaaS example – Amazon EC2

Page 14: Cloud service and gae for java(gae:j)

IaaS example – Amazon EC2

Page 15: Cloud service and gae for java(gae:j)

Instagram

Page 16: Cloud service and gae for java(gae:j)

Comparison: PaaS and IaaSPaaS

IaaS

Google App Engine (GAE)

Microsoft Azure

Amazon EC2

Good Part of PaaS: machine and software configurations has been set, moreover, the vendor may provide many good api for you.

Bad Part: you need to allow the vender’s rules of environments settings, programming languages, db. And PaaS project has bad portability and hard to rework.

Page 17: Cloud service and gae for java(gae:j)

Good stuff… GCEI prefer to use IaaS

production, but I hate AWS, I want to use Google

production!

Let me show you

something good!

Page 18: Cloud service and gae for java(gae:j)
Page 19: Cloud service and gae for java(gae:j)

Project: 真男人簡介 :從前端的 radio button 選一個你想要的男人, 按下送出,你選的人名會送到後端 servlet ,經過篩選之後,會將頁面導到該男人的頁面。( 將前端資料 post 到 servlet , servlet 計算之後得到新的結果,在把新的結果由 servlet 傳回 jsp ,並使用 jsp tag 取得資料 )

Page 20: Cloud service and gae for java(gae:j)

2 ways to set ur dev environment

• 1. use MAVEN• 2. use eclipse

Page 21: Cloud service and gae for java(gae:j)

The Google App Engine SDK and Maven

• When you use Maven, you don't need to download the Google App Engine SDK. Maven does that for you. You'll also use Maven to test your app locally and upload (deploy) it to production App Engine.

Page 22: Cloud service and gae for java(gae:j)

Getting Eclipse

Page 23: Cloud service and gae for java(gae:j)

Installing the Google Plugin for Eclipse

Page 24: Cloud service and gae for java(gae:j)

環境設置完成

Page 25: Cloud service and gae for java(gae:j)

Creating a project

Click Web Application Project

Page 26: Cloud service and gae for java(gae:j)
Page 27: Cloud service and gae for java(gae:j)

測試一下

Page 28: Cloud service and gae for java(gae:j)

成功

Page 29: Cloud service and gae for java(gae:j)

新增 html

Page 30: Cloud service and gae for java(gae:j)

設定 router

Page 31: Cloud service and gae for java(gae:j)

Front-end

Page 32: Cloud service and gae for java(gae:j)

在主 servlet 產生一個 doPost 方法

Page 33: Cloud service and gae for java(gae:j)
Page 34: Cloud service and gae for java(gae:j)

把預設的 servlet 改成這樣

Page 35: Cloud service and gae for java(gae:j)

需要一個 jsp 去接 servlet 丟過來的東西

Page 36: Cloud service and gae for java(gae:j)

Apply gae service

• 接下來要上傳到 GAE SERVER ,但在這之前你需要去 google 開發者網站一下。• https://console.developers.google.com/projec

t• 直接使用您原本的 gmail 帳號即可,將 gae的服務打開。

Page 37: Cloud service and gae for java(gae:j)

Projectid 將會是你 domain name其中一部分

Page 38: Cloud service and gae for java(gae:j)
Page 39: Cloud service and gae for java(gae:j)

• 去 appengine-web.xml• 把 application tag 中間加上你的 id• <application>oh20141030</application>

Page 40: Cloud service and gae for java(gae:j)

Finally…

http://oh20141030.appspot.com/