diff --git a/orchestration/src/coordinator.rs b/orchestration/src/coordinator.rs index a8556a00..9995dbbf 100644 --- a/orchestration/src/coordinator.rs +++ b/orchestration/src/coordinator.rs @@ -11,7 +11,7 @@ pub fn coordinator( orchestration_path: &Path, network: Network, coordinator_key: Zeroizing<::F>, - serai_key: Zeroizing<::F>, + serai_key: &Zeroizing<::F>, ) { let db = network.db(); let longer_reattempts = if network == Network::Dev { "longer-reattempts" } else { "" }; @@ -27,13 +27,16 @@ pub fn coordinator( RUN apt install -y ca-certificates "#; + #[rustfmt::skip] + const DEFAULT_RUST_LOG: &str = "info,serai_coordinator=debug,tributary_chain=debug,tendermint=debug,libp2p_gossipsub::behaviour=error"; + let env_vars = [ ("MESSAGE_QUEUE_RPC", format!("serai-{}-message-queue", network.label())), ("MESSAGE_QUEUE_KEY", hex::encode(coordinator_key.to_repr())), ("DB_PATH", "./coordinator-db".to_string()), ("SERAI_KEY", hex::encode(serai_key.to_repr())), ("SERAI_HOSTNAME", format!("serai-{}-serai", network.label())), - ("RUST_LOG", "serai_coordinator=debug,tributary_chain=debug,tendermint=debug".to_string()), + ("RUST_LOG", DEFAULT_RUST_LOG.to_string()), ]; let mut env_vars_str = String::new(); for (env_var, value) in env_vars { diff --git a/orchestration/src/main.rs b/orchestration/src/main.rs index a2533c49..548aca8b 100644 --- a/orchestration/src/main.rs +++ b/orchestration/src/main.rs @@ -276,9 +276,9 @@ fn dockerfiles(network: Network) { Zeroizing::new(::F::from_repr(*serai_key_repr).unwrap()) }; - coordinator(&orchestration_path, network, coordinator_key.0, serai_key); + coordinator(&orchestration_path, network, coordinator_key.0, &serai_key); - serai(&orchestration_path, network); + serai(&orchestration_path, network, &serai_key); } fn key_gen(network: Network) { @@ -448,7 +448,20 @@ fn start(network: Network, services: HashSet) { assert_eq!(network, Network::Dev, "monero-wallet-rpc is only for dev"); command.arg("-p").arg("18082:18082") } - "serai" => command.arg("--volume").arg(format!("{serai_runtime_volume}:/runtime")), + "coordinator" => { + if network != Network::Dev { + command.arg("-p").arg("30563:30563") + } else { + command + } + } + "serai" => { + let mut command = command; + if network != Network::Dev { + command = command.arg("-p").arg("30333:30333"); + } + command.arg("--volume").arg(format!("{serai_runtime_volume}:/runtime")) + } _ => command, }; assert!( diff --git a/orchestration/src/message_queue.rs b/orchestration/src/message_queue.rs index ef6bdcbf..3e47571c 100644 --- a/orchestration/src/message_queue.rs +++ b/orchestration/src/message_queue.rs @@ -21,7 +21,7 @@ pub fn message_queue( ("ETHEREUM_KEY", hex::encode(ethereum_key.to_bytes())), ("MONERO_KEY", hex::encode(monero_key.to_bytes())), ("DB_PATH", "./message-queue-db".to_string()), - ("RUST_LOG", "serai_message_queue=trace".to_string()), + ("RUST_LOG", "info,serai_message_queue=trace".to_string()), ]; let mut env_vars_str = String::new(); for (env_var, value) in env_vars { diff --git a/orchestration/src/processor.rs b/orchestration/src/processor.rs index e2afde09..3d76a6c9 100644 --- a/orchestration/src/processor.rs +++ b/orchestration/src/processor.rs @@ -40,7 +40,7 @@ RUN apt install -y ca-certificates }; let env_vars = [ - ("MESSAGE_QUEUE_RPC", format!("serai-{}-message_queue", network.label())), + ("MESSAGE_QUEUE_RPC", format!("serai-{}-message-queue", network.label())), ("MESSAGE_QUEUE_KEY", hex::encode(coin_key.to_repr())), ("ENTROPY", hex::encode(entropy.as_ref())), ("NETWORK", coin.to_string()), @@ -48,7 +48,7 @@ RUN apt install -y ca-certificates ("NETWORK_RPC_HOSTNAME", hostname), ("NETWORK_RPC_PORT", format!("{port}")), ("DB_PATH", "./processor-db".to_string()), - ("RUST_LOG", "serai_processor=debug".to_string()), + ("RUST_LOG", "info,serai_processor=debug".to_string()), ]; let mut env_vars_str = String::new(); for (env_var, value) in env_vars { diff --git a/orchestration/src/serai.rs b/orchestration/src/serai.rs index 74fa78e6..1487b70d 100644 --- a/orchestration/src/serai.rs +++ b/orchestration/src/serai.rs @@ -1,14 +1,26 @@ use std::{path::Path}; +use zeroize::Zeroizing; +use ciphersuite::{group::ff::PrimeField, Ciphersuite, Ristretto}; + use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile}; -pub fn serai(orchestration_path: &Path, network: Network) { +pub fn serai( + orchestration_path: &Path, + network: Network, + serai_key: &Zeroizing<::F>, +) { // Always builds in release for performance reasons let setup = mimalloc(Os::Debian).to_string() + &build_serai_service(true, "", "serai-node"); let setup_fast_epoch = mimalloc(Os::Debian).to_string() + &build_serai_service(true, "fast-epoch", "serai-node"); - // TODO: Review the ports exposed here + let env_vars = [("KEY", hex::encode(serai_key.to_repr()))]; + let mut env_vars_str = String::new(); + for (env_var, value) in env_vars { + env_vars_str += &format!(r#"{env_var}=${{{env_var}}}:="{value}"}} "#); + } + let run_serai = format!( r#" # Copy the Serai binary and relevant license @@ -16,10 +28,10 @@ COPY --from=builder --chown=serai /serai/bin/serai-node /bin/ COPY --from=builder --chown=serai /serai/AGPL-3.0 . # Run the Serai node -EXPOSE 30333 9615 9933 9944 +EXPOSE 30333 9944 ADD /orchestration/{}/serai/run.sh / -CMD ["/run.sh"] +CMD {env_vars_str} "/run.sh" "#, network.label(), ); diff --git a/orchestration/testnet/serai/run.sh b/orchestration/testnet/serai/run.sh index 2bb8d868..7400ff50 100755 --- a/orchestration/testnet/serai/run.sh +++ b/orchestration/testnet/serai/run.sh @@ -1,3 +1,3 @@ #!/bin/sh -exit 1 +serai-node --unsafe-rpc-external --rpc-cors all --chain testnet --validator