Top Banner
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Game Entertainment, Amazon Web Services Japan K.K. Solutions Architect, 祐孝 AWS上で実現するゲーム開発 CI/CDパイプライン
47

Gaming cicd-pipeline gaming-technight-2

Jan 29, 2018

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Game Entertainment, Amazon Web Services Japan K.K.

Solutions Architect, 森 祐孝

AWS上で実現するゲーム開発CI/CDパイプライン

Page 2: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

森 祐孝(もり ゆうこう)ソリューションアーキテクト経歴• メーカー系SIer(ソフト開発)• 電⼦マネー運営(サーバソフト開発)• 独⽴系SIer

• 情報通信キャリア向けのSIでPL、PM• コンソール系ゲーム会社(テクニカルディレクター)

• ブラウザソーシャルゲーム、スマートフォン向けソーシャルゲーム担当• ソーシャルゲーム、コンソールゲーム系のお客様• Amazon Lumberyard 、Amazon GameLift

⾃⼰紹介

Page 3: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ゲームでのシステム構成例

S3CloudFront

WAF

Shield

ALB

APIGateway

GameLift

ElastiCacheDynamoDB

AuroraEC2

EC2 ECS

LambdaKinesisKinesis FireHose

S3

Redshift

Athena

QuickSight

CognitoRoute53

分析基盤

配信基盤

ネットワークセキュリティ

API基盤

ゲーム基盤

共通基盤

Mobile

PC

Console

Aurora

or

Page 4: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

CI/CDパイプラインを実現するAWSのマネージドサービス

Page 5: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

• 他のシステムとの統合テスト

• ロードテスト• UIテスト• 侵⼊テスト

リリースプロセスの4つの主なフェーズ

ソース ビルド テスト 運⽤

• ソースコードをチェックイン

• バージョン管理、ブランチ管理

• 新しいコードのピアレビュー

• Java、C#、C++などのコードのコンパイル

• ユニットテスト• スタイルチェッ

カー• コードメトリック• コンテナイメージ

の作成

• 本番環境にデプロイ

Page 6: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

CI/CDパイプライン

ソース ビルド テスト 運⽤

継続的インテグレーション

継続的デリバリ

継続的デプロイメント

継続的インテグレーション(CI)、継続的デプロイメント(CD)を実現

Page 7: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

継続的デリバリのメリット

開発者の⽣産性を改善

バグをすばやく検出して対処

アップデートの配信を⾼速化

ソフトウェアのリリースプロセスを

⾃動化

Page 8: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ゲームにおけるCI/CDパイプライン

ソースコード

Code Commit

GitHub

Code Build S3

ECR

Code Deploy

ECS

EC2

ビルド〜テスト〜デプロイまでを⾃動化OSSやサードパーティも組み合わせ可能

Code Pipline

Source Build/Test Deploy

Lumberyard

ソースコードの

バージョン管理ビルド⾃動化 デプロイ⾃動化

AWS CodeStar

Jenkins

Page 9: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

DEMO!

Page 10: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS Cloud9コードの作成や実行やデバッグが可能なクラウドベースのIDEサービス

N EW !

Page 11: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS Cloud9コードの作成や実行やデバッグが可能なクラウドベースの IDE サービス

素早く開始ブラウザで利用可能

AWSとのインテグレーションサーバーレスアプリ開発を簡単に

リアルタイムペアプログラミング

Page 12: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

クラウドベースの統合開発環境AWS Cloud9• AWSクラウド上で開発・テスト・デバッグを完

結できる統合開発環境のサービスを発表。環境構築に時間を掛けず、即座に開発を始められる

• 初の”クラウドネイティブ”なIDE。Lambdaと統合され、ファンクションのテストをシームレスに実⾏できる。CodeStarとの統合も

• ⾃分の開発環境にアクセスできるユーザをIAMユーザの単位で設定し、共同作業が可能に

Page 13: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Storing your code

Page 14: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

クラウドにおけるソース管理に求められるもの

Secure Fullymanaged

High availability

Storeanything

Page 15: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

v AWSによるフルマネージドなサービスv ⾼可⽤性、耐久性及びハードウェア、ソフトウェアを管理する

負荷の削減v セキュアにコードを管理

v AWS CodeCommitは送信時及び保存時に暗号化v 容易にスケール

v 多数のファイルやブランチ、履歴を保持可能v どのようなファイルも保存可能

v 保存できるファイルのサイズやタイプに制限はないv 他のAWSサービスやサードパーティーと連携可能

v IAM Roleによる他のサービスとの連携が容易v 他のリモードレポジトリからの移⾏が容易

v 他のGitベース リポジトリからシンプルに移⾏可能v 既存のGitツールが利⽤可能

AWS CodeCommit

Page 16: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS CodeCommit

git pull/push CodeCommit

Git オブジェクトはAmazon S3で管理

Git インデックスはAmazon DynamoDBで管理

暗号化キーはAWS KMSで管理

SSH or HTTPS

Page 17: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

プルリクエストにも対応

• リポジトリのユーザに対して、プルリクエストを起点としたコードに関する議論やコミュニケーションの機会を提供できるようになった

• CodeCommitの仕組みの中でコードレビューを実施したり、変更箇所を精査することが可能に。結果として品質改善に繋げることができる

Page 18: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Build & test your application

Page 19: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

vフルマネージドvAWS CodeBuildはセットアップ、パッチ、アップデート、サーバー管理の手間が不要

vオンデマンドvビルドしたいニーズに合わせて自動でスケール。利用した分数のみのお支払い

vすぐに使えるv最もポピュラーな開発言語用の構成済みのビルド環境を提供。最初にビルド スクリプトを作成するだけ。

AWS CodeBuild

Page 20: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

どのように動作するのか?

1. ソースコードのダウンロード2. 一時的なコンテナ内でbuildspecで構成されたコマンドを実行(ビルドごとに新規に作成される)

3. マネジメント コンソールとCloudWatch Logsにビルドの出力結果が送信される

4. 生成されたアーティファクトをS3バケットにアップロード

Page 21: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

CodeBuildでどのようにリリースプロセスを自動化するか?

• CI/CDのためのAWS CodePipelineとの統合

• 容易な自動化(API/CLI)

• ビルド環境を持ち込み可能• 必要なツールを含むDockerイメージの作成

• オープンソース Jenkins プラグイン• CodeBuildをJenkins Master のWorkerとして利用

Page 22: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Deploying your applications

Page 23: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

v ⾃動化されたデプロイメントv 開発、テスト、本番環境への完全に⾃動化されたデプロイ

メント。AWS CodeDeployは数千台の環境にスケール可能v 最⼩のダウンタイム

v インプレース デプロイメントではAmazon EC2インスタンスに対してローリング アップデートが可能

v ブルー/グリーン デプロイメントでは最新のリビジョンをインスタンスにデプロイしてトラフィックを即時またはテスト完了後すぐに新しい環境にリルート

v 停⽌とロールバックv ⾃動的またはマニュアルで停⽌とロールバックが可能

v センターコントールv AWS CodeDeployコンソール及びAWS CLIでステータス

のトラックが可能v 容易な適⽤

AWS CodeDeploy

Page 24: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

デプロイとは?

アプリケーションやアセットの更新をサーバに反映させること

実際には、更新されたファイル群を対象のサーバ群に配布する

Availability Zone Availability Zone

v2

Page 25: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

よくある課題をAWS CodeDeployで解決

自動化できていない

→もちろん自動的にデプロイデプロイサーバの負荷、シングルポイント

→マネージドサービスのためパフォーマンス、耐障害性も気にしなくて良くなる

新規サーバ構築時にデプロイ対象がわからない

→CodeDeployなら、AutoScalingと連動し自動でデプロイ複数人でデプロイがぶつからない様に管理するのが面倒

→AWS CodeDeployで一元管理

Page 26: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

デプロイの効率化・安定化

質の高いリリースのためには、必要不可欠

効率的で安定している仕組みがあるなら、それを使わない手はない

AWS CodeDeployが選択肢

Page 27: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Orchestrating build and deploy with a pipeline

Page 28: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

デプロイメントパイプラインとは

ソースコードからビルドやテストなどのステージを⾃動化したプロセスプロセスは開発チームやサービスそれぞれで異なるスムーズなデプロイメントには⽋かせない

ソースコード

ビルド テスト ステージデプロイ

本番デプロイUAT

デプロイメントパイプライン

Page 29: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

v リリース プロセスを⾃動化v ソースリポジトリからビルド、テスト、デプロイメントまで完

全に⾃動化されたリリース プロセスv ⼀環したリリース プロセスを確⽴

v コードの変更に対して⼀貫した実⾏ステップのセットを定義v 改善された品質でデリバリをスピードアップ

v リリース プロセスを⾃動化し、インクリメンタルな機能追加を可能について顧客に素早くリリース

v お気に⼊りのツールを利⽤可能v 既存のソース、ビルド、デプロイメントのツールをパイプラン

に組み込みv 進捗状況が⼀⽬瞭然

v リアルタイムにパイプラインのステータスをレビュー可能

AWS CodePipeline

Page 30: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS CodePipeline

カスタマイズ可能なワークフローエンジンパートナーやカスタムのシステムと連携ビジュアルエディターと可視化されたステータス

継続的デリバリー、リリース⾃動化を、Amazonの様に

Build1) ビルド2) Unitテスト

1) デプロイ2) UIテスト

Source Beta Production1) デプロイ2) 負荷テスト

Gamma1) カナリア デプロイ2) リージョン1 デプロイ3) リージョン2 デプロイ

Page 31: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

MyAppCodeCommit

Source

BuildCodeBuild

Build

DeployToIntegCodeDeploy

Staging

IntegTestEnd2EndTester

DeployToProdCodeDeploy

Production

ソースのコミット

アプリケーションのビルド

ステージング環境へのデプロイ

ステージンの確認

本番環境へのデプロイ

CodePipelineでのリリースプロセスモデル化

アクション ステージ

パイプライン

トランジション

Page 32: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS CodeStar

Page 33: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS CodeStarAWS上にアプリケーションをすばやく開発・ビルド・デプロイ

AWS上での開発をわずか数分間で開始

チームをまたがった開発をセキュアに

ソフトウェアデリバリの管理を容易に

様々なプロジェクトテンプレートから選択

Page 34: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step1 : プロジェクトテンプレート選択

Page 35: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step1 : プロジェクトテンプレート選択

Page 36: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step2 : 開発ツールセットアップ

Page 37: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Complete!

Page 38: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

セットアップ内容

• サンプルアプリケーション• EC2 or Beanstalk or Lambda

• CodeCommitリポジトリ• CodeBuildビルドプロジェクト• デプロイツール

• CodeDeploy or Beanstalk or CloudFormation• CodePipeline 継続的デプロイメントパイプライン• CloudWatchメトリクス• プロジェクトダッシュボード

Page 39: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Project Dashboard

CloudWatchメトリクス

CodeCommit Appエンドポイント

CodePipelineJIRA統合メニュー

Page 40: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Amazon GameLift

Page 41: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Amazon GameLift• セッションベースのマルチプレイヤーゲームサーバーをホスティングするためのマネージドサービス

• プレーヤ数に応じて自動的に拡張/縮小

• 世界中で低レイテンシのプレーヤー体験を提供

• GameLift Server SDK(C#, C++)を提供• クライアントSDKは10⾔語以上サポート• DDoSプロテクション※

• ダウンタイムなしでライブアップデートをリリース

• 利用した分だけの料金

• カスタマイズ可能なマッチメイキング機能

※DDoS 攻撃からゲームサーバーを保護する方法https://aws.amazon.com/jp/blogs/gamedev/protect-multiplayer-game-servers-from-ddos-attacks-using-amazon-gamelift-2/

Page 42: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

GameLiftはわずか数分の作業で簡単に始められます。

サーバアプリのアップ

ロード

Fleetを構成

スケールアップ

ゲームをプレイ

1 2 3 4

Page 43: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

GameLift FlexMatch• カスタマイズ可能なマッチ

メイク• プレイヤーグループ• レイテンシーによるマッチ

メイクも• ルールを緩める事も可能• マッチの許可・否認• ベストなリージョン配置• 追加料⾦はなし

グループ プレイ

キューイング

マッチ

Page 44: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

GameLift Local• ローカル開発マシン上のGameLift APIのサブセットをエミュレートするクライアントサイドのデバッグツール

• ダウンロード: • https://aws.amazon.com/gamelift/getting-started/• GameLift Server SDKパッケージに含まれる

• GameLift Server SDK APIsをサポート• 下記のClient APIsをサポート

CreateGameSession, DescribeGameSessions, CreatePlayerSession, CreatePLayerSessions, DescribePlayerSessions

GameLift Debug & Test

Page 45: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

GameLiftの開発プロセスを自動化することも可能

MyAppCodeCommit

Source

BuildCodeBuild

Build

DeployToIntegCodeDeploy

Integration

IntegTestEnd2EndTester

DeployToProdCodeDeploy

Production

EC2

テスト環境へはEC2上にGameLift local+テストモジュールをデプロイ

CodeDeploy

EC2CodeDeploy GameLift

Gamelift LocalでテストされたバイナリをGameLiftへアップロード

Page 46: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

まとめ

• マネージドサービスを使えば簡単にCI/CDを実現するツールが利⽤できます。これらを活⽤することで⾼品質なソフトウェアをインクリメンタルな開発⼿法で素早くリリースできます。

• 多くのユーザが楽しんでくれるゲームのバックエンドは、AWSが全⼒でサポートします!

• 安⼼して多くのユーザにおもしろゲームの提供し、⼤きなイノベーション⽣むをゲーム開発に集中していただければと思います

Page 47: Gaming cicd-pipeline gaming-technight-2

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.