Skip to content

Commit

Permalink
Merge pull request #93 from peaqnetwork/better-config
Browse files Browse the repository at this point in the history
improved config for performance testing
  • Loading branch information
talhadaar authored Dec 2, 2024
2 parents 164ba33 + 0aa7c20 commit 4a996a6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
30 changes: 30 additions & 0 deletions misc-configs/config.parachain.peaq-dev.100.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,33 @@ parachains:
port: 30443
relaychainFlags: # additional CLI flags for relaychain part
- --name=relaychain-9
- name: collator-10
wsPort: 10055
rpcPort: 20044
port: 30444
relaychainFlags: # additional CLI flags for relaychain part
- --name=relaychain-10
- name: collator-11
wsPort: 10056
rpcPort: 20045
port: 30445
relaychainFlags: # additional CLI flags for relaychain part
- --name=relaychain-11
- name: collator-12
wsPort: 10057
rpcPort: 20046
port: 30446
relaychainFlags: # additional CLI flags for relaychain part
- --name=relaychain-12
- name: collator-13
wsPort: 10058
rpcPort: 20047
port: 30447
relaychainFlags: # additional CLI flags for relaychain part
- --name=relaychain-13
- name: collator-14
wsPort: 10059
rpcPort: 20048
port: 30448
relaychainFlags: # additional CLI flags for relaychain part
- --name=relaychain-14
16 changes: 12 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,13 @@ const generate = async (config: Config, { output, yes }: { output: string; yes:
let idx = 0;
for (const node of config.relaychain.nodes) {
const name = `relaychain-${_.kebabCase(node.name)}`;
const port = node.port || 30333 + idx;

const nodeConfig: DockerNode = {
ports: [
...(node.wsPort === false ? [] : [`${node.wsPort || 9944 + idx}:9944`]),
...(node.rpcPort === false ? [] : [`${node.rpcPort || 9933 + idx}:9933`]),
...(node.port === false ? [] : [`${node.port || 30333 + idx}:30333`]),
...(node.port === false ? [] : [`${port}:${port}`]),
],
volumes: [`${name}:/data`],
build: {
Expand All @@ -544,6 +546,8 @@ const generate = async (config: Config, { output, yes }: { output: string; yes:
'--rpc-external',
'--rpc-cors=all',
`--name=${node.name}`,
'--in-peers=128',
'--out-peers=128',
`--${node.name.toLowerCase()}`,
...(config.relaychain.flags || []),
...(node.flags || []),
Expand All @@ -567,11 +571,13 @@ const generate = async (config: Config, { output, yes }: { output: string; yes:
for (const parachainNode of parachain.nodes) {
const name = `parachain-${parachain.id}-${nodeIdx}`;
const parchainIdArgs = parachain.image.includes('peaq') ? [`--parachain-id=${parachain.id}`] : [];
const port = parachainNode.port || 30333 + idx;

const nodeConfig: DockerNode = {
ports: [
`${parachainNode.wsPort || 9944 + idx}:9944`,
`${parachainNode.rpcPort || 9933 + idx}:9933`,
`${parachainNode.port || 30333 + idx}:30333`,
`${port}:${port}`,
],
volumes: [`${name}:${volumePath}`],
build: {
Expand All @@ -589,8 +595,10 @@ const generate = async (config: Config, { output, yes }: { output: string; yes:
...(parachainNode.flags || []),
nodeIdx === 0
? `--node-key=${nodeKey}`
: `--bootnodes=/dns/parachain-${parachain.id}-0/tcp/30333/p2p/${nodeAddress}`,
'--listen-addr=/ip4/0.0.0.0/tcp/30333',
: `--bootnodes=/dns/parachain-${parachain.id}-0/tcp/40444/p2p/${nodeAddress}`,
`--listen-addr=/ip4/0.0.0.0/tcp/${port}`,
'--in-peers=128',
'--out-peers=128',
...(parchainIdArgs || []),
'--',
`--chain=/app/${config.relaychain.chain}.json`,
Expand Down

0 comments on commit 4a996a6

Please sign in to comment.