20
頑坊 GCP 冒險 2015/05/28 GCPUG Taiwan Meetup - Google I/O Extend Taipei 2015

頑皮工坊 GCP 大冒險

Embed Size (px)

Citation preview

Page 1: 頑皮工坊 GCP 大冒險

頑⽪皮⼯工坊 GCP ⼤大冒險2015/05/28

GCPUG Taiwan Meetup - Google I/O Extend Taipei 2015

Page 2: 頑皮工坊 GCP 大冒險

關於我

• Ian Wu

• 瘋⼈人院院⻑⾧長

• 頑⽪皮⼯工坊 Backend Engineer

• http://blog.ianwu.tw/about-me/

Page 3: 頑皮工坊 GCP 大冒險

關於頑⽪皮⼯工坊

Page 4: 頑皮工坊 GCP 大冒險

我們⽤用到的服務• Compute Engine

• Cloud DNS

• Cloud Monitoring

• Cloud Storage

• Cloud Logging

Page 5: 頑皮工坊 GCP 大冒險

Compute Engine• 起⼿手式

• n1-standard-1 + SSD persistent disk

• AP(node.js)

• DB(PostgreSQL)

• Production + Beta

Page 6: 頑皮工坊 GCP 大冒險

Compute Engine• 完成體

• DB(向上提升)

• AP(⽔水平擴展)

• f1-micro

• HAProxy(HTTP load balancers)

Page 7: 頑皮工坊 GCP 大冒險

Cloud DNS

• 只是單純⽤用來管 DNS record

• 離 Routes 53 有點遠

Page 8: 頑皮工坊 GCP 大冒險

Cloud Monitoring

• 必裝 Monitor Agent

• Uptime Checks

• Alerting Policy

Page 9: 頑皮工坊 GCP 大冒險

Cloud Storage• 強烈推薦

• 容量無上限(只要你有 $$)

• 內建 CDN?

• Google Cloud Storage behaves essentially like a Content Delivery Network (CDN) with no work on your part because publicly readable objects are, by default, cached in the Google Cloud Storage network.

Page 10: 頑皮工坊 GCP 大冒險

Cloud Storage

• 放所有的 binary data

• 圖⽚片、聲⾳音檔、⋯⋯等

• 放 PostgreSQL dump

• Nearline

Page 11: 頑皮工坊 GCP 大冒險

Cloud Logging

• Log 集中化

• fluent

• 安裝 logging agent

Page 12: 頑皮工坊 GCP 大冒險

• resources types

• resources IDs

• logs

Cloud Logging

Page 13: 頑皮工坊 GCP 大冒險

綜合來說

Page 14: 頑皮工坊 GCP 大冒險

優點

• 每個 project 獨⽴立計費

• 送 Monitoring 跟 Logging 很超值

• asia-east1 在台灣

Page 15: 頑皮工坊 GCP 大冒險

缺點

• API 很難⽤用(還好慢慢改進中)

• developers console 已經變成⼤大雜燴

• google search 都要⽤用 “google cloud X” 下去找

Page 16: 頑皮工坊 GCP 大冒險

技術 Tips

Page 17: 頑皮工坊 GCP 大冒險

OAuth 2.0

• Backend 要⽤用的 OAuth 跟你想的不⼀一樣

• Credentials

• Service Account

• JSON Web Tokens (JWTs)

Page 18: 頑皮工坊 GCP 大冒險

OAuth 2.0

• ⽤用 JWT 去跟 Google 要 token

• token 放在 http request header ⼀一起出去

• 這裏可以做 token cache

Page 19: 頑皮工坊 GCP 大冒險

偷看 POST• gcloud --log-http

-body-start-

{"entries": [{"textPayload": "This is a test message from gcloud", "metadata": {"timestamp": "2015-05-27T13:52:19Z", "labels": {"compute.googleapis.com/resource_type": "instance", "compute.googleapis.com/resource_id": "sent with gcloud"}, "severity": "DEFAULT", "serviceName": “compute.googleapis.com"}}]}

-body-end-

Page 20: 頑皮工坊 GCP 大冒險

謝謝⼤大家