Skip to content

Node deployment

jppade edited this page Dec 10, 2025 · 8 revisions

This document outlines the procedures for deploying the diadata/decentralized-feeder:<VERSION> containerized application. Replace <VERSION> with the desired version when deploying.

For the most recent Docker image tags, please refer to public docker hub: https://hub.docker.com/r/diadata/decentralized-feeder/tags

The image can be deployed using various methods to accommodate different use cases. For production environments, Kubernetes or Helm is recommended for scalability and flexibility. For simpler setups or local testing, Docker Compose or Docker Run is sufficient.

Requirements

  • Ensure that Docker or Docker Compose is installed on your machine.

  • Clone this repository to your local machine.

  • The container has minimal resource requirements, making it suitable for most machines, including Windows, macOS, Linux, and Raspberry Pi, as long as Docker is installed.

  • An ETH private key from MetaMask or any other Eth wallet. Alternatively to generate private key effortlesly eth-keys tool can be used for this ethereum/eth-keys

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

Docker Compose Deployment

Navigate to the Docker Compose Folder

  • Locate the docker-compose folder in this repository.
  • Inside, you will find a file named docker-compose.yaml.

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.
    • CHAIN_ID: set the chain ID value
    • BLOCKCHAIN_NODE: set the RPC Endpoint # https://testnet-rpc.diadata.org for testnet, https://rpc.diadata.org for mainnet
    • 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
    • PUSHGATEWAY_PASSWORD: to allow decentralized-feeder authenticate towards the monitoring server. Reach out to the team to get hold of these credentials, info [at] diadata.org

    For adding markets to the feeder, refer to Adding New Markets section.

  • Example .env file:

    NODE_OPERATOR_NAME=
    CHAIN_ID=
    BLOCKCHAIN_NODE=
    PRIVATE_KEY=
    DEPLOYED_CONTRACT=
    PUSHGATEWAY_USER=
    PUSHGATEWAY_PASSWORD=
    
  • Open a terminal in the docker-compose folder and start the deployment by running:

    docker-compose up

Retrieve Deployed Contract

  • Once the container is deployed with DEPLOYED_CONTRACT env variable empty the logs will display the deployed contract address in the following format:

    │ time="2024-11-25T11:30:08Z" level=info msg="Contract pending deploy: 0xxxxxxxxxxxxxxxxxxxxxxxxxx."
    
  • Copy the displayed contract address (e.g., 0xxxxxxxxxxxxxxxxxxxxxxxxxx) and stop the container with docker rm -f <container_name>.

  • Update your .env file with DEPLOYED_CONTRACT variable mentioned above. Redeployed the container with docker-compose up -d

    DEPLOYED_CONTRACT=0xxxxxxxxxxxxxxxxxxxxxxxxxx
    
  • Check if the container is running correctly by viewing the logs. Run the following command:

    docker-compose logs -f
  • Expected Logs: Look for logs similar to the example below, which indicate a successful startup:

    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - Atomic filter value for market Binance:SUSHI-USDT with 20 trades: 0.7095307176575745."                                                                  │
    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - Atomic filter value for market Simulation:UNI-USDC with 1 trades: 8.008539500390082."                                                                   │
    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - Atomic filter value for market Crypto.com:USDT-USD with 5 trades: 0.99948."                                                                             │
    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - filter median for MOVR: 9.864475653518195."                                                                                                             │
    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - filter median for STORJ: 0.4672954012114179."                                                                                                           │
    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - filter median for DIA: 0.9839597410694259."                                                                                                             │
    │ time="2024-10-29T13:39:35Z" level=info msg="Processor - filter median for WETH: 2626.9564003841315."   
    
  • You can optionally cleanup the deployment once you're done by running:

    docker rm -f <container_name>
    
  • Verify the container has been removed:

    docker ps -a
    

Alternative Deployment Methods

Docker Run Deployment

This method is suitable for simple setups without orchestration.

Command

  • Deploy the feeder with DEPLOYED_CONTRACT initially empty:
    docker run -d \
      -e NODE_OPERATOR_NAME= \
      -e PRIVATE_KEY= \
      -e CHAIN_ID= \
      -e BLOCKCHAIN_NODE= \
      -e DEPLOYED_CONTRACT= \
      -e PUSHGATEWAY_USER= \
      -e PUSHGATEWAY_PASSWORD= \
      --name decentralized-feeder \
      diadata/decentralized-feeder:<VERSION>
  • Retrieve the logs to get the deployed contract address:
    docker logs <container_name>
  • Stop the container, update the DEPLOYED_CONTRACT value, and restart:
    docker stop <container_name>
    docker run -d \
      -e NODE_OPERATOR_NAME= \
      -e PRIVATE_KEY= \
      -e CHAIN_ID= \
      -e BLOCKCHAIN_NODE= \
      -e DEPLOYED_CONTRACT= \
      -e PUSHGATEWAY_USER= \
      -e PUSHGATEWAY_PASSWORD= \
      --name decentralized-feeder \
      diadata/decentralized-feeder:<VERSION>
  • Retrieve the logs to verify the container is running as expected
    docker logs <container_name>

Kubernetes Deployment

Kubernetes is ideal for production environments requiring scalability and high availability.

Deployment YAML

  • Create a Kubernetes Deployment manifest. Replace <VERSION> with the desired version:
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: decentralized-feeder
      namespace: default
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: decentralized-feeder
      template:
        metadata:
          labels:
            app: decentralized-feeder
        spec:
          containers:
          - name: feeder-container
            image: diadata/decentralized-feeder:<VERSION>
            env:
            - name: PRIVATE_KEY
              valueFrom:
                secretKeyRef: {key: private_key_secret, name: private_key_secret}
            - name: NODE_OPERATOR_NAME
              value: ""
            - name: DEPLOYED_CONTRACT
              value: ""
            - name: CHAIN_ID
              value: ""
            - name: BLOCKCHAIN_NODE
              value: ""
            - name: PUSHGATEWAY_USER= 
              value: ""
            - name: PUSHGATEWAY_PASSWORD= 
              value: ""
            - containerPort: 8080
    

For adding markets to the feeder, refer to Adding New Markets section.

Steps to Deploy

  1. Deploy the feeder with DEPLOYED_CONTRACT set to an empty string ("") in the Kubernetes manifest.
    kubectl apply -f deployment.yaml
  2. Monitor the logs for the deployed contract address:
    kubectl logs <pod-name>
  3. Update the DEPLOYED_CONTRACT value in the manifest with the retrieved contract address.
  4. Apply the updated manifest:
    kubectl apply -f deployment.yaml

Clone this wiki locally