Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

頑皮工坊 GCP 大冒險

456 views

Published on

頑皮工坊 GCP 大冒險

Published in: Software
  • Be the first to comment

頑皮工坊 GCP 大冒險

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

×