Extend orchestration as actually needed for testnet

Contains various bug fixes.
This commit is contained in:
Luke Parker 2024-03-22 16:06:56 -04:00
parent 2f07d04d88
commit 6658d95c85
No known key found for this signature in database
6 changed files with 41 additions and 13 deletions

View file

@ -11,7 +11,7 @@ pub fn coordinator(
orchestration_path: &Path,
network: Network,
coordinator_key: Zeroizing<<Ristretto as Ciphersuite>::F>,
serai_key: Zeroizing<<Ristretto as Ciphersuite>::F>,
serai_key: &Zeroizing<<Ristretto as Ciphersuite>::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 {

View file

@ -276,9 +276,9 @@ fn dockerfiles(network: Network) {
Zeroizing::new(<Ristretto as Ciphersuite>::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<String>) {
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!(

View file

@ -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 {

View file

@ -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 {

View file

@ -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<<Ristretto as Ciphersuite>::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(),
);

View file

@ -1,3 +1,3 @@
#!/bin/sh
exit 1
serai-node --unsafe-rpc-external --rpc-cors all --chain testnet --validator