Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AppEngine × Spring Boot × Kotlin
Search
Hidetake Iwata
October 26, 2017
Technology
0
100
AppEngine × Spring Boot × Kotlin
2017.10.26
AppEngine ja night #2
Hidetake Iwata
October 26, 2017
Tweet
Share
More Decks by Hidetake Iwata
See All by Hidetake Iwata
Rewrite Go error handling using AST transformation
int128
1
1.3k
Cluster AutoscalerをTerraformとHelmfileでデプロイしてPrometheusでモニタリングする / Deploy the Cluster Autoscaler with Terraform and Helmfile, Monitor with Prometheus
int128
3
1.7k
認証の仕組みとclient-go credential plugin / authentication and client-go credential plugin
int128
7
7.4k
CLIでOAuth/OIDCを快適に利用する
int128
0
840
いつものJIRA設定
int128
1
180
Swaggerのテンプレートを魔改造した話 / Customize Swagger Templates
int128
1
4.8k
本番環境のリリースを自動化した話
int128
0
740
Swagger × Spring Cloud
int128
0
93
The Evolution of System Architecture
int128
0
170
Other Decks in Technology
See All in Technology
Spring Bootで実装とインフラをこれでもかと分離するための試み
shintanimoto
7
820
サーバレス、コンテナ、データベース特化型機能をご紹介。CloudWatch をもっと使いこなそう!
o11yfes2023
0
170
CodePipelineのアクション統合から学ぶAWS CDKの抽象化技術 / codepipeline-actions-cdk-abstraction
gotok365
5
150
watsonx.data上のベクトル・データベース Milvusを見てみよう/20250418-milvus-dojo
mayumihirano
0
110
The Tale of Leo: Brave Lion and Curious Little Bug
canalun
1
120
ドキュメント管理の理想と現実
kazuhe
0
140
Classmethod AI Talks(CATs) #21 司会進行スライド(2025.04.17) / classmethod-ai-talks-aka-cats_moderator-slides_vol21_2025-04-17
shinyaa31
0
590
はてなの開発20年史と DevOpsの歩み / DevOpsDays Tokyo 2025 Keynote
daiksy
6
1.5k
AIと開発者の共創: エージェント時代におけるAIフレンドリーなDevOpsの実践
bicstone
1
310
持続可能なドキュメント運用のリアル: 1年間の成果とこれから
akitok_
1
130
4/16/25 - SFJug - Java meets AI: Build LLM-Powered Apps with LangChain4j
edeandrea
PRO
1
100
クォータ監視、AWS Organizations環境でも楽勝です✌️
iwamot
PRO
1
310
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
329
38k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
550
GitHub's CSS Performance
jonrohan
1030
460k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.6k
Code Reviewing Like a Champion
maltzj
522
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
Docker and Python
trallard
44
3.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
13
1.4k
Transcript
AppEngine × Spring Boot × Kotlin Hidetake Iwata (@int128) AppEngine
ja night #2
Hidetake Iwata Software Engineer at NTT DATA ※今日は個人的なお話です 2
agenda 1. AppEngine × Spring Boot × Kotlinでサービスを作った話 2. Gradleのプラグインを作った話
3. CircleCIによる継続的デプロイ 3
GradleUpdate ビルドツール(Gradle)の新しいバージョンが出たら、バージョンアップのPull Requestを 送ってくれるサービスを開発中 https://gradleupdate.appspot.com • AppEngine Standard • Spring
Boot • Thymeleaf • Kotlin • EGit
AppEngine/Java 最近のStandard Environmentは大幅に改善されている • Java 8に対応 • Servlet 3.1に対応 •
クラス制限の廃止、スレッド生成の対応 (心の声...) • もうJava 9が出たよ • 時代はGolang一択では 5
Spring Boot Pros • JVM言語のWebアプリケーションフレームワークではデファクトスタンダード (Java, Groovy, Kotlin) • エコシステムが発達している
Cons • 初期化が遅い • フットプリントが大きい 6
Kotlin Pros • 既存言語のよいところを取り入れたモダンな言語 • Javaとの相互運用性 • コンパイルが速い Cons •
欠点は無い? 7
AppEngine × Spring Boot × Kotlin Pros • モバイルアプリとバックエンドを同じ言語で実装できる(Android) •
大抵のSpring Bootアプリはちゃんと動く • うれしい無料枠 Cons • エコシステムが未発達なのでLow Level APIに頼らざるを得ない • Too long spin up time • AppEngineとSpring Bootの相性 8
⚠ Too long spin up time問題 トラフィックが増えてスケールアウトする と、 大きなレイテンシが発生する 約20~25秒のレイテンシ
• 7秒(コンテナの起動) • 5秒(JVMやJettyの起動) • 8秒(Springの初期化) 9
⚠ AppEngineとSpring Bootの相性問題 ⚠ Problem • Spring Security OAuth2でセッションにアクセストークンが保存されない https://stackoverflow.com/questions/45217234/issue-with-using-spring-oauth-o
n-java8-standard-environment Workaround • AppEngine標準のセッションハンドラを使わない • Spring SessionでMemcache/Datastoreにセッション情報を保存 https://github.com/int128/spring-session-appengine
appengine-spring-boot-plugin Gradle plugin for App Engine Standard and Spring Boot
https://github.com/int128/appengine-spring-boot-plugin Features • Watch and Sync resources(テンプレートを編集したらリロードで反映) • Spring Bootのデバッグモードを有効化(テンプレートのキャッシュオフ等) • 環境依存値の管理
CircleCIによる継続的デプロイ GitHubにpushした契機でAppEngineにデプロイしたい • CircleCI 2.0を使う • サービスアカウントの秘密鍵はBASE64で環境変数に入れておく • google/cloud-sdk:alpineイメージにopenjdk8とapp-engine-javaをインストール •
GradleのappengineDeployタスクでデプロイ 12
version: 2 jobs: build: docker: - image: google/cloud-sdk:alpine working_directory: ~/gradleupdate
steps: - run: name: Install command: | apk --update add openjdk8 gcloud components install app-engine-java 13
- deploy: name: Deploy command: | if [ "$CIRCLE_TAG" ];
then echo "$GCP_SERVICE_ACCOUNT_KEY" | base64 -d > "$HOME/gcp-service-account-key.json" gcloud auth activate-service-account \ --key-file "$HOME/gcp-service-account-key.json" ./gradlew appengineDeploy fi 14
まとめ AppEngine × Spring Boot × Kotlinを快適に使うためのTipsを紹介しました • Gradle plugin
for App Engine Standard and Spring Boot https://github.com/int128/appengine-spring-boot-plugin • CircleCIによる継続的デプロイ 15