mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-03 09:29:46 +00:00
Extend orchestration as actually needed for testnet
Contains various bug fixes.
This commit is contained in:
parent
2f07d04d88
commit
6658d95c85
6 changed files with 41 additions and 13 deletions
|
@ -11,7 +11,7 @@ pub fn coordinator(
|
||||||
orchestration_path: &Path,
|
orchestration_path: &Path,
|
||||||
network: Network,
|
network: Network,
|
||||||
coordinator_key: Zeroizing<<Ristretto as Ciphersuite>::F>,
|
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 db = network.db();
|
||||||
let longer_reattempts = if network == Network::Dev { "longer-reattempts" } else { "" };
|
let longer_reattempts = if network == Network::Dev { "longer-reattempts" } else { "" };
|
||||||
|
@ -27,13 +27,16 @@ pub fn coordinator(
|
||||||
RUN apt install -y ca-certificates
|
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 = [
|
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(coordinator_key.to_repr())),
|
("MESSAGE_QUEUE_KEY", hex::encode(coordinator_key.to_repr())),
|
||||||
("DB_PATH", "./coordinator-db".to_string()),
|
("DB_PATH", "./coordinator-db".to_string()),
|
||||||
("SERAI_KEY", hex::encode(serai_key.to_repr())),
|
("SERAI_KEY", hex::encode(serai_key.to_repr())),
|
||||||
("SERAI_HOSTNAME", format!("serai-{}-serai", network.label())),
|
("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();
|
let mut env_vars_str = String::new();
|
||||||
for (env_var, value) in env_vars {
|
for (env_var, value) in env_vars {
|
||||||
|
|
|
@ -276,9 +276,9 @@ fn dockerfiles(network: Network) {
|
||||||
Zeroizing::new(<Ristretto as Ciphersuite>::F::from_repr(*serai_key_repr).unwrap())
|
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) {
|
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");
|
assert_eq!(network, Network::Dev, "monero-wallet-rpc is only for dev");
|
||||||
command.arg("-p").arg("18082:18082")
|
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,
|
_ => command,
|
||||||
};
|
};
|
||||||
assert!(
|
assert!(
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub fn message_queue(
|
||||||
("ETHEREUM_KEY", hex::encode(ethereum_key.to_bytes())),
|
("ETHEREUM_KEY", hex::encode(ethereum_key.to_bytes())),
|
||||||
("MONERO_KEY", hex::encode(monero_key.to_bytes())),
|
("MONERO_KEY", hex::encode(monero_key.to_bytes())),
|
||||||
("DB_PATH", "./message-queue-db".to_string()),
|
("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();
|
let mut env_vars_str = String::new();
|
||||||
for (env_var, value) in env_vars {
|
for (env_var, value) in env_vars {
|
||||||
|
|
|
@ -40,7 +40,7 @@ RUN apt install -y ca-certificates
|
||||||
};
|
};
|
||||||
|
|
||||||
let env_vars = [
|
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())),
|
("MESSAGE_QUEUE_KEY", hex::encode(coin_key.to_repr())),
|
||||||
("ENTROPY", hex::encode(entropy.as_ref())),
|
("ENTROPY", hex::encode(entropy.as_ref())),
|
||||||
("NETWORK", coin.to_string()),
|
("NETWORK", coin.to_string()),
|
||||||
|
@ -48,7 +48,7 @@ RUN apt install -y ca-certificates
|
||||||
("NETWORK_RPC_HOSTNAME", hostname),
|
("NETWORK_RPC_HOSTNAME", hostname),
|
||||||
("NETWORK_RPC_PORT", format!("{port}")),
|
("NETWORK_RPC_PORT", format!("{port}")),
|
||||||
("DB_PATH", "./processor-db".to_string()),
|
("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();
|
let mut env_vars_str = String::new();
|
||||||
for (env_var, value) in env_vars {
|
for (env_var, value) in env_vars {
|
||||||
|
|
|
@ -1,14 +1,26 @@
|
||||||
use std::{path::Path};
|
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};
|
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
|
// Always builds in release for performance reasons
|
||||||
let setup = mimalloc(Os::Debian).to_string() + &build_serai_service(true, "", "serai-node");
|
let setup = mimalloc(Os::Debian).to_string() + &build_serai_service(true, "", "serai-node");
|
||||||
let setup_fast_epoch =
|
let setup_fast_epoch =
|
||||||
mimalloc(Os::Debian).to_string() + &build_serai_service(true, "fast-epoch", "serai-node");
|
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!(
|
let run_serai = format!(
|
||||||
r#"
|
r#"
|
||||||
# Copy the Serai binary and relevant license
|
# 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 .
|
COPY --from=builder --chown=serai /serai/AGPL-3.0 .
|
||||||
|
|
||||||
# Run the Serai node
|
# Run the Serai node
|
||||||
EXPOSE 30333 9615 9933 9944
|
EXPOSE 30333 9944
|
||||||
|
|
||||||
ADD /orchestration/{}/serai/run.sh /
|
ADD /orchestration/{}/serai/run.sh /
|
||||||
CMD ["/run.sh"]
|
CMD {env_vars_str} "/run.sh"
|
||||||
"#,
|
"#,
|
||||||
network.label(),
|
network.label(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
exit 1
|
serai-node --unsafe-rpc-external --rpc-cors all --chain testnet --validator
|
||||||
|
|
Loading…
Reference in a new issue