diff --git a/.gitignore b/.gitignore index 97056b3..f8947f5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ logs/* .allorad .cache inference-data +worker-data config.json env diff --git a/docker-compose.yml b/docker-compose.yml index 5d856e3..a206f6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,4 +42,4 @@ services: volumes: inference-data: - worker-data: + worker-data: \ No newline at end of file diff --git a/init.config b/init.config index 2057f07..25833ae 100755 --- a/init.config +++ b/init.config @@ -21,11 +21,13 @@ if [ -n "$mnemonic" ]; then echo "ALLORA_OFFCHAIN_NODE_CONFIG_JSON='$stringified_json'" > ./worker-data/env_file echo "NAME=$nodeName" >> ./worker-data/env_file echo "ENV_LOADED=true" >> ./worker-data/env_file - echo "wallet mnemonic already provided by you, loading config.json . Please proceed to run docker compose" exit 1 fi +# Ensure the worker-data directory exists +mkdir -p ./worker-data + if [ ! -f ./worker-data/env_file ]; then echo "ENV_LOADED=false" > ./worker-data/env_file fi @@ -34,9 +36,8 @@ ENV_LOADED=$(grep '^ENV_LOADED=' ./worker-data/env_file | cut -d '=' -f 2) if [ "$ENV_LOADED" = "false" ]; then json_content=$(cat ./config.json) stringified_json=$(echo "$json_content" | jq -c .) - - docker run -it --entrypoint=bash -v $(pwd)/worker-data:/data -e NAME="${nodeName}" -e ALLORA_OFFCHAIN_NODE_CONFIG_JSON="${stringified_json}" alloranetwork/allora-chain:latest -c "bash /data/scripts/init.sh" + docker run -it --entrypoint=bash -v $(pwd)/worker-data:/data -v $(pwd)/scripts:/scripts -e NAME="${nodeName}" -e ALLORA_OFFCHAIN_NODE_CONFIG_JSON="${stringified_json}" alloranetwork/allora-chain:latest -c "bash /scripts/init.sh" echo "config.json saved to ./worker-data/env_file" else echo "config.json is already loaded, skipping the operation. You can set ENV_LOADED variable to false in ./worker-data/env_file to reload the config.json" -fi \ No newline at end of file +fi \ No newline at end of file diff --git a/worker-data/scripts/init.sh b/scripts/init.sh similarity index 100% rename from worker-data/scripts/init.sh rename to scripts/init.sh diff --git a/worker-data/env_file b/worker-data/env_file deleted file mode 100644 index c5ab53a..0000000 --- a/worker-data/env_file +++ /dev/null @@ -1,3 +0,0 @@ -ALLORA_OFFCHAIN_NODE_CONFIG_JSON='{"wallet":{"addressKeyName":"test-basic","addressRestoreMnemonic":"your mnemonic will go here","alloraHomeDir":"","gas":"1000000","gasAdjustment":1,"nodeRpc":"https://allora-rpc.devnet.behindthecurtain.xyz","maxRetries":1,"delay":1,"submitTx":false},"worker":[{"topicId":1,"inferenceEntrypointName":"api-worker-reputer","loopSeconds":5,"parameters":{"InferenceEndpoint":"http://inference:8000/inference/{Token}","Token":"ETH"}}]}' -NAME=test-basic -ENV_LOADED=true