Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator imagefix #84

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- generator*
paths:
- subnet/deployment-generator/**
tags:
Expand Down Expand Up @@ -38,10 +39,11 @@ jobs:
echo "name= xinfinorg/subnet-generator:${{github.ref_name}}" >> $GITHUB_OUTPUT
fi

- name: Load Subnet commit/branch config
- name: Load Subnet commit/branch config (used for genesis gen)
id: commit
run: |
echo commit=$(cat subnet_commit.env) >> $GITHUB_OUTPUT
cat docker/genesis_commit.env
echo commit=$(cat docker/genesis_commit.env) >> $GITHUB_OUTPUT

- name: Build and push image
run: |
Expand Down
67 changes: 52 additions & 15 deletions subnet/deployment-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,70 @@

7. Check out the Subnet UI at `<MAIN_IP>:5000`


## Debug guide (how to know if my subnet is running?)
### Subnet nodes
1. Check logs
### Removing Subnet
1. Change the commands in `commands.txt` to `docker compose ... down`
```
docker logs -f <container_name>
docker compose --env-file docker-compose.env --profile <profile_name> down
```
Assuming log level 4 (default 2), you want to look for logs with blockNum, and blockNum should increase with time.

2. Check chainstate
2. Repeat 1. for every docker `--profile` that was started.

3. Inside `generated` directory, remove `bootnodes`, `stats-service`, and `xdcchain*` directories

## Debug guide (how to know if my subnet is running?)
### Subnet nodes

Exec into the subnet container
1. Check chainstate with curl, you can change `localhost:8545` to your subnet node's RPC PORT

docker exec -it <container_name> bash
Call current block api

```
curl --location 'http://localhost:8545' \
--header 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","method":"XDPoS_getV2BlockByNumber","params":["latest"],"id":1}'
```

Check current peers

```
curl --location 'http://localhost:8545' \
--header 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","method":"admin_peers","params":[],"id":1}'
```

2. Check chainstate inside docker

Exec into the subnet container

```
docker exec -it <container_name> bash
```

Attach to the API process

```
XDC attach /work/xdcchain/XDC.ipc
```

Call current block api

```
XDPoS.getV2Block()
```

Attach to the API process
Check current peers

XDC attach /work/xdcchain/XDC.ipc
```
admin.peers
```

Call current block api
3. Check logs, assuming log level 4 (default 2), you want to look for logs with blockNum, and blockNum should increase with time.

XDPoS.getV2Block()
```
docker logs -f <container_name>
```

Check current peers

admin.peers

### Subnet Services
1. Bootnode
Expand Down
2 changes: 1 addition & 1 deletion subnet/deployment-generator/docker/deploy_csc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ cd /app/contract
remove0x=${PARENTCHAIN_WALLET_PK:2}
echo "PRIVATE_KEY=${remove0x}" >> .env
cp /app/generated/deployment.json /app/contract/deployment.json
npx hardhat run /app/contract/scripts/deployment.js --network xdcparentnet
npx hardhat run /app/contract/scripts/fullCheckpointDeploy.js --network xdcparentnet
4 changes: 2 additions & 2 deletions subnet/deployment-generator/script/gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ function genCommands(num_machines, network_name, network_id, num_subnet, keys){
commands+=` docker compose --env-file docker-compose.env --profile ${machine_name} up -d\n\n` //composeV2
}

commands+=`\nmachine1: deploy checkpoint smart contract\n`
commands+=`\nmachine1: deploy checkpoint smart contract (please be mindful of docker image tag if you are not using 'latest' \n`
commands+=` docker run --env-file docker.env \\
-v $(pwd)/generated/deployment.json:/app/generated/deployment.json \\
--entrypoint 'bash' generator ./deploy_csc.sh \n`
--entrypoint 'bash' xinfinorg/subnet-generator:latest ./deploy_csc.sh \n` //how to inject version other than latest??
commands+=` make an edit to ./config/common.env to include values for CHECKPOINT_CONTRACT \n`

commands+=`\nmachine1: start services and frontend\n`
Expand Down