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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
codemountains
December 19, 2023
Programming
1
280
Shuttle で Rust アプリケーションを爆速デプロイ
UV Study : Rust LT会(2023.12.19)での登壇資料「Shuttle で Rust アプリケーションを爆速デプロイ」です。
codemountains
December 19, 2023
Tweet
Share
More Decks by codemountains
See All by codemountains
API ファーストな CMS の世界
codemountains
0
59
Rust | axum でモック用の API サーバーを起動できる CLI ツール作ってみた
codemountains
0
59
Rust.Nagoya #1
codemountains
0
450
Momento Deep Dive - 真のサーバーレスとは?
codemountains
0
770
Rust 製エディタ Zed を布教したい
codemountains
0
850
kintone Night Nagoya vol.12 - kintone x Collaboflow で評価日報
codemountains
0
53
LINE WORKS と 生成 AI ~Claude 3 と LangChain~
codemountains
0
950
Amazon S3 Express One Zone & AWS re:Invent 2023 現地体験談
codemountains
0
1.5k
Postman CLI で Integration Test
codemountains
2
1.1k
Other Decks in Programming
See All in Programming
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
420
AHC061解説
shun_pi
0
370
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
140
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
encoding/json/v2のUnmarshalはこう変わった:内部実装で見る設計改善
kurakura0916
0
410
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
220
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.7k
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
180
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.1k
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
260
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
830
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8k
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
12k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Bash Introduction
62gerente
615
210k
Un-Boring Meetings
codingconduct
0
220
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
61
52k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
250
Facilitating Awesome Meetings
lara
57
6.8k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
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