forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sui-node: replace validator binary with sui-node
- Loading branch information
Showing
6 changed files
with
116 additions
and
100 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,20 @@ | ||
[package] | ||
name = "sui-node" | ||
version = "0.0.0" | ||
authors = ["Mysten Labs <[email protected]>"] | ||
license = "Apache-2.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[dependencies] | ||
anyhow = { version = "1.0.57", features = ["backtrace"] } | ||
clap = { version = "3.1.17", features = ["derive"] } | ||
multiaddr = "0.14.0" | ||
prometheus_exporter = "0.8.4" | ||
tokio = { version = "1.18.2", features = ["full"] } | ||
tracing = "0.1.34" | ||
|
||
sui-config = { path = "../sui-config" } | ||
sui_core = { path = "../../sui_core" } | ||
|
||
telemetry-subscribers = { git = "https://github.com/MystenLabs/mysten-infra", rev = "7c247967e5a5abd59ecaa75bc62b05bcdf4503fe" } |
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,29 @@ | ||
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use anyhow::Result; | ||
use sui_config::ValidatorConfig; | ||
use sui_core::authority_server::AuthorityServerHandle; | ||
use tracing::info; | ||
|
||
pub struct SuiNode { | ||
authority_server: AuthorityServerHandle, | ||
} | ||
|
||
impl SuiNode { | ||
pub async fn start(config: &ValidatorConfig) -> Result<()> { | ||
let server = sui_core::make::make_server(config).await?.spawn().await?; | ||
|
||
info!(node =? config.public_key(), | ||
"Initializing sui-node listening on {}", config.network_address | ||
); | ||
|
||
let node = SuiNode { | ||
authority_server: server, | ||
}; | ||
|
||
node.authority_server.join().await?; | ||
|
||
Ok(()) | ||
} | ||
} |
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,51 @@ | ||
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use anyhow::Result; | ||
use clap::Parser; | ||
use multiaddr::Multiaddr; | ||
use std::path::PathBuf; | ||
use sui_config::{PersistedConfig, ValidatorConfig}; | ||
use tracing::info; | ||
|
||
const PROM_PORT_ADDR: &str = "0.0.0.0:9184"; | ||
|
||
#[derive(Parser)] | ||
#[clap(rename_all = "kebab-case")] | ||
struct Args { | ||
#[clap(long)] | ||
pub config_path: PathBuf, | ||
|
||
#[clap(long, help = "Specify address to listen on")] | ||
listen_address: Option<Multiaddr>, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
// Initialize logging | ||
let config = telemetry_subscribers::TelemetryConfig { | ||
service_name: "sui-node".into(), | ||
enable_tracing: std::env::var("SUI_TRACING_ENABLE").is_ok(), | ||
json_log_output: std::env::var("SUI_JSON_SPAN_LOGS").is_ok(), | ||
..Default::default() | ||
}; | ||
|
||
let _guard = telemetry_subscribers::init(config); | ||
|
||
let args = Args::parse(); | ||
|
||
let mut config = PersistedConfig::<ValidatorConfig>::read(&args.config_path)?; | ||
|
||
// TODO: Switch from prometheus exporter. See https://github.com/MystenLabs/sui/issues/1907 | ||
let prom_binding = PROM_PORT_ADDR.parse().unwrap(); | ||
info!("Starting Prometheus HTTP endpoint at {}", PROM_PORT_ADDR); | ||
prometheus_exporter::start(prom_binding).expect("Failed to start Prometheus exporter"); | ||
|
||
if let Some(listen_address) = args.listen_address { | ||
config.network_address = listen_address; | ||
} | ||
|
||
sui_node::SuiNode::start(&config).await?; | ||
|
||
Ok(()) | ||
} |
This file was deleted.
Oops, something went wrong.