mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-02-17 19:53:05 +00:00
* Add node config overrides (#14) * chore: merge master into dev and update configs after merge (#17) * Sdp config structs from logos blockchain (#15) * Update configs after main repo merge --------- Co-authored-by: gusto <bacv@users.noreply.github.com> * Local deployer allows to stop and restart nodes (#16) * Unify local node control and restart support * Add local stop-node support * Use node names for restart/stop control * merge --------- Co-authored-by: hansieodendaal <hansie.odendaal@gmail.com> * Add orphan manual cluster test utilities * Update node rev and align consensus/wallet config * Update node rev and align wallet/KMS configs * Update main repo ref (#23) * Fix genesis utxos and scale leader stake * Document leader stake constants * feat: add custom persistent dir option for working files (#26) * chore: config and naming updates (#27) * Update config and crate naming - Updated configs to the lates main repo configs. - Updated all main repo crate namings to be same as the main repo. - Added `create_dir_all` to `pub(crate) fn create_tempdir(custom_work_dir: Option<PathBuf>) -> std::io::Result<TempDir> {`. - Wired in optional `persist_dir` when using the local deployer. - Update `time` vulnerability **Note:** Unsure about the `service_params` mapping in `pub(crate) fn cryptarchia_deployment(config: &GeneralConfig) -> CryptarchiaDeploymentSettings {` * fix ntp server config --------- Co-authored-by: Andrus Salumets <andrus@status.im> Co-authored-by: gusto <bacv@users.noreply.github.com> Co-authored-by: andrussal <salumets.andrus@gmail.com>
72 lines
2.2 KiB
Bash
Executable File
72 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
role="${1:-node}"
|
|
|
|
bin_for_role() {
|
|
case "$1" in
|
|
node) echo "/usr/bin/logos-blockchain-node" ;;
|
|
*) echo "Unknown role: $1" >&2; exit 2 ;;
|
|
esac
|
|
}
|
|
|
|
check_binary_arch() {
|
|
bin_path="$1"
|
|
label="$2"
|
|
if ! command -v file >/dev/null 2>&1; then
|
|
echo "Warning: 'file' command not available; skipping ${label} arch check" >&2
|
|
return
|
|
fi
|
|
bin_info="$(file -b "${bin_path}" 2>/dev/null || true)"
|
|
host_arch="$(uname -m)"
|
|
case "$bin_info" in
|
|
*"Mach-O"*) echo "${label} binary is Mach-O (host bundle) but container requires Linux ELF for ${host_arch}" >&2; exit 126 ;;
|
|
*"ELF"*) : ;;
|
|
*) echo "${label} binary missing or unreadable; info='${bin_info}'" >&2; exit 126 ;;
|
|
esac
|
|
case "$host_arch" in
|
|
x86_64) expected="x86-64|x86_64" ;;
|
|
aarch64|arm64) expected="arm64|aarch64" ;;
|
|
*) expected="" ;;
|
|
esac
|
|
if [ -n "$expected" ] && ! echo "$bin_info" | grep -Eqi "$expected"; then
|
|
echo "${label} binary architecture mismatch: host=${host_arch}, file='${bin_info}'" >&2
|
|
exit 126
|
|
fi
|
|
}
|
|
|
|
bin_path="$(bin_for_role "$role")"
|
|
check_binary_arch "$bin_path" "logos-blockchain-${role}"
|
|
|
|
host_identifier_default="${role}-$(hostname -i)"
|
|
|
|
export CFG_FILE_PATH="/config.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}" \
|
|
CFG_HOST_IDENTIFIER="${CFG_HOST_IDENTIFIER:-$host_identifier_default}" \
|
|
LOGOS_BLOCKCHAIN_TIME_BACKEND="${LOGOS_BLOCKCHAIN_TIME_BACKEND:-monotonic}" \
|
|
LOG_LEVEL="${LOG_LEVEL:-INFO}"``"
|
|
|
|
# Ensure recovery directory exists to avoid early crashes in services that
|
|
# persist state.
|
|
mkdir -p /recovery
|
|
|
|
# cfgsync-server can start a little after the container; retry until it is
|
|
# reachable instead of exiting immediately and crash-looping.
|
|
attempt=0
|
|
max_attempts=30
|
|
sleep_seconds=3
|
|
until /usr/bin/cfgsync-client; do
|
|
attempt=$((attempt + 1))
|
|
if [ "$attempt" -ge "$max_attempts" ]; then
|
|
echo "cfgsync-client failed after ${max_attempts} attempts, giving up"
|
|
exit 1
|
|
fi
|
|
echo "cfgsync not ready yet (attempt ${attempt}/${max_attempts}), retrying in ${sleep_seconds}s..."
|
|
sleep "$sleep_seconds"
|
|
done
|
|
|
|
exec "${bin_path}" /config.yaml
|