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

Commit

Permalink
update topic spec and add auto address funding to workers
Browse files Browse the repository at this point in the history
  • Loading branch information
okedeji committed Jul 16, 2024
1 parent f373f68 commit ea92726
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion allocmd/templates/dev-docker-compose.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
- --private-key=/data/{{ b7s_type }}/key/priv.bin
- --log-level=debug
- --port=9011
- --topic={{ topic_id }}
- --topic={{ allora_topic_id }}
- --boot-nodes=/ip4/172.19.0.100/tcp/9010/p2p/{{ head_peer_id }}
volumes:
- type: bind
Expand Down
2 changes: 1 addition & 1 deletion allocmd/templates/prod-docker-compose.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
- --log-level=debug
- --port=9010
- --boot-nodes={{ boot_nodes }}
- --topic={{ topic_id }}
- --topic={{ allora_topic_id }}
- --allora-node-rpc-address={{ chain_rpc_address }}
- --allora-chain-home-dir=/data/.allorad
- --allora-chain-key-name={{ worker_name}}
Expand Down
2 changes: 1 addition & 1 deletion allocmd/utilities/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cliVersion = "2.0.7"
cliVersion = "2.0.8"
19 changes: 15 additions & 4 deletions allocmd/utilities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def generateWorkerAccount(worker_name, type):
with open(config_path, 'w') as file:
yaml.safe_dump(config, file)

return address

def generateProdCompose(env: Environment, type):
"""Deploy resource production kubernetes cluster"""

Expand All @@ -201,10 +203,12 @@ def generateProdCompose(env: Environment, type):
return

worker_name = config['name']
faucet_url = config['faucet_url']
hex_coded_pk = config[type]['hex_coded_pk']
boot_nodes = config[type]['boot_nodes']
chain_rpc_address = config[type]['chain_rpc_address']
chain_topic_id = config[type]['chain_topic_id']
account_address = config[type]['address']


alloraTopic = None
Expand All @@ -221,7 +225,8 @@ def generateProdCompose(env: Environment, type):
"worker_name": worker_name,
"boot_nodes": boot_nodes,
"chain_rpc_address": chain_rpc_address,
"topic_id": alloraTopic,
"allora_topic_id": alloraTopic,
"topic_id": chain_topic_id,
}
},
{
Expand All @@ -235,13 +240,15 @@ def generateProdCompose(env: Environment, type):
]

generate_all_files(env, file_configs, Command.DEPLOY, type)

fundAddress(faucet_url, account_address)
cprint(f"production docker compose file generated to be deployed", 'green')
cprint(f"please run chmod -R +rx ./data/scripts to grant script access to the image", 'yellow')
else:
cprint("\nOperation cancelled.", 'red')


def blocklessNode(environment, env, type, name=None, topic=None):
def blocklessNode(environment, env, type, name=None, topic=None, network='edgenet'):
"""Initialize your Allora Worker Node with necessary boilerplates"""

if not check_docker_running():
Expand Down Expand Up @@ -286,7 +293,7 @@ def blocklessNode(environment, env, type, name=None, topic=None):
{
"template_name": "dev-docker-compose.yaml.j2",
"file_name": "dev-docker-compose.yaml",
"context": {"head_peer_id": head_peer_id, "topic_id": alloraTopic, "b7s_type": type}
"context": {"head_peer_id": head_peer_id, "allora_topic_id": alloraTopic, "b7s_type": type}
},
{
"template_name": "requirements.txt.j2",
Expand All @@ -312,7 +319,11 @@ def blocklessNode(environment, env, type, name=None, topic=None):

generate_all_files(env, file_configs, Command.INIT, type, name)

generateWorkerAccount(name, type)
address = generateWorkerAccount(name, type)

faucet_url = f'https://faucet.{network}.allora.network/'

fundAddress(faucet_url, address)
else:
cprint("\nOperation cancelled.", 'red')
elif environment == 'prod':
Expand Down

0 comments on commit ea92726

Please sign in to comment.