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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hidetake Iwata
October 26, 2017
Technology
0
150
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.4k
Cluster AutoscalerをTerraformとHelmfileでデプロイしてPrometheusでモニタリングする / Deploy the Cluster Autoscaler with Terraform and Helmfile, Monitor with Prometheus
int128
3
1.8k
認証の仕組みとclient-go credential plugin / authentication and client-go credential plugin
int128
7
7.8k
CLIでOAuth/OIDCを快適に利用する
int128
0
970
いつものJIRA設定
int128
1
210
Swaggerのテンプレートを魔改造した話 / Customize Swagger Templates
int128
1
4.9k
本番環境のリリースを自動化した話
int128
0
830
Swagger × Spring Cloud
int128
0
120
The Evolution of System Architecture
int128
0
210
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructure:2026年1月度サービス・アップデート
oracle4engineer
PRO
0
190
AWS Devops Agent ~ 自動調査とSlack統合をやってみた! ~
kubomasataka
2
260
AI時代のPMに求められるのは 「Ops」と「Enablement」
shimotaroo
1
440
持続可能な開発のためのミニマリズム
sansantech
PRO
4
600
EventBridge API Destination × AgentCore Runtimeで実現するLambdaレスなイベント駆動エージェント
har1101
7
270
Exadata Database Service ソフトウェアのアップデートとアップグレードの概要
oracle4engineer
PRO
1
1.2k
人はいかにして 確率的な挙動を 受け入れていくのか
vaaaaanquish
4
3.1k
AI開発の落とし穴 〜馬には乗ってみよAIには添うてみよ〜
sansantech
PRO
10
5.2k
JuliaTokaiとしてはこれが最後かもしれない(仮) for NGK2026S
antimon2
0
130
セキュリティ はじめの一歩
nikinusu
0
1.1k
AI開発をスケールさせるデータ中心の仕組みづくり
kzykmyzw
0
180
最速で価値を出すための プロダクトエンジニアのツッコミ術
kaacun
1
360
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
48
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
Tell your own story through comics
letsgokoyo
1
800
RailsConf 2023
tenderlove
30
1.3k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
130
sira's awesome portfolio website redesign presentation
elsirapls
0
140
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Facilitating Awesome Meetings
lara
57
6.7k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
900
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.5k
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