Upload
onlinemad
View
74
Download
2
Embed Size (px)
Citation preview
頑⽪皮⼯工坊 GCP ⼤大冒險2015/05/28
GCPUG Taiwan Meetup - Google I/O Extend Taipei 2015
關於我
• Ian Wu
• 瘋⼈人院院⻑⾧長
• 頑⽪皮⼯工坊 Backend Engineer
• http://blog.ianwu.tw/about-me/
關於頑⽪皮⼯工坊
我們⽤用到的服務• Compute Engine
• Cloud DNS
• Cloud Monitoring
• Cloud Storage
• Cloud Logging
Compute Engine• 起⼿手式
• n1-standard-1 + SSD persistent disk
• AP(node.js)
• DB(PostgreSQL)
• Production + Beta
Compute Engine• 完成體
• DB(向上提升)
• AP(⽔水平擴展)
• f1-micro
• HAProxy(HTTP load balancers)
Cloud DNS
• 只是單純⽤用來管 DNS record
• 離 Routes 53 有點遠
Cloud Monitoring
• 必裝 Monitor Agent
• Uptime Checks
• Alerting Policy
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.
Cloud Storage
• 放所有的 binary data
• 圖⽚片、聲⾳音檔、⋯⋯等
• 放 PostgreSQL dump
• Nearline
Cloud Logging
• Log 集中化
• fluent
• 安裝 logging agent
• resources types
• resources IDs
• logs
Cloud Logging
綜合來說
優點
• 每個 project 獨⽴立計費
• 送 Monitoring 跟 Logging 很超值
• asia-east1 在台灣
缺點
• API 很難⽤用(還好慢慢改進中)
• developers console 已經變成⼤大雜燴
• google search 都要⽤用 “google cloud X” 下去找
技術 Tips
OAuth 2.0
• Backend 要⽤用的 OAuth 跟你想的不⼀一樣
• Credentials
• Service Account
• JSON Web Tokens (JWTs)
OAuth 2.0
• ⽤用 JWT 去跟 Google 要 token
• token 放在 http request header ⼀一起出去
• 這裏可以做 token cache
偷看 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-
謝謝⼤大家