From a885950e95d5bfe3ffb26a3900bdd5c373864aec Mon Sep 17 00:00:00 2001 From: Calvin Sze Date: Tue, 3 Sep 2024 13:38:27 -0400 Subject: [PATCH] chore:update env example --- .env.example | 2 +- KubeServiceUpdated.js | 4 ++-- README.md | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index aeb97fd..6586ae9 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ WORKER_ADDRESS=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY -RPC_ENDPOINT=ws://127.0.0.1:9988 +RPC_ENDPOINT=wss://fraa-flashbox-3239-rpc.a.stagenet.tanssi.network IP_ADDRESS= DOMAIN_NAME= \ No newline at end of file diff --git a/KubeServiceUpdated.js b/KubeServiceUpdated.js index 62f958b..544a840 100644 --- a/KubeServiceUpdated.js +++ b/KubeServiceUpdated.js @@ -10,7 +10,7 @@ require('dotenv').config(); const WORKER_ADDRESS = process.env.WORKER_ADDRESS || '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; //defaults to alice const NODE_RPC = process.env.RPC_ENDPOINT || 'wss://fraa-flashbox-3239-rpc.a.stagenet.tanssi.network'; //defaults to hosted chain -const PUBLIC_IP = process.env.PUBLIC_IP || null; //should update on MasterSetup.sh +const IP_ADDRESS = process.env.IP_ADDRESS || null; //should update on MasterSetup.sh const DOMAIN_NAME = process.env.DOMAIN_NAME || null; //should update on MasterSetup.sh if exists // const WORKER_ID = process.env.WORKER_ID || null; @@ -252,7 +252,7 @@ async function listenToSubstrateEvents() { const thisWorker = entries.find(([key,value]) => { let worker = value.toHuman() const [domain] = worker.api.domain.split(':') - return domain === PUBLIC_IP || domain === DOMAIN_NAME + return domain === IP_ADDRESS || domain === DOMAIN_NAME }) const workerId = thisWorker? thisWorker[1].toHuman().id : null console.log("workerId: ", workerId) diff --git a/README.md b/README.md index ae41624..aafd83c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,17 @@ Take a look at `.env.example`: These values can be manually customized if you know them already. Otherwise the scripts below will automate this setup process. Keep in mind the scripts are configured for an Ubuntu Linux machine. Using the setup scripts on other machines may introduce errors. -The `RPC_ENDPOINT` is defaulted to localhost at port `9988` which is the typical zombienet RPC endpoint for a parachain. The example `WORKER_ADDRESS` is set to the Alice default test account. +[`Note:`] `RPC_ENDPOINT` defaults to the hosted Cyborg Chain's endpoint. If you are running Cyborg Node locally (not on vm), update the RPC_ENDPOINT to `ws://:9988` + +You can fetch your local IP address (``) of your computer on the network using: + +```bash +ipconfig getifaddr en0 +``` + +If your Cyborg Node is running on a VM, replace (``) with the ip address of the VM + +The example `WORKER_ADDRESS` is set to the Alice default test account. If you decide to run the worker locally within a local network, use this command: ``` @@ -54,7 +64,7 @@ npm run setup:local If you decide to setup your worker on a remote machine, use this command: ``` npm run setup:dev -``` +``` This command creates a `.env` with the neccessary variables to run the worker properly. You can already edit the `.env` manually afterwards depending on your setup preference. The last command in the setup script will install your k3s cluster master node. You can always run the MasterSetup.sh again to retrieve a worker node join token (`k3s-node-token.txt`). You will need this token to connect a k3s worker node to the k3s master.