-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extract next runtime into separate binary (#679)
* feat: extract next runtime into separate binary * fix: remove startrequestsservice name
- Loading branch information
Showing
12 changed files
with
82 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::{ | ||
net::{Ipv4Addr, SocketAddr}, | ||
time::Duration, | ||
}; | ||
|
||
use clap::Parser; | ||
use shuttle_proto::runtime::runtime_server::RuntimeServer; | ||
use shuttle_runtime::{AxumWasm, NextArgs}; | ||
use tonic::transport::Server; | ||
use tracing::trace; | ||
use tracing_subscriber::{fmt, prelude::*, EnvFilter}; | ||
|
||
#[tokio::main(flavor = "multi_thread")] | ||
async fn main() { | ||
let args = NextArgs::parse(); | ||
|
||
// TODO: replace with tracing helper from main branch | ||
let fmt_layer = fmt::layer(); | ||
let filter_layer = EnvFilter::try_from_default_env() | ||
.or_else(|_| EnvFilter::try_new("info")) | ||
.unwrap(); | ||
|
||
tracing_subscriber::registry() | ||
.with(filter_layer) | ||
.with(fmt_layer) | ||
.init(); | ||
|
||
trace!(args = ?args, "parsed args"); | ||
|
||
let addr = SocketAddr::new(Ipv4Addr::LOCALHOST.into(), args.port); | ||
|
||
let mut server_builder = | ||
Server::builder().http2_keepalive_interval(Some(Duration::from_secs(60))); | ||
|
||
let axum = AxumWasm::default(); | ||
let svc = RuntimeServer::new(axum); | ||
let router = server_builder.add_service(svc); | ||
|
||
router.serve(addr).await.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
mod args; | ||
mod axum; | ||
mod legacy; | ||
mod next; | ||
mod provisioner_factory; | ||
|
||
pub use args::{Args, StorageManagerType}; | ||
pub use axum::AxumWasm; | ||
pub use legacy::{start, Legacy}; | ||
pub use next::AxumWasm; | ||
pub use next::NextArgs; | ||
pub use provisioner_factory::ProvisionerFactory; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(version)] | ||
pub struct NextArgs { | ||
/// Port to start runtime on | ||
#[arg(long)] | ||
pub port: u16, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters