Skip to content

A docker compose set up for running the JSON-RPC server in LD (Local Data) mode with all of its dependencies

Notifications You must be signed in to change notification settings

shardeum/ldrpc-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shardeum JSON-RPC Server in LD (Local Data) mode Docker

A docker setup for running the JSON-RPC server in LD (Local Data) mode with all of its dependencies

Diagram

This docker container is meant to run all the services in the right dotted box of the diagram below.

LD RPC Setup

Prerequisites

Archiver and distributor

You will need to have an archiver and distributor running somewhere. These configs will be provided by a shardeum representative or if you need to run a local devnet you can follow these instructions to run shardus start 10 as well as boot a distributor in MQ mode following the instructions as well.

  • Docker

Usage

  1. Pull Run the docker container with environment variables:
docker pull ghcr.io/shardeum/ldrpc-docker

docker run -p 8080:8080 -it \
  -v shardeum_db:/app/shardeum/db \
  -v relayer_collector_db:/app/relayer-collector/db \
  -e ARCHIVER_IP=<archiver-ip> \
  -e ARCHIVER_PORT=<archiver-port> \
  -e ARCHIVER_PUBKEY=<archiver-pubkey> \
  -e DISTRIBUTOR_IP=<distributor-ip> \
  -e DISTRIBUTOR_PUBKEY=<distributor-pubkey> \
  -e COLLECTOR_PUBKEY=<your-collector-pubkey> \
  -e COLLECTOR_SECRETKEY=<your-collector-secretkey> \
  -e COLLECTOR_MODE='MQ' \
  -e RMQ_HOST=<rmq-host> \
  -e RMQ_PORT=<rmq-port> \
  -e RMQ_PROTOCOL='amqp' \
  -e RMQ_USER=<rmq-user> \
  -e RMQ_PASS=<rmq-pass> \
  -e RMQ_CYCLES_QUEUE_NAME=<rmq-cycles-queue-name> \
  -e RMQ_RECEIPTS_QUEUE_NAME=<rmq-receipts-queue-name> \
  -e RMQ_ORIGINAL_TXS_QUEUE_NAME=<rmq-original-txs-queue-name> \
  ghcr.io/shardeum/ldrpc-docker
  1. The JSON-RPC server will be available at http://localhost:8080
  2. You can now curl it:
$ curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' http://localhost:8080

{"jsonrpc":"2.0","id":1,"result":"0x1f92"}

Demo syncing a small devnet

demo_docker.mov

Run Configuration

The configuration is done through environment variables when running the container. These values should be provided by your shardeum representative:

  • ARCHIVER_IP: IP address of the archiver
  • ARCHIVER_PUBKEY: Public key of the archiver
  • DISTRIBUTOR_IP: IP address of the distributor
  • DISTRIBUTOR_PUBKEY: Public key of the distributor
  • COLLECTOR_PUBKEY: Your collector public key
  • COLLECTOR_SECRETKEY: Your collector secret key
  • COLLECTOR_MODE: Mode of the collector - use MQ, WS is deprecated
  • RMQ_HOST: Host of the RabbitMQ server
  • RMQ_PORT: Port of the RabbitMQ server
  • RMQ_PROTOCOL: Protocol of the RabbitMQ server
  • RMQ_USER: User of the RabbitMQ server
  • RMQ_PASS: Password of the RabbitMQ server
  • RMQ_CYCLES_QUEUE_NAME: Name of the cycles queue
  • RMQ_RECEIPTS_QUEUE_NAME: Name of the receipts queue
  • RMQ_ORIGINAL_TXS_QUEUE_NAME: Name of the original transactions queue

Volumes

If you want to persist the data between runs, you can mount volumes for the database directories:

  -v shardeum_db:/app/shardeum/db \
  -v relayer_collector_db:/app/relayer-collector/db \

Keys

You will need to generate a collector public and secret key. The public key you will need to provide to the shardeum representative. To generate collector public and secret keys, you can generate them using the following commands:

$ docker run -it ghcr.io/shardeum/ldrpc-docker:itn4-1.16.3 /bin/bash
root@b903ee67f879:/app$ cd shardeum/
root@b903ee67f879:/app/shardeum$ node scripts/generateWallet.js 
Public Key: <your-collector-pubkey>
Secret Key: <your-collector-secretkey>

Build Configuration

The branch configuration is done through build arguments when building the container:

  • SHARDEUM_BRANCH: Branch of the shardeum repository to use
  • RELAYER_COLLECTOR_BRANCH: Branch of the relayer-collector repository to use
  • JSON_RPC_SERVER_BRANCH: Branch of the json-rpc-server repository to use

Examples

docker build -f Dockerfile \
  --build-arg SHARDEUM_BRANCH=itn4-1.16.3 \
  --build-arg RELAYER_COLLECTOR_BRANCH=itn4 \
  --build-arg JSON_RPC_SERVER_BRANCH=itn4 \
  -t shardeum-jsonrpc-ld-all-test .

Troubleshooting

Debugging

you can attach to the container and check list out the services and their status with pm2

$ docker exec -it $(docker ps --format '{{.Names}}' --filter ancestor=ghcr.io/shardeum/ldrpc-docker:itn4-1.16.3) /bin/bash
root@b903ee67f879:/app$ pm2 list

Github actions publishing

You can make builds and publish them via the github actions in this repository. It has inputs to the workflow that get passed to the build args for docker, and wether or not to publish to latest or not.

image

About

A docker compose set up for running the JSON-RPC server in LD (Local Data) mode with all of its dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages