Skip to content

Commit

Permalink
reorg and add content
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Sep 11, 2024
1 parent 01c7a2a commit a2f174f
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 13 deletions.
Binary file added docs/.DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion docs/deployment/1_launch_subnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ sidebar_position: 1
cd generated
```

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>`
3. Go to [http://localhost:3000/](http://localhost:3000) in your browser.
<details>
<summary>If you are running this on a remote server.</summary>
<p>
first use ssh tunnel: <code>ssh -N -L localhost:3000:localhost:3000 USERNAME@IP_ADDRESS -i SERVER_KEY_FILE</code>
</p>
</details>


4. Config the Subnet options per your requirement.
![UI](./img/ui.png)
Expand Down
70 changes: 70 additions & 0 deletions docs/deployment/2_configs_explanation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
sidebar_label: "2. Configs Explanation"
sidebar_position: 2
---

# Configs Explanation

## Files under 'generated' directory
After the generator has succesfully run, all generated files will be under 'generated' directory. These files can be edited if you would like to further customize your subnet. Below is a description of each generated file and how it is used.

- commands.txt - The generated instructions to launch the subnet.
- common.env - The config parameters for Subnet services.
- contract_deploy.env - The config file used for CSC deployment.
- subnet*.env - The config parameters for each Subnet node.
- genesis.json - The 'block 0' of the Subnet. Initializes the blockchain for subnet nodes.
- genesis_input.yml - An intermediate file used in config generation.
- keys.json - Generated keypairs or custom keypairs by user input. Please be mindful to keep the credentials secure.
- docker-compose.yml - The main deployment file. Includes docker images versions, startup commands, network configurations.
- docker-compose.env - The config injection path that docker uses to point to other *.env files.

### common.env

### subnet*.env


## Subnet Ports
1. Subnet Nodes - 3 ports are used per each subnet, RPC port, WS port, and Peering port. The port number is incremented by 1 for the next subnet node. For example subnet1's RPC is 8545, subnet2's RPC will be 8546 and so on.
- RPC PORT - 8545, 8546, 8547, ... This is the API port, for outside chain communication to issue transaction or query chaindata.
- WS PORT - 9555, 9556, 9557, ... This is not used currently.
- Peering port - 20303, 20304, 20305, ... This is used for subnet nodes and bootnode peering and communication.
- Subnet ports config can be changed in `subnetX.env` for each individual subnet.
2. Bootnode - port 20301
- Bootnode port can be changed at `BOOTNODE_PORT` under `common.env`. Also in each `subnetX.env`, `BOOTNODES` port has to be changed.
3. Stats Server (UI backend) - port 3000.
4. UI Frontend - port 5000.
5. Relayer UI - port 4000.
6. Generator UI - port 5210.
<!-- 7. Explorer UI - port -->


## Updating Configs
### Upgrading Subnet Deployment
#### Create a Subnet backup
1. [Shutdown the subnet](./1_launch_subnet.md#shutdown-subnet )

2. Make a copy of `xdcchain` directory

#### Update Subnet Versions
1. Go to `docker-compose.yml` under `generated` directory.
2. Change the docker image tag of your desired component(s).
3. Run:
```
docker compose --env-file docker-compose.env --profile machine1 up -d
docker compose --env-file docker-compose.env --profile services up -d
```

Using `latest` tag is not recommended since not all components version are not guaranteed to be compatible.

### Updating Services Configs
1. Shut down subnet services
```
docker compose --env-file docker-compose.env --profile services down
```
2. Update configuration (usually ENVs inside common.env file)

3. Start subnet services
```
docker compose --env-file docker-compose.env --profile services up -d
```

7 changes: 0 additions & 7 deletions docs/deployment/2_faq.md

This file was deleted.

30 changes: 25 additions & 5 deletions docs/deployment/3_troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
---
sidebar_label: "3. Troubleshooting"
sidebar_label: "3. Common Issues and Troubleshooting"
sidebar_position: 3
---

# Debug guide (how to know if my subnet is running?)
## Common Issues
# Common Issues
- Subnet blocks are not being mined.
1. First confirm that the Subnet nodes are able to communicate with each other through the network layer. Run the check peer script `generated/scripts/check-peers.sh` the number of peers should be one less than number of subnet nodes.

1. Subnet node does not boot with error log `Fatal: Error starting protocol stack: listen unix /work/xdcchain/XDC.ipc: bind: invalid argument`
2. If the nodes are peering but still not mining, it could be a low memory issue. In Docker configs you can try to increase memory or swap. Then, in case of fresh Subnet, delete data and start the nodes again. ![Docker Memory Config](./img/docker_mem.png)

3. Docker engine in Mac OS can be inconsistent after long-running or high-load. It could help to restart the machine and [hard reset the subnet](./1_launch_subnet.md#deleting-subnet ) to get it running.

- 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)
- 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)




# Troubleshooting Scripts
- `generated/scripts/check-mining.sh`

This will check your current block in Subnet

- `generated/scripts/check-peers.sh`

This will check the number of peers of your Subnet node


# Telegram Troubleshooting Support Group
https://t.me/+jvkX6LaLEEthZWM1
28 changes: 28 additions & 0 deletions docs/deployment/5_faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sidebar_label: "5. FAQ"
sidebar_position: 5
---

# Frequently Asked Questions

- For testing, should I use devnet or testnet?

Testnet, devnet will be less stable due to frequent updates.

- How do I transfer Subnet tokens to other users?

In XDC-Subnet all initial tokens are assigned to the Grandmaster wallet (check keys.json). You can use any web3 wallet, point it to a Subnet node's RPC and send tokens over to other addresses.

- Which files contain sensitive data and private keys?

common.env, contract_deploy.env, and keys.json. Please make sure these files are kept securely.

- This function didn't work/I have encoutered an unexpected bug

Please report the issue via [Telegram Support Group](./3_troubleshooting.md#telegram-troubleshooting-support-group) and we will check as soon as possible.

Other channels for suggestions/requests include [XDC Forum](https://forum.xinfin.org/) and [GitHub Issues](https://github.com/XinFinOrg/XDC-Subnet/issues)

- How do I change the Relayer Wallet/Parentchain Wallet?

You can [update services configs](./2_configs_explanation.md#updating-services-configs) in common.env to change the Relayer key
Binary file added docs/deployment/img/docker_mem.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 a2f174f

Please sign in to comment.