Only use Alpine when not using RocksDB

This commit is contained in:
Luke Parker 2024-02-09 04:57:21 -05:00
parent e3a789fc9f
commit a3345ed194
No known key found for this signature in database
3 changed files with 30 additions and 13 deletions

View file

@ -14,19 +14,27 @@ pub fn coordinator(
serai_key: Zeroizing<<Ristretto as Ciphersuite>::F>, serai_key: Zeroizing<<Ristretto as Ciphersuite>::F>,
) { ) {
let db = network.db(); let db = network.db();
let os_to_use = if db == "parity-db" { Os::Alpine } else { Os::Debian };
let longer_reattempts = if network == Network::Dev { "longer-reattempts" } else { "" }; let longer_reattempts = if network == Network::Dev { "longer-reattempts" } else { "" };
let setup = mimalloc(Os::Alpine).to_string() + let setup = mimalloc(os_to_use).to_string() +
&build_serai_service( &build_serai_service(
Os::Alpine, os_to_use,
network.release(), network.release(),
&format!("{db} {longer_reattempts}"), &format!("{db} {longer_reattempts}"),
"serai-coordinator", "serai-coordinator",
); );
const ADDITIONAL_ROOT: &str = r#" let additional_root = if os_to_use == Os::Alpine {
r#"
# Install ca-certificates # Install ca-certificates
RUN apk add ca-certificates RUN apk add ca-certificates
"#; "#
} else {
r#"
# Install ca-certificates
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())),
@ -52,7 +60,7 @@ CMD {env_vars_str} serai-coordinator
"# "#
); );
let run = os(Os::Alpine, ADDITIONAL_ROOT, "coordinator") + &run_coordinator; let run = os(os_to_use, additional_root, "coordinator") + &run_coordinator;
let res = setup + &run; let res = setup + &run;
let mut coordinator_path = orchestration_path.to_path_buf(); let mut coordinator_path = orchestration_path.to_path_buf();

View file

@ -12,8 +12,9 @@ pub fn message_queue(
ethereum_key: <Ristretto as Ciphersuite>::G, ethereum_key: <Ristretto as Ciphersuite>::G,
monero_key: <Ristretto as Ciphersuite>::G, monero_key: <Ristretto as Ciphersuite>::G,
) { ) {
let setup = mimalloc(Os::Alpine).to_string() + let os_to_use = if network.db() == "parity-db" { Os::Alpine } else { Os::Debian };
&build_serai_service(Os::Alpine, network.release(), network.db(), "serai-message-queue"); let setup = mimalloc(os_to_use).to_string() +
&build_serai_service(os_to_use, network.release(), network.db(), "serai-message-queue");
let env_vars = [ let env_vars = [
("COORDINATOR_KEY", hex::encode(coordinator_key.to_bytes())), ("COORDINATOR_KEY", hex::encode(coordinator_key.to_bytes())),
@ -40,7 +41,7 @@ CMD {env_vars_str} serai-message-queue
"# "#
); );
let run = os(Os::Alpine, "", "messagequeue") + &run_message_queue; let run = os(os_to_use, "", "messagequeue") + &run_message_queue;
let res = setup + &run; let res = setup + &run;
let mut message_queue_path = orchestration_path.to_path_buf(); let mut message_queue_path = orchestration_path.to_path_buf();

View file

@ -15,18 +15,26 @@ pub fn processor(
coin_key: Zeroizing<<Ristretto as Ciphersuite>::F>, coin_key: Zeroizing<<Ristretto as Ciphersuite>::F>,
entropy: Zeroizing<[u8; 32]>, entropy: Zeroizing<[u8; 32]>,
) { ) {
let setup = mimalloc(Os::Alpine).to_string() + let os_to_use = if network.db() == "parity-db" { Os::Alpine } else { Os::Debian };
let setup = mimalloc(os_to_use).to_string() +
&build_serai_service( &build_serai_service(
Os::Alpine, os_to_use,
network.release(), network.release(),
&format!("binaries {} {coin}", network.db()), &format!("binaries {} {coin}", network.db()),
"serai-processor", "serai-processor",
); );
const ADDITIONAL_ROOT: &str = r#" let additional_root = if os_to_use == Os::Alpine {
r#"
# Install ca-certificates # Install ca-certificates
RUN apk add ca-certificates RUN apk add ca-certificates
"#; "#
} else {
r#"
# Install ca-certificates
RUN apt install -y ca-certificates
"#
};
// TODO: Randomly generate these // TODO: Randomly generate these
const RPC_USER: &str = "serai"; const RPC_USER: &str = "serai";
@ -67,7 +75,7 @@ CMD {env_vars_str} serai-processor
"# "#
); );
let run = os(Os::Alpine, ADDITIONAL_ROOT, "processor") + &run_processor; let run = os(os_to_use, additional_root, "processor") + &run_processor;
let res = setup + &run; let res = setup + &run;
let mut processor_path = orchestration_path.to_path_buf(); let mut processor_path = orchestration_path.to_path_buf();