Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Sep 5, 2024
1 parent cbc5ee5 commit 5f22093
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 250 deletions.
50 changes: 20 additions & 30 deletions docs/deployment/1_launch_subnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,47 @@ sidebar_label: "1. Launch a Subnet"
sidebar_position: 1
---

<!-- # Launch a Subnet -->
# Launch a Subnet
# Generate Subnet Configs With UI

## 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: 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](./2_debug_guide.md#common-issues).
- OS: Mac is only supported for single machine testing environment.

- docker, docker compose V2. For manual installation of docker compose V2 please refer to: https://docs.docker.com/compose/install/linux/

## Steps
1. Create a `docker.env` file with parameters similar to [`docker.env.example`](https://github.com/XinFinOrg/XinFin-Node/blob/master/subnet/deployment-generator/script/docker.env.example). Detailed parameters explanation [here](./3_configs_explanation.md).
- Recommended Hardware (per single Subnet node):
- CPU: 2 Core
- Memory: 4 GB

## Generate Subnet Configs With UI

2. Pull the `generator.sh` script from the generator Github repo
1. Pull `generator.sh` script from the generator Github repo
```
curl -O https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/subnet/deployment-generator/script/generate.sh
curl -O https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/generator-ui-concept/subnet/deployment-generator/scripts/generate.sh
```

3. Generate configurations, this will create a new `generated` directory
2. Run the configuration generator, this will start a local webserver
```
chmod +x generate.sh
./generate.sh
cd generated
```

4. follow the generated instructions in `commands.txt` to start Subnet Nodes and [make sure they are mining](./2_debug_guide.md#subnet-nodes).
3. Go to [http://localhost:3000/](http://localhost:3000) in your browser. If you are running the generator on a remote server you can first use ssh tunnel: `ssh -N -L localhost:3000:localhost:3000 <username>@<ip_address> -i <private_key_file>`

5. 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 in `common.env`, the added ENVs include `PROXY_GATEWAY`, `FULL_CSC`, `LITE_CSC`, `CHECKPOINT_CONTRACT`.
4. Config the Subnet options per your requirement.
![UI](./img/ui.png)

6. follow the generated instructions in `commands.txt` to start the Subnet Services (relayer, stats-server, frontend)
5. follow the generated instructions in `commands.txt`. In general, the steps are:
- start Subnet Nodes
- deploy CSC
- deploy XDC-Zero (optional)
- start Subnet Services (relayer, stats-server, frontend)

7. Check out the Subnet UI at `<MAIN_IP>:5555`
6. Once successfully deployed, check out [UI usage guide] here

### Removing Subnet
## Removing Subnet
1. Change the commands in `commands.txt` to `docker compose ... down`
```
docker compose --env-file docker-compose.env --profile <profile_name> down
Expand Down
94 changes: 0 additions & 94 deletions docs/deployment/2_debug_guide.md

This file was deleted.

7 changes: 7 additions & 0 deletions docs/deployment/2_faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_label: "2. FAQ"
sidebar_position: 2
---

# FAQ
## WIP
90 changes: 0 additions & 90 deletions docs/deployment/3_configs_explanation.md

This file was deleted.

16 changes: 16 additions & 0 deletions docs/deployment/3_troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sidebar_label: "3. Troubleshooting"
sidebar_position: 3
---

# Debug guide (how to know if my subnet is running?)
## Common Issues

1. Subnet node does not boot with error log `Fatal: Error starting protocol stack: listen unix /work/xdcchain/XDC.ipc: bind: invalid argument`

This is due to the volume mount path being too long. The mounth path is your current directory (also can check with `pwd` command). Please move the `generated` folder to a shorter path and try again.

2. Docker image startup fails with `SIGKILL` or `Error code: 137` found in logs. (Issue found in Frontend image)

This error occurs because Docker ran Out Of Memory (OOM). You can increase the memory limit in [Docker settings](https://docs.docker.com/desktop/settings/mac/#:~:text=lower%20the%20number.-,Memory,-.%20By%20default%2C%20Docker)

36 changes: 0 additions & 36 deletions docs/deployment/5_upgrading_the_subnet.md

This file was deleted.

Binary file added docs/deployment/img/ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5f22093

Please sign in to comment.