From a5eb5cd1bc7c11897443a82f00ceb84a4d51d82a Mon Sep 17 00:00:00 2001 From: chesedo Date: Wed, 26 Oct 2022 13:07:48 +0200 Subject: [PATCH 1/2] refactor: fix up dependencies --- runtimes/legacy/Cargo.toml | 4 ++-- runtimes/legacy/src/main.rs | 4 ++-- runtimes/next/Cargo.toml | 2 +- runtimes/next/src/main.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runtimes/legacy/Cargo.toml b/runtimes/legacy/Cargo.toml index 57419bcbf..d4efe6d05 100644 --- a/runtimes/legacy/Cargo.toml +++ b/runtimes/legacy/Cargo.toml @@ -15,10 +15,10 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } [dependencies.shuttle-common] version = "0.7.0" -path = "../common" +path = "../../common" [dependencies.shuttle-service] version = "0.7.0" default-features = false features = ["loader"] -path = "../service" +path = "../../service" diff --git a/runtimes/legacy/src/main.rs b/runtimes/legacy/src/main.rs index a29754bc9..07c308d32 100644 --- a/runtimes/legacy/src/main.rs +++ b/runtimes/legacy/src/main.rs @@ -3,7 +3,7 @@ use std::{collections::BTreeMap, net::SocketAddr, path::PathBuf, str::FromStr}; use async_trait::async_trait; use clap::Parser; use shuttle_common::{database, LogItem}; -use shuttle_next::args::Args; +use shuttle_legacy::args::Args; use shuttle_service::{ loader::{LoadedService, Loader}, Factory, Logger, ServiceName, @@ -59,7 +59,7 @@ async fn load_service( so_path: PathBuf, factory: &mut dyn Factory, logger: Logger, -) -> shuttle_next::error::Result { +) -> shuttle_legacy::error::Result { let loader = Loader::from_so_file(so_path)?; Ok(loader.load(factory, addr, logger).await?) diff --git a/runtimes/next/Cargo.toml b/runtimes/next/Cargo.toml index 69e96b2fb..e690b670a 100644 --- a/runtimes/next/Cargo.toml +++ b/runtimes/next/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [[bin]] -name = "shuttle-runtime" +name = "shuttle-next" [dependencies] async-trait = "0.1.58" diff --git a/runtimes/next/src/main.rs b/runtimes/next/src/main.rs index f98d69e11..680c2018f 100644 --- a/runtimes/next/src/main.rs +++ b/runtimes/next/src/main.rs @@ -3,7 +3,7 @@ use std::io; use serenity::prelude::*; -use shuttle_runtime::Bot; +use shuttle_next::Bot; #[tokio::main] async fn main() -> io::Result<()> { From 7a9da76ab72ce7eec27130e125a2a4d2cc367d5c Mon Sep 17 00:00:00 2001 From: chesedo Date: Wed, 26 Oct 2022 13:31:37 +0200 Subject: [PATCH 2/2] feat: add --provisioner-address to both runtimes --- Cargo.lock | 14 -------------- Cargo.toml | 1 - runtimes/legacy/Cargo.toml | 1 + runtimes/legacy/src/args.rs | 5 +++++ runtimes/next/Cargo.toml | 3 ++- runtimes/next/src/args.rs | 9 +++++++++ runtimes/next/src/lib.rs | 2 ++ runtimes/next/src/main.rs | 9 +++++---- 8 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 runtimes/next/src/args.rs diff --git a/Cargo.lock b/Cargo.lock index c97d70c0a..da0b4fa99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5379,20 +5379,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "shuttle-next" -version = "0.1.0" -dependencies = [ - "async-trait", - "clap 4.0.18", - "shuttle-common", - "shuttle-service", - "thiserror", - "tokio", - "tracing", - "tracing-subscriber", -] - [[package]] name = "shuttle-proto" version = "0.7.0" diff --git a/Cargo.toml b/Cargo.toml index 242c6b9d4..eae7bbd14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ members = [ "common", "deployer", "gateway", - "next", "proto", "provisioner", "service" diff --git a/runtimes/legacy/Cargo.toml b/runtimes/legacy/Cargo.toml index d4efe6d05..20f0833a3 100644 --- a/runtimes/legacy/Cargo.toml +++ b/runtimes/legacy/Cargo.toml @@ -10,6 +10,7 @@ async-trait = "0.1.58" clap ={ version = "4.0.18", features = ["derive"] } thiserror = "1.0.37" tokio = { version = "=1.20.1", features = ["full"] } +tonic = "0.8.0" tracing = "0.1.37" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } diff --git a/runtimes/legacy/src/args.rs b/runtimes/legacy/src/args.rs index e435a3b2b..f35e2b96c 100644 --- a/runtimes/legacy/src/args.rs +++ b/runtimes/legacy/src/args.rs @@ -1,8 +1,13 @@ use clap::Parser; +use tonic::transport::Endpoint; #[derive(Parser, Debug)] pub struct Args { /// Uri to the `.so` file to load #[arg(long, short)] pub file_path: String, + + /// Address to reach provisioner at + #[clap(long, default_value = "localhost:5000")] + pub provisioner_address: Endpoint, } diff --git a/runtimes/next/Cargo.toml b/runtimes/next/Cargo.toml index e690b670a..924cbad3c 100644 --- a/runtimes/next/Cargo.toml +++ b/runtimes/next/Cargo.toml @@ -10,8 +10,9 @@ name = "shuttle-next" [dependencies] async-trait = "0.1.58" - +clap ={ version = "4.0.18", features = ["derive"] } tokio = { version = "1.20.1", features = [ "full" ] } +tonic = "0.8.0" cap-std = "*" wasmtime = "*" diff --git a/runtimes/next/src/args.rs b/runtimes/next/src/args.rs new file mode 100644 index 000000000..2a2455e3a --- /dev/null +++ b/runtimes/next/src/args.rs @@ -0,0 +1,9 @@ +use clap::Parser; +use tonic::transport::Endpoint; + +#[derive(Parser, Debug)] +pub struct Args { + /// Address to reach provisioner at + #[clap(long, default_value = "localhost:5000")] + pub provisioner_address: Endpoint, +} diff --git a/runtimes/next/src/lib.rs b/runtimes/next/src/lib.rs index d806b4a98..cce82eb43 100644 --- a/runtimes/next/src/lib.rs +++ b/runtimes/next/src/lib.rs @@ -1,3 +1,5 @@ +pub mod args; + use std::fs::File; use std::io::{Read, Write}; use std::os::unix::prelude::RawFd; diff --git a/runtimes/next/src/main.rs b/runtimes/next/src/main.rs index 680c2018f..62a00847d 100644 --- a/runtimes/next/src/main.rs +++ b/runtimes/next/src/main.rs @@ -1,12 +1,13 @@ +use clap::Parser; +use serenity::prelude::*; +use shuttle_next::{args::Args, Bot}; use std::env; use std::io; -use serenity::prelude::*; - -use shuttle_next::Bot; - #[tokio::main] async fn main() -> io::Result<()> { + let _args = Args::parse(); + let intents = GatewayIntents::GUILD_MESSAGES | GatewayIntents::MESSAGE_CONTENT; let token = env::var("DISCORD_TOKEN").unwrap();