A docker setup for running the JSON-RPC server in LD (Local Data) mode with all of its dependencies
This docker container is meant to run all the services in the right dotted box of the diagram below.
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
- 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
- The JSON-RPC server will be available at
http://localhost:8080
- 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_docker.mov
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 archiverARCHIVER_PUBKEY
: Public key of the archiverDISTRIBUTOR_IP
: IP address of the distributorDISTRIBUTOR_PUBKEY
: Public key of the distributorCOLLECTOR_PUBKEY
: Your collector public keyCOLLECTOR_SECRETKEY
: Your collector secret keyCOLLECTOR_MODE
: Mode of the collector - useMQ
, WS is deprecatedRMQ_HOST
: Host of the RabbitMQ serverRMQ_PORT
: Port of the RabbitMQ serverRMQ_PROTOCOL
: Protocol of the RabbitMQ serverRMQ_USER
: User of the RabbitMQ serverRMQ_PASS
: Password of the RabbitMQ serverRMQ_CYCLES_QUEUE_NAME
: Name of the cycles queueRMQ_RECEIPTS_QUEUE_NAME
: Name of the receipts queueRMQ_ORIGINAL_TXS_QUEUE_NAME
: Name of the original transactions queue
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 \
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>
The branch configuration is done through build arguments when building the container:
SHARDEUM_BRANCH
: Branch of the shardeum repository to useRELAYER_COLLECTOR_BRANCH
: Branch of the relayer-collector repository to useJSON_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 .
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
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.