Remove utility scripts and add worker-data to .gitignore
This commit is contained in:
parent
0b9b0f9660
commit
8864b2659b
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@ logs/*
|
|||||||
.allorad
|
.allorad
|
||||||
.cache
|
.cache
|
||||||
inference-data
|
inference-data
|
||||||
|
worker-data
|
||||||
|
|
||||||
config.json
|
config.json
|
||||||
env
|
env
|
||||||
|
7
Dockerfile_worker
Normal file
7
Dockerfile_worker
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM alloranetwork/allora-offchain-node:latest
|
||||||
|
|
||||||
|
COPY ./config.json /app/config.json
|
||||||
|
|
||||||
|
ENV ALLORA_OFFCHAIN_NODE_CONFIG_FILE_PATH=/app/config.json
|
||||||
|
|
||||||
|
CMD ["./allora_offchain_node"]
|
@ -1,7 +1,9 @@
|
|||||||
services:
|
services:
|
||||||
inference:
|
inference:
|
||||||
container_name: inference-basic-eth-pred
|
container_name: inference-basic-eth-pred
|
||||||
build: .
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile_inference
|
||||||
command: python -u /app/app.py
|
command: python -u /app/app.py
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
@ -15,7 +17,9 @@ services:
|
|||||||
|
|
||||||
updater:
|
updater:
|
||||||
container_name: updater-basic-eth-pred
|
container_name: updater-basic-eth-pred
|
||||||
build: .
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile_inference
|
||||||
environment:
|
environment:
|
||||||
- INFERENCE_API_ADDRESS=http://inference:8000
|
- INFERENCE_API_ADDRESS=http://inference:8000
|
||||||
command: >
|
command: >
|
||||||
@ -32,13 +36,14 @@ services:
|
|||||||
worker:
|
worker:
|
||||||
container_name: worker
|
container_name: worker
|
||||||
image: alloranetwork/allora-offchain-node:latest
|
image: alloranetwork/allora-offchain-node:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile_worker
|
||||||
volumes:
|
volumes:
|
||||||
- ./worker-data:/data
|
- ./worker-data:/data
|
||||||
depends_on:
|
depends_on:
|
||||||
inference:
|
inference:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
env_file:
|
|
||||||
- ./worker-data/env_file
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
inference-data:
|
inference-data:
|
||||||
|
42
init.config
42
init.config
@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ ! -f config.json ]; then
|
|
||||||
echo "Error: config.json file not found, please provide one"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
nodeName=$(jq -r '.wallet.addressKeyName' config.json)
|
|
||||||
if [ -z "$nodeName" ]; then
|
|
||||||
echo "No wallet name provided for the node, please provide your preferred wallet name. config.json >> wallet.addressKeyName"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
json_content=$(cat ./config.json)
|
|
||||||
stringified_json=$(echo "$json_content" | jq -c .)
|
|
||||||
|
|
||||||
mnemonic=$(jq -r '.wallet.addressRestoreMnemonic' config.json)
|
|
||||||
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
|
|
||||||
|
|
||||||
if [ ! -f ./worker-data/env_file ]; then
|
|
||||||
echo "ENV_LOADED=false" > ./worker-data/env_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
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"
|
|
||||||
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
|
|
@ -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
|
|
@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if allorad keys --home=/data/.allorad --keyring-backend test show $NAME > /dev/null 2>&1 ; then
|
|
||||||
echo "allora account: $NAME already imported"
|
|
||||||
else
|
|
||||||
echo "creating allora account: $NAME"
|
|
||||||
output=$(allorad keys add $NAME --home=/data/.allorad --keyring-backend test 2>&1)
|
|
||||||
address=$(echo "$output" | grep 'address:' | sed 's/.*address: //')
|
|
||||||
mnemonic=$(echo "$output" | tail -n 1)
|
|
||||||
|
|
||||||
# Parse and update the JSON string
|
|
||||||
updated_json=$(echo "$ALLORA_OFFCHAIN_NODE_CONFIG_JSON" | jq --arg name "$NAME" --arg mnemonic "$mnemonic" '
|
|
||||||
.wallet.addressKeyName = $name |
|
|
||||||
.wallet.addressRestoreMnemonic = $mnemonic
|
|
||||||
')
|
|
||||||
|
|
||||||
stringified_json=$(echo "$updated_json" | jq -c .)
|
|
||||||
|
|
||||||
echo "ALLORA_OFFCHAIN_NODE_CONFIG_JSON='$stringified_json'" > /data/env_file
|
|
||||||
echo ALLORA_OFFCHAIN_ACCOUNT_ADDRESS=$address >> /data/env_file
|
|
||||||
echo "NAME=$NAME" >> /data/env_file
|
|
||||||
|
|
||||||
echo "Updated ALLORA_OFFCHAIN_NODE_CONFIG_JSON saved to /data/env_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if grep -q "ENV_LOADED=false" /data/env_file; then
|
|
||||||
sed -i 's/ENV_LOADED=false/ENV_LOADED=true/' /data/env_file
|
|
||||||
else
|
|
||||||
echo "ENV_LOADED=true" >> /data/env_file
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user