-
Notifications
You must be signed in to change notification settings - Fork 3
Node deployment
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.
-
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)
- Locate the
docker-composefolder in this repository. - Inside, you will find a file named
docker-compose.yaml.
-
Create a
.envfile in the same directory asdocker-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.orgfor testnet,https://rpc.diadata.orgfor 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
.envfile:NODE_OPERATOR_NAME= CHAIN_ID= BLOCKCHAIN_NODE= PRIVATE_KEY= DEPLOYED_CONTRACT= PUSHGATEWAY_USER= PUSHGATEWAY_PASSWORD= -
Open a terminal in the
docker-composefolder and start the deployment by running:docker-compose up
-
Once the container is deployed with
DEPLOYED_CONTRACTenv 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 withdocker rm -f <container_name>. -
Update your
.envfile withDEPLOYED_CONTRACTvariable mentioned above. Redeployed the container withdocker-compose up -dDEPLOYED_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
This method is suitable for simple setups without orchestration.
- Deploy the feeder with
DEPLOYED_CONTRACTinitially 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_CONTRACTvalue, 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 is ideal for production environments requiring scalability and high availability.
- Create a Kubernetes
Deploymentmanifest. 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.
- Deploy the feeder with
DEPLOYED_CONTRACTset to an empty string ("") in the Kubernetes manifest.kubectl apply -f deployment.yaml
- Monitor the logs for the deployed contract address:
kubectl logs <pod-name>
- Update the
DEPLOYED_CONTRACTvalue in the manifest with the retrieved contract address. - Apply the updated manifest:
kubectl apply -f deployment.yaml