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
58
Rust.Nagoya #1
codemountains
0
450
Momento Deep Dive - 真のサーバーレスとは?
codemountains
0
760
Rust 製エディタ Zed を布教したい
codemountains
0
840
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
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
4
470
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
190
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
200
AIプロダクト時代のQAエンジニアに求められること
imtnd
2
650
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
190
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.3k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
180
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
8
2.4k
TipKitTips
ktcryomm
0
150
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1.1k
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
93
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
51k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
80
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Context Engineering - Making Every Token Count
addyosmani
9
730
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
210
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
140
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
450
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