Add dummy binary (#5)
* add dummy binary * add flags for macos * add metrics service * rename Services to Nomos
This commit is contained in:
parent
4d43c18846
commit
cfcc664e9e
|
@ -6,5 +6,6 @@ members = [
|
|||
"nomos-services/network",
|
||||
"nomos-services/storage",
|
||||
"nomos-services/consensus",
|
||||
"nomos-services/mempool"
|
||||
"nomos-services/mempool",
|
||||
"nomos-node"
|
||||
]
|
|
@ -0,0 +1,4 @@
|
|||
[target.'cfg(target_os = "macos")']
|
||||
# when using osx, we need to link against some golang libraries, it did just work with this missing flags
|
||||
# from: https://github.com/golang/go/issues/42459
|
||||
rustflags = ["-C", "link-args=-framework CoreFoundation -framework Security"]
|
|
@ -0,0 +1,19 @@
|
|||
[package]
|
||||
name = "nomos-node"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
overwatch-rs = { git = "https://github.com/logos-co/Overwatch", branch = "main" }
|
||||
overwatch-derive = { git = "https://github.com/logos-co/Overwatch", branch = "main" }
|
||||
tracing = "0.1"
|
||||
nomos-network = { path = "../nomos-services/network", features = ["waku"] }
|
||||
metrics = { path = "../nomos-services/metrics", optional = true }
|
||||
nomos-log = { path = "../nomos-services/log" }
|
||||
tracing-subscriber = "0.3"
|
||||
serde_yaml = "0.9"
|
||||
color-eyre = "0.6.0"
|
||||
serde = "1"
|
|
@ -0,0 +1,55 @@
|
|||
use clap::Parser;
|
||||
use color_eyre::eyre::{eyre, Result};
|
||||
use nomos_log::Logger;
|
||||
use nomos_network::{backends::waku::Waku, NetworkService};
|
||||
use overwatch_derive::*;
|
||||
use overwatch_rs::{
|
||||
overwatch::*,
|
||||
services::{handle::ServiceHandle, ServiceData},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[cfg(feature = "metrics")]
|
||||
use metrics::{backend::map::MapMetricsBackend, types::MetricsData, MetricsService};
|
||||
|
||||
/// Simple program to greet a person
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// Path for a yaml-encoded network config file
|
||||
config: std::path::PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Config {
|
||||
log: <Logger as ServiceData>::Settings,
|
||||
network: <NetworkService<Waku> as ServiceData>::Settings,
|
||||
#[cfg(feature = "metrics")]
|
||||
metrics: <MetricsService<MapMetricsBackend<MetricsData>> as ServiceData>::Settings,
|
||||
}
|
||||
|
||||
#[derive(Services)]
|
||||
struct Nomos {
|
||||
logging: ServiceHandle<Logger>,
|
||||
network: ServiceHandle<NetworkService<Waku>>,
|
||||
#[cfg(feature = "metrics")]
|
||||
metrics: ServiceHandle<MetricsService<MapMetricsBackend<MetricsData>>>,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
let Args { config } = Args::parse();
|
||||
let config = serde_yaml::from_reader::<_, Config>(std::fs::File::open(config)?)?;
|
||||
let app = OverwatchRunner::<Nomos>::run(
|
||||
NomosServiceSettings {
|
||||
network: config.network,
|
||||
logging: config.log,
|
||||
#[cfg(feature = "metrics")]
|
||||
metrics: config.metrics,
|
||||
},
|
||||
None,
|
||||
)
|
||||
.map_err(|e| eyre!("Error encountered: {}", e))?;
|
||||
app.wait_finished();
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue