43
その日くちたまは いかにして壊れたのか 夏のhoge駆動☆カレーの王子さまリターンズ 〜たんごさんを囲みながら資料の盆踊りスペシャル〜 2013/07/27

Ec2 automation framework

Embed Size (px)

DESCRIPTION

2013/07/27 Hoge駆動で発表した資料です。 chef, knife-soloを使って、自動的にAMIを更新するフレームワークを作成しました。

Citation preview

Page 1: Ec2 automation framework

その日くちたまはいかにして壊れたのか夏のhoge駆動☆カレーの王子さまリターンズ〜たんごさんを囲みながら資料の盆踊りスペシャル〜

2013/07/27

Page 2: Ec2 automation framework

Kuchitama

• くちたま• FuRyu株式会社• Chef導入委員長(自称)

Page 3: Ec2 automation framework

Kuchitamaソーシャルゲーム

Page 4: Ec2 automation framework

Kuchitama

Page 5: Ec2 automation framework

Social Game

←NEW

Page 6: Ec2 automation framework

昨日の出来事

Page 7: Ec2 automation framework

Social Game

• プラットフォーム追加• ランキング入り• 広告出稿

ユーザ増加

Page 8: Ec2 automation framework

Social Gameユーザ増加

Page 9: Ec2 automation framework

Social Gameユーザ増加

サーバ負荷の増加

Page 10: Ec2 automation framework

負荷対策

•HTTPサーバ/アプリチューニング → Nginx, Play

•DBチューニング→RDBMS

•サーバスケールアップ/アウト→AWS

Page 11: Ec2 automation framework

Nginx/Play• http://tech.furyu.jp/blog/?p=2069

Page 13: Ec2 automation framework

AWS• Scale up

• EC2/RDS インスタンスタイプ変更• サーバのスペックアップ• Scale out

• EC2インスタンス追加

Page 14: Ec2 automation framework

EC2スケールアウトスケールアウト

Page 15: Ec2 automation framework

EC2スケールアウトスケールアウト

Page 16: Ec2 automation framework

EC2スケールアウトスケールアウト

AMI作って

Page 17: Ec2 automation framework

EC2スケールアウトスケールアウト

AMI作って作成

Page 18: Ec2 automation framework

EC2スケールアウトスケールアウト

AMI作って作成手動で

Page 19: Ec2 automation framework

EC2スケールアウト

_人人人人_> 手動 <‾Y^Y^Y‾

Page 20: Ec2 automation framework

手順1元になるAMIを選択

Page 21: Ec2 automation framework

手順1元になるAMIを選択

多いわ!

Page 22: Ec2 automation framework

手順2作成したEC2インスタンスに接続

Page 23: Ec2 automation framework

手順2作成したEC2インスタンスに接続

どれやねん!

Page 24: Ec2 automation framework

手順3から]# ntpd stop]# hostname hoge]# vi /etc/hosts]# network restart]# ...]# ...]# ...

Page 25: Ec2 automation framework

手順3から]# ntpd stop]# hostname hoge]# vi /etc/hosts]# network restart]# ...]# ...]# ...

そこから先は覚えていない

Page 26: Ec2 automation framework

手順1~3]# ntpd stop]# hostname hoge]# vi /etc/hosts]# network restart]# ...]# ...]# ...

Page 27: Ec2 automation framework

手順1~3]# ntpd stop]# hostname hoge]# vi /etc/hosts]# network restart]# ...]# ...]# ...

これをひたすら繰り返す

Page 28: Ec2 automation framework

昨日の出来事

Page 29: Ec2 automation framework

昨日の出来事

そりゃ壊れるわ

Page 30: Ec2 automation framework

自動化したい

•AWSの操作

• Ruby-SDK•サーバの操作

• Chef

Page 31: Ec2 automation framework

作った

Page 32: Ec2 automation framework

•AMIからEC2を起動

•EC2でChefレシピを実行

• vim, NeoBundleレシピを実行•EC2をAMIとして保存

デモ

Page 33: Ec2 automation framework

•実行も自動化したい

•タイミングはrecipeとかを更新したときがいい

→ Git push時

更に自動化

Page 34: Ec2 automation framework

web api

Page 35: Ec2 automation framework

web api

Push

POST

Page 36: Ec2 automation framework

デモ

•GitPushしたら勝手にさっきのデモが実行

Page 37: Ec2 automation framework

まとめ

•スケールしやすいクラウドサービスもちゃんとスケールの準備してないと意味ないよね

•というわけでフレームワーク作りました

Page 39: Ec2 automation framework

one more thing

Page 40: Ec2 automation framework

ある朝のできごと

•ある朝、某AWS認定ソリューションアーキテクト- アソシエイトレベルさんからメールが

•URLを開くと・・・

Page 41: Ec2 automation framework

OpsWorks

http://aws.typepad.com/aws_japan/2013/07/aws-opsworks-update-custom-amis-and-chef-11-support.html

カスタムAMIサポート

Page 42: Ec2 automation framework

OpsWorks

http://aws.typepad.com/aws_japan/2013/07/aws-opsworks-update-custom-amis-and-chef-11-support.html

カスタムAMIサポート俺の実装

いらんかったんや

Page 43: Ec2 automation framework

宣伝

https://www.facebook.com/ksgstudy

関西ソーシャルゲーム勉強会 職種不問(Planner, Designer,  Programmer, Infrastructure) ビアバッシュ