Skip to content

Commit

Permalink
fixup! feat(cli): restrict rollups-node resources
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Aug 21, 2024
1 parent 9c565b3 commit 4c493a1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions apps/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,13 @@ export default class Run extends BaseCommand<typeof Run> {
}),
cpus: Flags.integer({
description:
"Define the number of CPUs to use (eg.: 1) for the rollups-node, 0 (zero) means unlimited",
"Define the number of CPUs to use (eg.: 1) for the rollups-node",
summary: "number of cpu limits for the rollups-node",
default: 0,
min: 0,
}),
memory: Flags.integer({
description:
"Define the amount of memory to use for the rollups-node in MB (eg.: 1024), 0 (zero) means unlimited",
"Define the amount of memory to use for the rollups-node in MB (eg.: 1024)",
summary: "memory limit for the rollups-node in MB",
default: 0,
min: 0,
}),
"show-config": Flags.boolean({
description: "show the docker compose configuration",
Expand Down Expand Up @@ -118,16 +114,16 @@ export default class Run extends BaseCommand<typeof Run> {
CARTESI_SNAPSHOT_DIR: "/usr/share/rollups-node/snapshot",
CARTESI_BIN_PATH: binPath,
CARTESI_LISTEN_PORT: listenPort.toString(),
CARTESI_VALIDATOR_CPUS: flags.cpus.toString(),
CARTESI_VALIDATOR_MEMORY: flags.memory.toString(),
CARTESI_VALIDATOR_CPUS: flags.cpus?.toString(),
CARTESI_VALIDATOR_MEMORY: flags.memory?.toString(),
};

// validator
const composeFiles = ["docker-compose-validator.yaml"];
if (flags["cpus"] > 0) {
if (flags.cpus) {
composeFiles.push("docker-compose-validator-cpus.yaml");
}
if (flags["memory"] > 0) {
if (flags.memory) {
composeFiles.push("docker-compose-validator-memory.yaml");
}

Expand Down

0 comments on commit 4c493a1

Please sign in to comment.