This docker compose file simplifies the deployment of Polygon Edge in containerized environment.
The trouble with this deployment is that the chain needs to be initialized before the server can be started.
Before starting the chain two worker containers are started so that the chain can be initialized and destroyed after the job is done.
Blockchain data and genesis.json
are persisted with volumes bind mounts.
docker
and docker-compose
Clone repo or simply copy paste docker-compse.yaml
and run docker-compose up. Docker compose docs
This will start a chain with default parameters.
You should be able to interact with the chain on the default http port ( port 80 )
To test this run curl localhost
, you should get a responce Polygon Edge JSON-RPC
You can customise the genesis.json file parameters, by adding your own parameters to the command: ["-mode","genesis"]
.
The available options are:
-num-nodes ( default 4 )
-premine account:ammount
-chain-id ( default 5100 )
-chain-name ( default polygon-edge )
-block-gas-limit
-epoch-size
the rest are defaults from genesis command.
For example, if we would like to set chain name the command for genesis-ledge
container would be command: ["-mode","genesis","-chain-name","my-awsome-chain"]
.
To customize server command follow the cli commands docs.
For every node, you can add additional arguments to the command:
field.
If you'd like to run more than default 4 nodes, the following rules must be applied:
init-ledge
andgenesis-ledge
containers must run with-num-nodes
parameter, defining the total number of nodes- the name of node data volume must match container name
- no arbitrary container names are allowed, container name must start with node + the node number
- the container and volume names must increment in steps of 1 ( node1, node2, etc. )
init-ledge
andgenesis-ledge
must have data directories of all nodes, named as described above
The additional container is nginx proxy with very basic config file, bind mounted for easy configuration. Nginx is proxying JSON-RPC requests to all 4 nodes with round-robin method. You can easily configure this config file to suit your needs.