Skip to content

Commit

Permalink
Node operator name (#70)
Browse files Browse the repository at this point in the history
* node operator name

* node operator name

* updated docs for node operator name

* updated docs for node operator name

* updated docs for node operator name
  • Loading branch information
shpookas authored Jan 28, 2025
1 parent 5de5af2 commit da2f8c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ https://hub.docker.com/repository/docker/diadata/decentralized-feeder/general

- DIA tokens in your wallet (you can use faucet for this [https://faucet.diadata.org](https://faucet.diadata.org))


## Docker Compose Deployment

### Navigate to the Docker Compose Folder
Expand All @@ -105,6 +104,7 @@ https://hub.docker.com/repository/docker/diadata/decentralized-feeder/general

### Configure Environment Variables
- Create a `.env` file in the same directory as `docker-compose.yaml`. This file should contain the following variables:
- `NODE_OPERATOR_NAME`: A unique and descriptive name identifying the organization or entity running the node. This name is used for monitoring and should be chosen carefully to ensure it is both meaningful and recognizable (e.g., include your organization name or geographical region). Providing a clear name helps distinguish your node in dashboards and logs.
- `PRIVATE_KEY`: Your private key for the deployment.
- `DEPLOYED_CONTRACT`: The contract address. Initially, leave this empty during the first deployment to retrieve the deployed contract.
- `PUSHGATEWAY_USER`: to allow decentralized-feeder authenticate towards the monitoring server. Reach out to the team to get hold of these credentials, info [at] diadata.org
Expand All @@ -115,7 +115,8 @@ https://hub.docker.com/repository/docker/diadata/decentralized-feeder/general

- Example `.env` file:
```plaintext
PRIVATE_KEY=myprivatekey
NODE_OPERATOR_NAME=
PRIVATE_KEY=
DEPLOYED_CONTRACT=
PUSHGATEWAY_USER=
PUSHGATEWAY_PASSWORD=
Expand All @@ -135,7 +136,6 @@ https://hub.docker.com/repository/docker/diadata/decentralized-feeder/general
- Update your `.env` file with `DEPLOYED_CONTRACT` variable mentioned above. Redeployed the container with `docker-compose up -d`
```plaintext
PRIVATE_KEY=myprivatekey
DEPLOYED_CONTRACT=0xxxxxxxxxxxxxxxxxxxxxxxxxx
```
Expand Down Expand Up @@ -177,7 +177,8 @@ This method is suitable for simple setups without orchestration.
- Deploy the feeder with `DEPLOYED_CONTRACT` initially empty:
```bash
docker run -d \
-e PRIVATE_KEY=myprivatekey \
-e NODE_OPERATOR_NAME= \
-e PRIVATE_KEY= \
-e DEPLOYED_CONTRACT= \
-e PUSHGATEWAY_USER= \
-e PUSHGATEWAY_PASSWORD= \
Expand All @@ -192,11 +193,12 @@ This method is suitable for simple setups without orchestration.
```bash
docker stop <container_name>
docker run -d \
-e PRIVATE_KEY=myprivatekey \
-e DEPLOYED_CONTRACT=0xxxxxxxxxxxxxxxxxxxxxxxxxx \
-e NODE_OPERATOR_NAME= \
-e PRIVATE_KEY= \
-e DEPLOYED_CONTRACT= \
-e PUSHGATEWAY_USER= \
-e PUSHGATEWAY_PASSWORD= \
-e EXCHANGEPAIRS="Binance:TON-USDT, Binance:TRX-USDT, ....."
-e EXCHANGEPAIRS= \
--name decentralized-feeder \
diadata/decentralized-feeder:<VERSION>
```
Expand Down Expand Up @@ -233,8 +235,10 @@ Kubernetes is ideal for production environments requiring scalability and high a
- name: feeder-container
image: diadata/decentralized-feeder:<VERSION>
env:
- name: NODE_OPERATOR_NAME
value: ""
- name: PRIVATE_KEY
value: "myprivatekey"
value: ""
- name: DEPLOYED_CONTRACT
value: ""
- name: EXCHANGEPAIRS
Expand Down Expand Up @@ -316,6 +320,7 @@ Locate the environment configuration file or section for your deployment method:
- Example in Docker Run:
```bash
docker run -d \
-e NODE_OPERATOR_NAME= \
-e PRIVATE_KEY=your-private-key \
-e DEPLOYED_CONTRACT=your-contrract \
-e EXCHANGEPAIRS="Binance:TON-USDT, Binance:TRX-USDT, ....." \
Expand Down
7 changes: 3 additions & 4 deletions docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: '3.8'

services:
lasernet-feeder:
image: diadata/decentralized-feeder:v0.0.4
app:
image: ${IMAGE_TAG}
# for latest image versios see https://hub.docker.com/repository/docker/diadata/decentralized-feeder/general
env_file:
- .env
restart: always
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,17 @@ func main() {
authUser := os.Getenv("PUSHGATEWAY_USER")
authPassword := os.Getenv("PUSHGATEWAY_PASSWORD")

// Get the node operator ID from the environment variable, with no default
nodeOperatorName := utils.Getenv("NODE_OPERATOR_NAME", "")
if nodeOperatorName == "" {
log.Fatalf("NODE_OPERATOR_NAME environment variable is not set. Please specify a unique identifier for the node operator.")
}

// Create the dynamic jobName using the node operator ID and hostname
jobName := nodeOperatorName + "_" + hostname

reg := prometheus.NewRegistry()
m := NewMetrics(reg, pushgatewayURL, "df_"+hostname, authUser, authPassword)
m := NewMetrics(reg, pushgatewayURL, jobName, authUser, authPassword)

// Record start time for uptime calculation
startTime := time.Now()
Expand Down

0 comments on commit da2f8c5

Please sign in to comment.