Skip to content

Commit

Permalink
feat(cli): use cartesi as compose project name
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Sep 19, 2024
1 parent 3a58ad0 commit ad65f74
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-gorillas-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

use cartesi as compose project name
33 changes: 9 additions & 24 deletions apps/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,6 @@ export default class Run extends BaseCommand<typeof Run> {

public async run(): Promise<void> {
const { flags } = await this.parse(Run);
let projectName: string;

if (flags["no-backend"]) {
projectName = "cartesi-node";
} else {
// get machine hash
const hash = this.getMachineHash();
// Check if snapshot exists
if (!hash) {
throw new Error(
`Cartesi machine snapshot not found, run '${this.config.bin} build'`,
);
}
projectName = hash.substring(2, 10);
}

// path of the tool instalation
const binPath = path.join(
Expand Down Expand Up @@ -118,11 +103,18 @@ export default class Run extends BaseCommand<typeof Run> {
CARTESI_VALIDATOR_MEMORY: flags.memory?.toString(),
};

// cartesi project name
const composeFiles = ["docker-compose-cartesi.yaml"];

// validator
const composeFiles = ["docker-compose-validator.yaml"];
composeFiles.push("docker-compose-validator.yaml");

// limit cpu
if (flags.cpus) {
composeFiles.push("docker-compose-validator-cpus.yaml");
}

// limit memory
if (flags.memory) {
composeFiles.push("docker-compose-validator-memory.yaml");
}
Expand Down Expand Up @@ -171,14 +163,7 @@ export default class Run extends BaseCommand<typeof Run> {
.map((f) => ["--file", path.join(binPath, "node", f)])
.flat();

const compose_args = [
"compose",
...files,
"--project-directory",
".",
"--project-name",
projectName,
];
const compose_args = ["compose", ...files, "--project-directory", "."];

const up_args = [];

Expand Down
1 change: 1 addition & 0 deletions apps/cli/src/node/docker-compose-cartesi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: cartesi

0 comments on commit ad65f74

Please sign in to comment.