Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from allora-network/clement/ARENA-1049
Browse files Browse the repository at this point in the history
ARENA-1049: Update Readme and Docker images
  • Loading branch information
clementupshot authored Mar 13, 2024
2 parents 58b5dbb + 271d509 commit 71b0aa1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ __pycache__
keys
data
data-worker
data-head
data-head
/node/head-data
/node/worker-data
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ There is a docker-compose.yml provided that sets up one head node and one worker

## Dependencies
- Have an available image of the `allora-inference-base` , and reference it as a base on the `FROM` of the `Dockerfile`.
- Create a set of keys in the `keys` directory for your head and worker, and use them in the head and worker configuration(volume mapping already provided in `docker-compose.yml` file). If no keys are specified in the volumes, new keys are created. However, the worker will need to specify the `peer_id` of the head for defining it as a `BOOT_NODES`. You can bring head up first, get the key from the container, then use it in the `BOOT_NODES`. More info in the [b7s-docker-compose](https://github.com/blocklessnetwork/b7s-docker-compose/tree/main) repo.
- Provide a valid `UPSHOT_API_TOKEN` env var inside the `node/.env` file.
- Create a set of keys in the `keys` directory for your head and worker, and use them in the head and worker configuration(volume mapping already provided in `docker-compose.yml` file). If no keys are specified in the volumes, new keys are created. However, the worker will need to specify the `peer_id` of the head for defining it as a `BOOT_NODES`. You can bring head up first, get the key from the container, then use it in the `BOOT_NODES`. For more information, see [how to generate keys](https://github.com/allora-network/basic-coin-prediction-node#docker-compose-setup).
- Provide a valid `UPSHOT_API_TOKEN` env var inside the `node/.env` file. You can [create one here](https://developer.upshot.xyz/).

## Run

Once this is set up, run `docker compose up head1 worker1`
Once this is set up, run `cd node && docker compose up`


Once both nodes are up, a function can be tested by hitting:
Expand All @@ -47,17 +47,38 @@ curl --location 'http://localhost:6000/api/v1/functions/execute' \
{
"name": "ALLORA_ARG_PARAMS",
"value": "0x42069abfe407c60cf4ae4112bedead391dba1cdb/2921"
},
{
"name": "TOPIC_ID",
"value": "1"
}
],
"number_of_nodes": -1,
"timeout": 2
}
}'
```
The response will look like:
```
{
"code": "200",
"request_id": "0a6c4c9b-e55d-4ef5-a95f-b23d8747fd03",
"results": [
{
"result": {
"stdout": "{\"value\": \"432940000000000000\"}\n\n",
"stderr": "",
"exit_code": 0
},
"peers": [
"12D3KooWEdenoKzrpCVD5D98Qt6vxgFdEDHLRGSKnnCXR49PQsbp"
],
"frequency": 100
}
],
"cluster": {
"peers": [
"12D3KooWEdenoKzrpCVD5D98Qt6vxgFdEDHLRGSKnnCXR49PQsbp"
]
}
}
```

## Connecting to the Allora network

Expand Down
22 changes: 10 additions & 12 deletions node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ version: "3.8"

services:

worker1:
# 12D3KooWH43dbK5Wg5u6SLTb4nTsaF9cRJnQEcSVR4KxmQeeR4NT
worker:
command: >
- upshot-node
- --role=worker
Expand All @@ -12,29 +11,28 @@ services:
- --runtime-path=/app/runtime
- --runtime-cli=bls-runtime
- --workspace=/data/workspace
- --private-key=/data/keys/worker1/priv.bin
- --private-key=/data/keys/priv.bin
- --log-level=debug
- --boot-nodes=/ip4/172.21.0.100/tcp/9010/p2p/12D3KooWFVXiBBD9XrQQ5X5GGGZeKM8MBEvk1gu3io2K1XLRX8MA
- --boot-nodes=/ip4/172.21.0.100/tcp/9010/p2p/head-id
- --allora-chain-topic-id=1
- --topic=1
build: .
volumes:
- ./data-worker:/data
- ./worker-data:/data
working_dir: /data
environment:
- HOME=/app
env_file:
- .env
depends_on:
- head1
- head
networks:
b7s-local:
aliases:
- worker1
- worker
ipv4_address: 172.21.0.5

head1:
# 12D3KooWFVXiBBD9XrQQ5X5GGGZeKM8MBEvk1gu3io2K1XLRX8MA
head:
command: >
- upshot-node
- --role=head
Expand All @@ -43,22 +41,22 @@ services:
- --runtime-path=/app/runtime
- --runtime-cli=bls-runtime
- --workspace=/data/workspace
- --private-key=/data/keys/head1/priv.bin
- --private-key=/data/keys/priv.bin
- --log-level=debug
- --port=9010
- --rest-api=:6000
image: alloranetwork/allora-inference-base-head:latest
ports:
- "6000:6000"
volumes:
- ./data-head:/data
- ./head-data:/data
working_dir: /data
environment:
- HOME=/data
networks:
b7s-local:
aliases:
- head1
- head
ipv4_address: 172.21.0.100

networks:
Expand Down

0 comments on commit 71b0aa1

Please sign in to comment.