fix(compose): pass deployment config explicitly from cfgsync

This commit is contained in:
andrussal 2026-03-03 08:02:30 +01:00
parent a099392fdd
commit 10a68419f9
3 changed files with 23 additions and 9 deletions

View File

@ -59,6 +59,7 @@ check_binary_arch "$bin_path" "logos-blockchain-${role}"
host_identifier_default="${role}-$(hostname -i)"
export CFG_FILE_PATH="/config.yaml" \
CFG_DEPLOYMENT_FILE_PATH="/deployment.yaml" \
CFG_SERVER_ADDR="${CFG_SERVER_ADDR:-http://cfgsync:${LOGOS_BLOCKCHAIN_CFGSYNC_PORT:-4400}}" \
CFG_HOST_IP=$(hostname -i) \
CFG_HOST_KIND="${CFG_HOST_KIND:-$role}" \
@ -86,4 +87,4 @@ until "${cfgsync_bin}"; do
sleep "$sleep_seconds"
done
exec "${bin_path}" /config.yaml
exec "${bin_path}" /config.yaml --deployment /deployment.yaml

View File

@ -96,14 +96,6 @@ build_test_image::parse_args() {
TAR_PATH="${BUNDLE_TAR_PATH:-${DEFAULT_LINUX_TAR}}"
LOGOS_BLOCKCHAIN_NODE_PATH="${LOGOS_BLOCKCHAIN_NODE_PATH:-}"
if [ -z "${LOGOS_BLOCKCHAIN_NODE_PATH}" ]; then
# Prefer local checkout when available: this repo currently depends on
# lb-framework from nomos-node/tests/testing_framework.
local sibling_node_path="${ROOT_DIR}/../nomos-node"
if [ -d "${sibling_node_path}/tests/testing_framework" ]; then
LOGOS_BLOCKCHAIN_NODE_PATH="${sibling_node_path}"
fi
fi
if [ -n "${LOGOS_BLOCKCHAIN_NODE_PATH}" ] && [ ! -d "${LOGOS_BLOCKCHAIN_NODE_PATH}" ]; then
build_test_image::fail "LOGOS_BLOCKCHAIN_NODE_PATH does not exist: ${LOGOS_BLOCKCHAIN_NODE_PATH}"
fi

View File

@ -55,10 +55,31 @@ async fn pull_to_file(payload: ClientIp, server_addr: &str, config_file: &str) -
fs::write(config_file, &config.config_yaml)
.with_context(|| format!("writing config to {}", config_file))?;
if let Ok(deployment_file_path) = env::var("CFG_DEPLOYMENT_FILE_PATH") {
write_deployment_config(&config.config_yaml, &deployment_file_path)?;
}
println!("Config saved to {config_file}");
Ok(())
}
fn write_deployment_config(config_yaml: &str, deployment_file_path: &str) -> Result<()> {
let document: serde_yaml::Value =
serde_yaml::from_str(config_yaml).context("parsing fetched config yaml")?;
let deployment = document
.get("deployment")
.cloned()
.context("fetched config yaml does not contain `deployment` key")?;
let deployment_yaml =
serde_yaml::to_string(&deployment).context("serializing deployment yaml")?;
fs::write(deployment_file_path, deployment_yaml)
.with_context(|| format!("writing deployment config to {deployment_file_path}"))?;
println!("Deployment config saved to {deployment_file_path}");
Ok(())
}
pub async fn run_cfgsync_client_from_env(default_port: u16) -> Result<()> {
let config_file_path = env::var("CFG_FILE_PATH").unwrap_or_else(|_| "config.yaml".to_owned());
let server_addr =