Launch a Subnet
Overview
For the convenience of deploying Subnet, we have provided the Subnet Deployment Generator. The Subnet Deployment Generator is configuration generator for all components of subnet deployment. It generates all the necessary files and configs from a simple initial docker.env file. The required parameters are
1. How many machines will you use to deploy subnet?
2. How many subnet nodes will you deploy in total?
3. IP address of the main machine
4. Parentchain wallet with funds
In this setup the main machine (machine1) will host all the subnet services(relayer, stats, frontend) while the subnet miner nodes will be spread out among all machines.
The IP address of the main machine is needed for subnet connectivity, this is the IP that is known to all other machines, could be private or public (preferrably private)
Once generated, the commands to startup the subnet is also provided as a generated commands.txt
file.
The deployment is docker based, the main deployment file is docker-compose.yml
. The docker-compose.env
is the injection point to all configs. Then, ENVs for the services and subnet nodes are in *.env
files. Other files include genesis.json
file to initialize subnet chain, deployment.json
to deploy the checkpoint smartcontract, and keys.json
the keypairs for subnet nodes + grandmaster node. Again, these files will be generated by the Subnet Deployment Generator (SDG).
Requirements
OS: Linux. Only Linux is supported for full deployment.
OS: Mac is only supported for single machine testing environment. Specify MacOS with 'OS=mac' in 'docker.env' file. Please also refer common issues.
docker, docker compose V2. For manual installation of docker compose V2 please refer to: https://docs.docker.com/compose/install/linux/
Steps
Create a
docker.env
file with parameters similar todocker.env.example
. Detailed parameters explanation here.Pull the
generator.sh
script from the generator Github repocurl -O https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/subnet/deployment-generator/script/generate.sh
Generate configurations, this will create a new
generated
directorychmod +x generate.sh
./generate.sh
cd generatedfollow the generated instructions in
commands.txt
to start Subnet Nodes and make sure they are mining.follow the generated instructions in
commands.txt
to deploy the upgradable Checkpoint Smart Contract(CSC). If CSC deployment was successful, you should see CSC addresses incommon.env
, the added ENVs includePROXY_GATEWAY
,FULL_CSC
,LITE_CSC
,CHECKPOINT_CONTRACT
.follow the generated instructions in
commands.txt
to start the Subnet Services (relayer, stats-server, frontend)Check out the Subnet UI at
<MAIN_IP>:5555
Removing Subnet
Change the commands in
commands.txt
todocker compose ... down
docker compose --env-file docker-compose.env --profile <profile_name> down
Repeat 1. for every docker
--profile
that was started.Inside
generated
directory, removebootnodes
,stats-service
, andxdcchain*
directories