mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-28 10:13:10 +00:00
fix: downsizing fixes to release workflow and docker entrypoint (#1376)
Co-authored-by: Arnaud <arnaud@status.im>
This commit is contained in:
parent
a1631569d1
commit
3c09f008bb
@ -47,7 +47,6 @@ Please check [documentation](https://docs.codex.storage/learn/run#configuration)
|
||||
|
||||
To get acquainted with Logos Storage, consider:
|
||||
* running the simple [Logos Storage Two-Client Test](https://docs.codex.storage/learn/local-two-client-test) for a start, and;
|
||||
* if you are feeling more adventurous, try [Running a Local Logos Storage Network with Marketplace Support](https://docs.codex.storage/learn/local-marketplace) using a local blockchain as well.
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@ -66,9 +66,6 @@ task storage, "build logos storage binary":
|
||||
outname = "storage",
|
||||
params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
|
||||
|
||||
task toolsCirdl, "build tools/cirdl binary":
|
||||
buildBinary "tools/cirdl/cirdl"
|
||||
|
||||
task testStorage, "Build & run Logos Storage tests":
|
||||
test "testCodex", outName = "testStorage"
|
||||
|
||||
|
||||
@ -100,7 +100,6 @@ proc stop*(s: CodexServer) {.async.} =
|
||||
@[
|
||||
s.codexNode.switch.stop(),
|
||||
s.codexNode.stop(),
|
||||
s.codexNode.discovery.stop(),
|
||||
s.repoStore.stop(),
|
||||
s.maintenance.stop(),
|
||||
]
|
||||
|
||||
@ -217,13 +217,20 @@ proc stop*(d: Discovery) {.async: (raises: []).} =
|
||||
try:
|
||||
await noCancel d.protocol.closeWait()
|
||||
d.isStarted = false
|
||||
trace "Discovery stopped"
|
||||
except CatchableError as exc:
|
||||
error "Error stopping discovery", exc = exc.msg
|
||||
|
||||
proc close*(d: Discovery) {.async: (raises: []).} =
|
||||
if d.store.isNil:
|
||||
warn "Discovery store is nil, skipping close"
|
||||
return
|
||||
|
||||
let res = await noCancel d.store.close()
|
||||
if res.isErr:
|
||||
error "Error closing discovery store", error = res.error().msg
|
||||
else:
|
||||
trace "Discovery store closed"
|
||||
|
||||
proc new*(
|
||||
T: type Discovery,
|
||||
|
||||
@ -58,25 +58,6 @@ if [[ -n "${BOOTSTRAP_NODE_FROM_URL}" ]]; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Marketplace address from URL
|
||||
if [[ -n "${MARKETPLACE_ADDRESS_FROM_URL}" ]]; then
|
||||
WAIT=${MARKETPLACE_ADDRESS_FROM_URL_WAIT:-300}
|
||||
SECONDS=0
|
||||
SLEEP=1
|
||||
# Run and retry if fail
|
||||
while (( SECONDS < WAIT )); do
|
||||
MARKETPLACE_ADDRESS=($(curl -s -f -m 5 "${MARKETPLACE_ADDRESS_FROM_URL}"))
|
||||
# Check if exit code is 0 and returned value is not empty
|
||||
if [[ $? -eq 0 && -n "${MARKETPLACE_ADDRESS}" ]]; then
|
||||
export CODEX_MARKETPLACE_ADDRESS="${MARKETPLACE_ADDRESS}"
|
||||
break
|
||||
else
|
||||
# Sleep and check again
|
||||
echo "Can't get Marketplace address from ${MARKETPLACE_ADDRESS_FROM_URL} - Retry in $SLEEP seconds / $((WAIT - SECONDS))"
|
||||
sleep $SLEEP
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Stop Codex run if unable to get SPR
|
||||
if [[ -n "${BOOTSTRAP_NODE_URL}" && -z "${CODEX_BOOTSTRAP_NODE}" ]]; then
|
||||
@ -117,44 +98,6 @@ elif [[ -n "${NAT_PUBLIC_IP_AUTO}" && -z "${CODEX_NAT}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If marketplace is enabled from the testing environment,
|
||||
# The file has to be written before Codex starts.
|
||||
keyfile="private.key"
|
||||
if [[ -n "${ETH_PRIVATE_KEY}" ]]; then
|
||||
echo "${ETH_PRIVATE_KEY}" > "${keyfile}"
|
||||
chmod 600 "${keyfile}"
|
||||
export CODEX_ETH_PRIVATE_KEY="${keyfile}"
|
||||
echo "Private key set"
|
||||
fi
|
||||
|
||||
# Circuit downloader
|
||||
# cirdl [circuitPath] [rpcEndpoint] [marketplaceAddress]
|
||||
if [[ "$@" == *"prover"* ]]; then
|
||||
echo "Prover is enabled - Run Circuit downloader"
|
||||
|
||||
# Set variables required by cirdl from command line arguments when passed
|
||||
for arg in data-dir circuit-dir eth-provider marketplace-address; do
|
||||
arg_value=$(grep -o "${arg}=[^ ,]\+" <<< $@ | awk -F '=' '{print $2}')
|
||||
if [[ -n "${arg_value}" ]]; then
|
||||
var_name=$(tr '[:lower:]' '[:upper:]' <<< "CODEX_${arg//-/_}")
|
||||
export "${var_name}"="${arg_value}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Set circuit dir from CODEX_CIRCUIT_DIR variables if set
|
||||
if [[ -z "${CODEX_CIRCUIT_DIR}" ]]; then
|
||||
export CODEX_CIRCUIT_DIR="${CODEX_DATA_DIR}/circuits"
|
||||
fi
|
||||
|
||||
# Download circuit
|
||||
mkdir -p "${CODEX_CIRCUIT_DIR}"
|
||||
chmod 700 "${CODEX_CIRCUIT_DIR}"
|
||||
download="cirdl ${CODEX_CIRCUIT_DIR} ${CODEX_ETH_PROVIDER} ${CODEX_MARKETPLACE_ADDRESS}"
|
||||
echo "${download}"
|
||||
eval "${download}"
|
||||
[[ $? -ne 0 ]] && { echo "Failed to download circuit files"; exit 1; }
|
||||
fi
|
||||
|
||||
# Show
|
||||
echo -e "\nCodex run parameters:"
|
||||
vars=$(env | grep "CODEX_" | grep -v -e "[0-9]_SERVICE_" -e "[0-9]_NODEPORT_")
|
||||
|
||||
@ -929,7 +929,7 @@ int main(void)
|
||||
|
||||
free(cid);
|
||||
|
||||
if (update_log_level(storage_ctx, "INFO") != RET_OK)
|
||||
if (update_log_level(storage_ctx, "TRACE") != RET_OK)
|
||||
{
|
||||
fprintf(stderr, "update log level failed\n");
|
||||
return RET_ERR;
|
||||
|
||||
@ -59,7 +59,7 @@ template callEventCallback(ctx: ptr StorageContext, eventName: string, body: unt
|
||||
## Template used to notify the client of global events
|
||||
## Example: onConnectionChanged, onProofMissing, etc.
|
||||
if isNil(ctx[].eventCallback):
|
||||
error eventName&" - eventCallback is nil"
|
||||
error eventName & " - eventCallback is nil"
|
||||
return
|
||||
|
||||
foreignThreadGc:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user