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
Shuttle で Rust アプリケーションを爆速デプロイ
Search
codemountains
December 19, 2023
Programming
290
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Shuttle で Rust アプリケーションを爆速デプロイ
UV Study : Rust LT会(2023.12.19)での登壇資料「Shuttle で Rust アプリケーションを爆速デプロイ」です。
codemountains
December 19, 2023
More Decks by codemountains
See All by codemountains
API ファーストな CMS の世界
codemountains
0
68
Rust | axum でモック用の API サーバーを起動できる CLI ツール作ってみた
codemountains
0
62
Rust.Nagoya #1
codemountains
0
460
Momento Deep Dive - 真のサーバーレスとは?
codemountains
0
890
Rust 製エディタ Zed を布教したい
codemountains
0
890
kintone Night Nagoya vol.12 - kintone x Collaboflow で評価日報
codemountains
0
60
LINE WORKS と 生成 AI ~Claude 3 と LangChain~
codemountains
0
1.1k
Amazon S3 Express One Zone & AWS re:Invent 2023 現地体験談
codemountains
0
1.6k
Postman CLI で Integration Test
codemountains
2
1.1k
Other Decks in Programming
See All in Programming
スマートグラスで並列バイブコーディング
hyshu
0
270
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.5k
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
260
Creating Composable Callables in Contemporary C++
rollbear
0
180
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
380
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.6k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
620
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.1k
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
220
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
610
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.5k
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
280
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
440
The SEO identity crisis: Don't let AI make you average
varn
0
510
New Earth Scene 8
popppiees
3
2.4k
The Spectacular Lies of Maps
axbom
PRO
1
840
YesSQL, Process and Tooling at Scale
rocio
174
15k
Optimizing for Happiness
mojombo
378
71k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
380
AI: The stuff that nobody shows you
jnunemaker
PRO
8
750
Mobile First: as difficult as doing things right
swwweet
225
10k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
It's Worth the Effort
3n
188
29k
Transcript
で Rust アプリケーションを爆速デプロイ 2023.12.19 UV Study : Rust LT会 Kazuno
Fukuda
目次 自己紹介 1. Shuttle について 2. Axum アプリを Shuttle に移行してみた話
3. まとめ 4.
自己紹介 Kazuno Fukuda Kazuno Fukuda
について インフラストラクチャを管理しながらアプリをデプロイできる Rust ネイティブのクラウド開発プラットフォーム Community プランなら無料で利用可能 主要なWebフレームワークに対応 Axum Actix Web
Rocket などなど Rust に特化!
について Infrastructure from Code DBなどのリソースはコードで定義
について Infrastructure from Code アプリケーションの構築とデプロイを簡単にすること を目標としている
にアプリをデプロイ Render と MongoDB Atlas で構築した Axum アプリを Shuttle に移行してみた
cargo-shuttle をインストール cargo install cargo-shuttle cargo shuttle login CLI ツールでデプロイできる
アプリやリソースの管理もできる
Shuttle 用に main.rs を修正していく shuttle-runtime shuttle-axum shuttle-secrets 必要なクレート
Shuttle 用に main.rs を修正していく ほぼ main.rs の修正で完結しました
Shuttle 用に main.rs を修正していく 環境変数を secret_store で管理するように MongoDB をプロビジョニング Axum
なので ShuttleAxum を定義
Shuttle 用に main.rs を修正していく Shuttle のシークレット情報を環境変数に書き込む
Secrets から環境変数へ Axum の State や Layer に追加することで、 シークレット情報を扱う方が良さそう? 環境変数への書き込みは、
ドキュメントでは回避策として紹介されていた
mountix-shuttle ├── mountix-adapter └── mountix-driver MongoDB の Database の参照可能に MongoDB
の Database を参照できるように
ロギングは tracing が使える デフォルト機能として提供 初期化などは不要
ローカル環境でデバッグする MongoDB は Docker で起動 `cargo run` した場合、ヒントが出力される [HINT]: Run
shuttle with `cargo shuttle run` cargo shuttle run cargo watch -x ‘shuttle run’ watch も使える!
設定は toml で管理 Shuttle.toml : 基本情報(プロジェクト名) Secrets.toml : シークレット情報 開発環境では
Secrets.dev.toml を使う
デプロイはコマンドで簡単にできる cargo shuttle project start cargo shuttle deploy
デプロイはコマンドで簡単にできる ログを確認できる
デプロイはコマンドで簡単にできる キーが参照できる (編集は削除からCLIで再作成)
工夫したところ 起動時にマスタデータをインサートできるようにした src 直下に main.rs が必要だった src/bin/bootstrap.rs に main 関数を定義
していたら、起動できなかった
のブログが良い
Shuttle Next !? Shuttle-next is a brand new WASM web-framework
based on Axum and Hyper. Shuttle 製の Web フレームワーク 気になるので使ってみたい!
まとめ Rust 特化のプラットフォーム Infrastructure from Code が面白い 開発体験が良い 無料で色々試せる
None