2023 年 9 月 26 日に開催した AWS Developer Live Show「難しい事抜きでまずはアプリケーションをコンテナ化してみよう」の投影資料です。
AWS Developer Live Show のイベントページは、こちらをご参照ください。 https://aws.amazon.com/jp/builders-flash/developer-live-show/
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.今⽇のテーマ難しい事抜きでまずはアプリケーションをコンテナ化してみよう !
View Slide
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.本⽇の参加メンバー
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.“既存のアプリケーションをコンテナ化します”!どこから⼿をつけますか︖
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.コンテナへの移⾏⼿順既存のアプリケーションが動く環境の把握コンテナで動かすことを想定したリファクタリングコンテナイメージの作成ビジネスゴールの評価組織編成プラットフォーム選定 概念実証 (PoC)運⽤ガバナンス
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.(難しいこと抜きにした) コンテナへの移⾏⼿順既存のアプリケーションが動く環境の把握コンテナで動かすことを想定したリファクタリングコンテナイメージの作成
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.サンプルアプリケーション: ⽂章翻訳サービスAWS Cloudアプリケーション(Java / Tomcat)データベース (MySQL)Amazon Translate1. ⽂書取得2. ⽂書翻訳3. 翻訳⽂書保存
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.サンプルアプリケーション: ⽂章翻訳サービスデモをお⾒せします
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.既存のアプリケーションが動く環境の把握コンテナで動かすことを想定したリファクタリングコンテナイメージの作成
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.アプリケーションサーバーには何が必要︖!
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.例: サンプルアプリケーションの場合• アプリケーションコード• アプリが依存している 3rd party ライブラリ=> WAR ファイルを本番環境 (EC2 インスタンス) にデプロイ• (アプリケーションコードの) ランタイム=> 本番環境 (EC2 インスタンス) のプロビジョニング時に Java と Tomcat をインストール
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.コンテナ化に伴いリファクタリングは必要︖!
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.アプリケーションに可搬性がない場合...OSライブラリコンテナイメージ開発⽤アプリケーション開発環境 本番環境開発⽤アプリケーションAWS Cloud9 Amazon ECS※ Amazon ECS: Amazon Elastic Container Service
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.The Twelve-Factor AppThe Twelve-Factor App (⽇本語訳)https://12factor.net/ja/
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.例: サンプルアプリケーションの場合ローカルマシンで実⾏されるインメモリデータベースにデータを保存=> バックエンドサービスとしてデータベースを切り離す🙅ローカルマシンのメモリ上にセッション情報を保存=> セッション情報を外部ストレージに保存する🙅アプリケーションログをファイルに出⼒=> ログを標準出⼒にイベントストリームとして出⼒🙅IV. バックエンドサービスVI. プロセスXI. ログ: The Twelve-Factor App プラクティス
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.どうやってコンテナイメージを作成する︖!
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.Dockerfile を利⽤したコンテナイメージの作成# WAR ファイルを Gradle 公式イメージの中でビルドFROM public.ecr.aws/docker/library/gradle:7.5.1-jdk17 as builderCOPY ./ /home/gradle/RUN gradle --no-daemon war# WAR ファイルを Tomcat 10 のイメージにコピーFROM public.ecr.aws/docker/library/tomcat:10.1.11-jre17COPY --from=builder /home/gradle/build/libs/docrdr.war $CATALINA_HOME/webapps/ROOT.war# このアプリケーションが公開するポートEXPOSE 8080例: サンプルアプリケーションの場合
© 2023, Amazon Web Services, Inc. or its affiliates. All rights reserved.参考資料: コンテナ化のためのリアーキテクチャRe-Architecture for Containershttps://catalog.us-east-1.prod.workshops.aws/workshops/a49e50ba-7473-4348-ba5d-6166385ad91d/ja-JP