Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which...

57
Ruby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby Koichiro Ohba 大場光一郎 2012-11-09; RubyWorld Conference 2012; Kunibiki Messe 12119日金曜日

Transcript of Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which...

Page 1: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Ruby which Supports Social Platform

Development DepartmentDevelopment Platform

GREE, inc.

ソーシャルプラットフォームを支えるRuby

Koichiro Ohba大場光一郎2012-11-09; RubyWorld Conference 2012; Kunibiki Messe

12年11月9日金曜日

Page 2: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

12年11月9日金曜日

Page 3: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

���������������������

Making the world a better placethrough the power of the Internet.

12年11月9日金曜日

Page 4: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

12年11月9日金曜日

Page 5: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

San Francisco�

São Paulo

Vancouver�London �

Tokyo �Beijing �

Singapore �

Amsterdam�Seoul�

Dubai�Osaka�

11 branches in the world

12年11月9日金曜日

Page 6: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

12年11月9日金曜日

Page 7: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

テキスト

http://developer.gree.net/sp/globalplatform/en/products/

12年11月9日金曜日

Page 8: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

世界10億人に対応するソーシャルプラットフォームです。

It’s a social platform supporting 1 billion people in the world.

12年11月9日金曜日

Page 9: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

GREE PlatformStreamSocial GraphCommunityAuth

App PortalWeb Platform

GREEPlatformSDK

Social APIWeb ServiceNode

Middleware

12年11月9日金曜日

Page 10: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

統一されたSDK/APIにより、1度の開発で最大169の国および地域のユーザーにアプリケーションを配信できます。

Unified SDK/API enables delivery of applications to users in 169 countries.

12年11月9日金曜日

Page 11: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

テキスト

12年11月9日金曜日

Page 12: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

http://product.gree.net/jp/ja/apps/12年11月9日金曜日

Page 13: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

GREE Platform

12年11月9日金曜日

Page 14: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Over 1 billion users

10億ユーザーを支えるプラットフォーム

12年11月9日金曜日

Page 15: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

GREE is build onOpen Source

Powered by

12年11月9日金曜日

Page 16: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

1.Server Dashboard + API2.Server Configuration Management3.DNS : Bind/PrimDNS(original)4. Load Balancer5.App Server6.KVS7.Large Object Storage8.Messaging Queue9.Full Text Search10.Monitoring / Alerts11.Deployment12.Analytics

12年11月9日金曜日

Page 17: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

1. Server Dashboard + API

11. Deployment

4. Load Balancer5. App Server

Rubyinside

12年11月9日金曜日

Page 18: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Server Dashboard

12年11月9日金曜日

Page 19: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Manage many serversたくさんのサーバを管理

12年11月9日金曜日

Page 20: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

サーバ属性管理•OS/CPU spec•サーバ役割•場所(DC,ラック)•IP/名前•サーバ初期化、構成変更•状態、負荷監視(Ganglia)

12年11月9日金曜日

Page 21: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

12年11月9日金曜日

Page 22: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

12年11月9日金曜日

Page 23: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

12年11月9日金曜日

Page 24: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

http://api/product_id/servers

テキスト

{“results”  =>    [{“property”  =>  {“server_type”  =>  “DB”,    “ipaddr”  =>  “XX.XX.XX.XX”,    “hardware”  =>  “Intel  Xeon  2.6Ghz”,    ...    }}

12年11月9日金曜日

Page 25: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Server Dashboardの利点

12年11月9日金曜日

Page 26: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

サーバの役割

Servers have many purposes

12年11月9日金曜日

Page 27: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

LVS Proxy(Apache+mod_proxy)

Web(Apache+PHP)

標準構成

12年11月9日金曜日

Page 28: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

LVS

Proxy

Web

Proxy

Web

Web

Web

Web

WebLVS

12年11月9日金曜日

Page 29: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Deployment

12年11月9日金曜日

Page 30: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

gree_deploy

Rubyinside

12年11月9日金曜日

Page 31: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Why we don’t use Capistrano?なぜCapistranoを使わないのか

12年11月9日金曜日

Page 32: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

“たとえそれが車輪の再発明であっても構わない。何でもやったほうがいいと思

うんですよね”

Matz at 札幌Ruby会議2012

http://www.flickr.com/photos/recompile_net/5952565740/

“You should do whatever you want, even if it’s reinvention of the wheel”

12年11月9日金曜日

Page 33: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

ひとつのプロダクトで複数のgitリポジトリを使いたい

12年11月9日金曜日

Page 34: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

サービスを稼働したまま更新する

Live Update

12年11月9日金曜日

Page 35: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

LVS

Proxy

Web

Proxy

Web

Web

Web

Web

WebLVS

Deploy

12年11月9日金曜日

Page 36: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

LVS

Proxy

Web

Proxy

Web

Web

Web

Web

WebLVS

Deploy

12年11月9日金曜日

Page 37: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

LVS

Proxy

Web

Proxy

Web

Web

Web

Web

WebLVS

Deploy

12年11月9日金曜日

Page 38: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

APIから必要な役割のサーバリストを取得し、一部のサーバをサービスアウトして配る

Get the target servers list and make part of them in-active and deploy the application there.

12年11月9日金曜日

Page 39: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

gree_deploy Dashboard Web

Collect

Proxy Control

Deploy

Proxy

Enable/Disable

WorkerWorkerWorkerWorker Restart

DeployDist.

12年11月9日金曜日

Page 40: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

require  'gree/server'

servers  =  GREE::Server.find({                'virtual_server_name'  =>  'ds%',                'type'        =>  'master',                'service'  =>  'mail',                'state'      =>  'on_service',})

12年11月9日金曜日

Page 41: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

gem i gree-rubylib

12年11月9日金曜日

Page 42: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Improvement

12年11月9日金曜日

Page 43: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

DeploymentFlow

12年11月9日金曜日

Page 44: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Commit stage

Capacity test

User acceptance test

Acceptance test stage Production

『継続的デリバリー』Jez Humble, David Farley著(ASCII)

Deployment Pipeline

gree_deploy

12年11月9日金曜日

Page 45: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

@release-open

Staging

Test please

@ok 0b70750bd

@release-close

DeployProduction

12年11月9日金曜日

Page 46: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

git-dailyhttp://labs.gree.jp/blog/2011/05/3528/

12年11月9日金曜日

Page 47: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

gem i git-dailyhttps://github.com/koichiro/git-daily

Rubyinside

12年11月9日金曜日

Page 48: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

JIRA KPIPackage

Management

Rubyinside

12年11月9日金曜日

Page 49: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Open Source

12年11月9日金曜日

Page 50: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

github.com/gree

12年11月9日金曜日

Page 51: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

LWFUnity-*FlareOrion

12年11月9日金曜日

Page 52: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

http://techtalk1.labs.gree.jp/12年11月9日金曜日

Page 53: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

まとめConclusion

12年11月9日金曜日

Page 54: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

グリーのシステムを支えるための重要な道具としてRubyをつかっています

We are using Ruby than you expect to support GREE’s systems.

12年11月9日金曜日

Page 55: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Rubyの他にもたくさんのオープンソースを使っているし、公開もします。

Also using many other OSS. We provide OSS too.

12年11月9日金曜日

Page 56: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

Rubyのほうが向いている領域ならRubyで書いちゃえばいい。

PHP code can be replaced to Ruby if Ruby is better for the purpose.

12年11月9日金曜日

Page 57: Ruby which Supports Social Platform2012.rubyworld-conf.org/files/slides/rwc2012_B-3.pdfRuby which Supports Social Platform Development Department Development Platform GREE, inc. ソーシャルプラットフォームを支えるRuby

http://jobs.gree.net/

12年11月9日金曜日