RustのRocketアプリをrenderにデプロイする
下記のような超シンプルな Rocket アプリを render にデプロイしてみます。
#[macro_use]extern crate rocket;
#[get("/")]fn index() -> &'static str { "Hello, world!"}
#[launch]fn rocket() -> _ { rocket::build().mount("/", routes![index])}ここを参考に、下記の設定でデプロイをしましたが、タイムアウトで失敗しました。
- Runtime: Rust
- Build Command:
cargo build --release - Start Command:
cargo run --release
ここに有料の場合、127.0.0.1ではなく、0.0.0.0にバインドさせる必要があると書いてありました。 そこで、ここを参考に、Rocket.toml のaddressを0.0.0.0にしたら、デプロイ成功しました!
[default]address = "0.0.0.0"