@cartesi/cli 2.0.0-alpha.4 → 2.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/base.d.ts +18 -0
  2. package/dist/base.d.ts.map +1 -0
  3. package/dist/base.js +103 -0
  4. package/dist/builder/directory.d.ts.map +1 -1
  5. package/dist/builder/docker.d.ts.map +1 -1
  6. package/dist/builder/empty.d.ts.map +1 -1
  7. package/dist/builder/none.d.ts.map +1 -1
  8. package/dist/builder/tar.d.ts.map +1 -1
  9. package/dist/commands/address-book.d.ts +4 -8
  10. package/dist/commands/address-book.d.ts.map +1 -1
  11. package/dist/commands/address-book.js +15 -14
  12. package/dist/commands/build.d.ts +5 -11
  13. package/dist/commands/build.d.ts.map +1 -1
  14. package/dist/commands/build.js +16 -28
  15. package/dist/commands/clean.d.ts +2 -7
  16. package/dist/commands/clean.d.ts.map +1 -1
  17. package/dist/commands/clean.js +9 -10
  18. package/dist/commands/create.d.ts +5 -14
  19. package/dist/commands/create.d.ts.map +1 -1
  20. package/dist/commands/create.js +36 -51
  21. package/dist/commands/deploy/build.d.ts +2 -14
  22. package/dist/commands/deploy/build.d.ts.map +1 -1
  23. package/dist/commands/deploy/build.js +8 -61
  24. package/dist/commands/deploy.d.ts +3 -0
  25. package/dist/commands/deploy.d.ts.map +1 -0
  26. package/dist/commands/deploy.js +12 -0
  27. package/dist/commands/doctor.d.ts +2 -12
  28. package/dist/commands/doctor.d.ts.map +1 -1
  29. package/dist/commands/doctor.js +96 -91
  30. package/dist/commands/hash.d.ts +4 -9
  31. package/dist/commands/hash.d.ts.map +1 -1
  32. package/dist/commands/hash.js +14 -14
  33. package/dist/commands/rollups/deploy.d.ts +16 -0
  34. package/dist/commands/rollups/deploy.d.ts.map +1 -0
  35. package/dist/commands/rollups/deploy.js +225 -0
  36. package/dist/commands/rollups/logs.d.ts +11 -0
  37. package/dist/commands/rollups/logs.d.ts.map +1 -0
  38. package/dist/commands/rollups/logs.js +32 -0
  39. package/dist/commands/rollups/start.d.ts +14 -0
  40. package/dist/commands/rollups/start.d.ts.map +1 -0
  41. package/dist/commands/rollups/start.js +209 -0
  42. package/dist/commands/rollups/status.d.ts +7 -0
  43. package/dist/commands/rollups/status.d.ts.map +1 -0
  44. package/dist/commands/rollups/status.js +46 -0
  45. package/dist/commands/rollups/stop.d.ts +5 -0
  46. package/dist/commands/rollups/stop.d.ts.map +1 -0
  47. package/dist/commands/rollups/stop.js +26 -0
  48. package/dist/commands/rollups.d.ts +6 -0
  49. package/dist/commands/rollups.d.ts.map +1 -0
  50. package/dist/commands/rollups.js +19 -0
  51. package/dist/commands/run.d.ts +2 -21
  52. package/dist/commands/run.d.ts.map +1 -1
  53. package/dist/commands/run.js +9 -199
  54. package/dist/commands/send/erc20.d.ts +11 -13
  55. package/dist/commands/send/erc20.d.ts.map +1 -1
  56. package/dist/commands/send/erc20.js +57 -52
  57. package/dist/commands/send/erc721.d.ts +11 -13
  58. package/dist/commands/send/erc721.d.ts.map +1 -1
  59. package/dist/commands/send/erc721.js +51 -46
  60. package/dist/commands/send/ether.d.ts +11 -12
  61. package/dist/commands/send/ether.d.ts.map +1 -1
  62. package/dist/commands/send/ether.js +25 -21
  63. package/dist/commands/send/generic.d.ts +12 -14
  64. package/dist/commands/send/generic.d.ts.map +1 -1
  65. package/dist/commands/send/generic.js +92 -97
  66. package/dist/commands/send.d.ts +21 -0
  67. package/dist/commands/send.d.ts.map +1 -0
  68. package/dist/commands/send.js +67 -0
  69. package/dist/commands/shell.d.ts +6 -14
  70. package/dist/commands/shell.d.ts.map +1 -1
  71. package/dist/commands/shell.js +21 -43
  72. package/dist/compose/rollups/default.env +35 -0
  73. package/dist/compose/rollups/docker-compose-anvil.yaml +15 -0
  74. package/dist/{node → compose/rollups}/docker-compose-bundler.yaml +14 -25
  75. package/dist/{node → compose/rollups}/docker-compose-database.yaml +4 -2
  76. package/dist/compose/rollups/docker-compose-espresso.yaml +103 -0
  77. package/dist/{node → compose/rollups}/docker-compose-explorer.yaml +23 -37
  78. package/dist/compose/rollups/docker-compose-graphql.yaml +52 -0
  79. package/dist/compose/rollups/docker-compose-node-cpus.yaml +7 -0
  80. package/dist/compose/rollups/docker-compose-node-memory.yaml +6 -0
  81. package/dist/compose/rollups/docker-compose-node.yaml +39 -0
  82. package/dist/compose/rollups/docker-compose-paymaster.yaml +21 -0
  83. package/dist/compose/rollups/docker-compose-proxy.yaml +22 -0
  84. package/dist/compose/rollups/proxy/bundler.yaml +17 -0
  85. package/dist/compose/rollups/proxy/espresso-reader.yaml +17 -0
  86. package/dist/compose/rollups/proxy/espresso.yaml +56 -0
  87. package/dist/compose/rollups/proxy/explorer-api.yaml +17 -0
  88. package/dist/compose/rollups/proxy/explorer.yaml +10 -0
  89. package/dist/compose/rollups/proxy/graphql.yaml +10 -0
  90. package/dist/compose/rollups/proxy/paymaster.yaml +17 -0
  91. package/dist/compose/rollups/proxy/rollups-node.yaml +17 -0
  92. package/dist/config.d.ts +1 -1
  93. package/dist/config.d.ts.map +1 -1
  94. package/dist/config.js +1 -1
  95. package/dist/contracts.d.ts.map +1 -1
  96. package/dist/exec/cartesi-machine.d.ts.map +1 -1
  97. package/dist/exec/crane.d.ts +1 -1
  98. package/dist/exec/crane.d.ts.map +1 -1
  99. package/dist/exec/genext2fs.d.ts.map +1 -1
  100. package/dist/exec/mksquashfs.d.ts.map +1 -1
  101. package/dist/exec/rollups.d.ts +17 -0
  102. package/dist/exec/rollups.d.ts.map +1 -0
  103. package/dist/exec/rollups.js +40 -0
  104. package/dist/exec/util.d.ts +1 -1
  105. package/dist/exec/util.d.ts.map +1 -1
  106. package/dist/index.d.ts +2 -1
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +53 -1
  109. package/dist/machine.d.ts.map +1 -1
  110. package/dist/prompts.d.ts.map +1 -1
  111. package/dist/wallet.d.ts.map +1 -1
  112. package/dist/wallet.js +29 -6
  113. package/package.json +28 -45
  114. package/bin/dev.cmd +0 -3
  115. package/bin/dev.js +0 -25
  116. package/bin/run.cmd +0 -3
  117. package/bin/run.js +0 -8
  118. package/dist/baseCommand.d.ts +0 -22
  119. package/dist/baseCommand.d.ts.map +0 -1
  120. package/dist/baseCommand.js +0 -92
  121. package/dist/commands/deploy/index.d.ts +0 -12
  122. package/dist/commands/deploy/index.d.ts.map +0 -1
  123. package/dist/commands/deploy/index.js +0 -78
  124. package/dist/commands/send/index.d.ts +0 -28
  125. package/dist/commands/send/index.d.ts.map +0 -1
  126. package/dist/commands/send/index.js +0 -102
  127. package/dist/flags.d.ts +0 -17
  128. package/dist/flags.d.ts.map +0 -1
  129. package/dist/flags.js +0 -28
  130. package/dist/node/DockerfileDeploy.txt +0 -4
  131. package/dist/node/default.env +0 -27
  132. package/dist/node/docker-compose-anvil.yaml +0 -50
  133. package/dist/node/docker-compose-envfile.yaml +0 -4
  134. package/dist/node/docker-compose-espresso.yaml +0 -127
  135. package/dist/node/docker-compose-host.yaml +0 -30
  136. package/dist/node/docker-compose-paymaster.yaml +0 -33
  137. package/dist/node/docker-compose-prompt.yaml +0 -17
  138. package/dist/node/docker-compose-proxy.yaml +0 -48
  139. package/dist/node/docker-compose-snapshot-volume.yaml +0 -8
  140. package/dist/node/docker-compose-validator-cpus.yaml +0 -6
  141. package/dist/node/docker-compose-validator-memory.yaml +0 -6
  142. package/dist/node/docker-compose-validator.yaml +0 -59
  143. package/oclif.manifest.json +0 -883
@@ -0,0 +1,67 @@
1
+ import { Command } from "@commander-js/extra-typings";
2
+ import input from "@inquirer/input";
3
+ import select from "@inquirer/select";
4
+ import { isAddress } from "viem";
5
+ import { parseAddress } from "../base.js";
6
+ import { getApplicationAddress } from "../exec/rollups.js";
7
+ import createClients, { supportedChains } from "../wallet.js";
8
+ import { createErc20Command } from "./send/erc20.js";
9
+ import { createErc721Command } from "./send/erc721.js";
10
+ import { createEtherCommand } from "./send/ether.js";
11
+ import { createGenericCommand } from "./send/generic.js";
12
+ export const connect = (options) => {
13
+ const { chainId, rpcUrl, mnemonic, mnemonicIndex } = options;
14
+ // create viem clients
15
+ return createClients({
16
+ chain: supportedChains({ includeDevnet: true }).find((c) => c.id == chainId),
17
+ rpcUrl,
18
+ mnemonicPassphrase: mnemonic,
19
+ mnemonicIndex,
20
+ });
21
+ };
22
+ export const getInputApplicationAddress = async (dapp) => {
23
+ if (dapp && isAddress(dapp)) {
24
+ // honor the flag
25
+ return dapp;
26
+ }
27
+ // get the running container dapp address
28
+ const nodeAddress = await getApplicationAddress();
29
+ // query for the address
30
+ const applicationAddress = await input({
31
+ message: "Application address",
32
+ validate: (value) => isAddress(value) || "Invalid address",
33
+ default: nodeAddress,
34
+ });
35
+ return applicationAddress;
36
+ };
37
+ export const createSendCommand = () => {
38
+ const command = new Command("send")
39
+ .description("Sends different kinds of input to the application in interactive mode.")
40
+ .option("--chain-id <id>", "Chain ID", parseInt, 31337)
41
+ .option("--rpc-url <url>", "RPC URL")
42
+ .option("--mnemonic <phrase>", "Mnemonic passphrase")
43
+ .option("--mnemonic-index <index>", "Mnemonic account index", parseInt, 0)
44
+ .option("--dapp <address>", "Application address", parseAddress, undefined)
45
+ .action(async (options, program) => {
46
+ // Get the registered subcommands from the program
47
+ const commands = program.commands;
48
+ // Create choices for the select prompt based on registered commands
49
+ const choices = commands.map((cmd) => ({
50
+ name: cmd.name(),
51
+ value: cmd,
52
+ description: cmd.description(),
53
+ }));
54
+ // Present the list of subcommands using @inquirer/select
55
+ const subcommand = await select({
56
+ message: "Select the type of input to send",
57
+ choices,
58
+ });
59
+ // Execute the selected subcommand
60
+ subcommand.parseAsync(program.args);
61
+ });
62
+ command.addCommand(createGenericCommand());
63
+ command.addCommand(createErc20Command());
64
+ command.addCommand(createErc721Command());
65
+ command.addCommand(createEtherCommand());
66
+ return command;
67
+ };
@@ -1,15 +1,7 @@
1
- import { BaseCommand } from "../baseCommand.js";
2
- export default class Shell extends BaseCommand<typeof Shell> {
3
- static description: string;
4
- static examples: string[];
5
- static args: {
6
- image: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
7
- };
8
- static flags: {
9
- command: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- config: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
- "run-as-root": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
- };
13
- run(): Promise<void>;
14
- }
1
+ import { Command } from "@commander-js/extra-typings";
2
+ export declare const createShellCommand: () => Command<[string | undefined], {
3
+ command: string;
4
+ config: string;
5
+ runAsRoot: boolean;
6
+ }, {}>;
15
7
  //# sourceMappingURL=shell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/commands/shell.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW,CAAC,OAAO,KAAK,CAAC;IACxD,MAAM,CAAC,WAAW,SAAqD;IAEvE,MAAM,CAAC,QAAQ,WAA2C;IAE1D,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,KAAK;;;;MAgBV;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2CpC"}
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/commands/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAOtD,eAAO,MAAM,kBAAkB;;;;MAiD9B,CAAC"}
@@ -1,65 +1,43 @@
1
- import { Args, Flags } from "@oclif/core";
1
+ import { Command } from "@commander-js/extra-typings";
2
2
  import fs from "fs-extra";
3
3
  import path from "path";
4
- import { BaseCommand } from "../baseCommand.js";
4
+ import { getApplicationConfig, getContextPath } from "../base.js";
5
5
  import { bootMachine } from "../machine.js";
6
- class Shell extends BaseCommand {
7
- async run() {
8
- const { flags } = await this.parse(Shell);
6
+ export const createShellCommand = () => {
7
+ return new Command("shell")
8
+ .argument("[image]", "image ID|name")
9
+ .option("--command <command>", "shell command to run", "/bin/sh")
10
+ .option("-c, --config <config>", "path to the configuration file", "cartesi.toml")
11
+ .option("--run-as-root", "run as root user", false)
12
+ .action(async (image, { command, config, runAsRoot }) => {
9
13
  // get application configuration from 'cartesi.toml'
10
- const config = this.getApplicationConfig(flags.config);
14
+ const c = getApplicationConfig(config);
11
15
  // destination directory for image and intermediate files
12
- const destination = path.resolve(this.getContextPath());
16
+ const destination = path.resolve(getContextPath());
13
17
  // check if all drives are built
14
- for (const [name, drive] of Object.entries(config.drives)) {
18
+ for (const [name, drive] of Object.entries(c.drives)) {
15
19
  const filename = `${name}.${drive.format}`;
16
- const pathname = this.getContextPath(filename);
20
+ const pathname = getContextPath(filename);
17
21
  if (!fs.existsSync(pathname)) {
18
- throw new Error(`drive '${name}' not built, run '${this.config.bin} build'`);
22
+ throw new Error(`drive '${name}' not built, run 'build'`);
19
23
  }
20
24
  }
21
25
  // create shell entrypoint
22
26
  const info = {
23
27
  cmd: [],
24
- entrypoint: [this.flags.command],
28
+ entrypoint: [command],
25
29
  env: [],
26
30
  workdir: "/",
27
31
  };
28
32
  // start with interactive mode on
29
- config.machine.interactive = true;
33
+ c.machine.interactive = true;
30
34
  // interactive mode can't have final hash
31
- config.machine.finalHash = false;
35
+ c.machine.finalHash = false;
32
36
  // do not store machine in interactive mode
33
- config.machine.store = undefined;
37
+ c.machine.store = undefined;
34
38
  // run as root if flag is set
35
- config.machine.user = flags["run-as-root"] ? "root" : undefined;
39
+ c.machine.user = runAsRoot ? "root" : undefined;
36
40
  // boot machine
37
- await bootMachine(config, info, destination);
38
- }
39
- }
40
- Shell.description = "Start a shell in cartesi machine of application";
41
- Shell.examples = ["<%= config.bin %> <%= command.id %>"];
42
- Shell.args = {
43
- image: Args.string({
44
- description: "image ID|name",
45
- required: false,
46
- }),
41
+ await bootMachine(c, info, destination);
42
+ });
47
43
  };
48
- Shell.flags = {
49
- command: Flags.string({
50
- default: "/bin/sh",
51
- description: "shell command to run",
52
- summary: "shell to run",
53
- }),
54
- config: Flags.file({
55
- char: "c",
56
- default: "cartesi.toml",
57
- summary: "path to the configuration file",
58
- }),
59
- "run-as-root": Flags.boolean({
60
- default: false,
61
- description: "run as root user",
62
- summary: "run the cartesi machine as the root user",
63
- }),
64
- };
65
- export default Shell;
@@ -0,0 +1,35 @@
1
+ # cartesi/rollups-node
2
+
3
+ #logs
4
+ CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-info}"
5
+
6
+ # features
7
+ CARTESI_FEATURE_INPUT_READER_ENABLED="${CARTESI_FEATURE_INPUT_READER_ENABLED:-true}"
8
+ CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED="${CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED:-true}"
9
+ CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-false}"
10
+
11
+ # rollups
12
+ CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES="${CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES:-3}"
13
+ CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY="${CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY:-3}"
14
+ CARTESI_ADVANCER_POLLING_INTERVAL="${CARTESI_ADVANCER_POLLING_INTERVAL:-3}"
15
+ CARTESI_VALIDATOR_POLLING_INTERVAL="${CARTESI_VALIDATOR_POLLING_INTERVAL:-3}"
16
+ CARTESI_CLAIMER_POLLING_INTERVAL="${CARTESI_CLAIMER_POLLING_INTERVAL:-3}"
17
+ CARTESI_MAX_STARTUP_TIME="${CARTESI_MAX_STARTUP_TIME:-15}"
18
+
19
+ # blockchain
20
+ CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-31337}"
21
+ CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}"
22
+ CARTESI_BLOCKCHAIN_WS_ENDPOINT="${CARTESI_BLOCKCHAIN_WS_ENDPOINT:-ws://anvil:8545}"
23
+ CARTESI_BLOCKCHAIN_DEFAULT_BLOCK="${CARTESI_BLOCKCHAIN_DEFAULT_BLOCK:-finalized}"
24
+
25
+ # contracts
26
+ CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x593E5BCf894D6829Dd26D0810DA7F064406aebB6}"
27
+ CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-1}"
28
+ CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0xd7d4d184b82b1a4e08f304DDaB0A2A7a301C2620}"
29
+ CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS:-0xB897F7Fe78f220aE34B7FA9493092701a873Ed45}"
30
+
31
+ # auth
32
+ CARTESI_AUTH_MNEMONIC="${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}"
33
+
34
+ # postgres
35
+ CARTESI_DATABASE_CONNECTION="postgres://postgres:password@database:5432/postgres?sslmode=disable"
@@ -0,0 +1,15 @@
1
+ services:
2
+ anvil:
3
+ image: ${CARTESI_SDK_IMAGE}
4
+ command: ["devnet", "--block-time", "${BLOCK_TIME:-5}"]
5
+ healthcheck:
6
+ test: ["CMD", "eth_isready"]
7
+ start_period: 10s
8
+ start_interval: 200ms
9
+ interval: 10s
10
+ timeout: 1s
11
+ retries: 5
12
+ environment:
13
+ ANVIL_IP_ADDR: 0.0.0.0
14
+ ports:
15
+ - 8545:8545
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  alto:
3
- image: cartesi/sdk:0.12.0-alpha.3
3
+ image: ${CARTESI_SDK_IMAGE}
4
4
  command:
5
5
  - "alto"
6
6
  - "--entrypoints"
@@ -30,28 +30,17 @@ services:
30
30
  - "--polling-interval"
31
31
  - "100"
32
32
  - "--enable-debug-endpoints"
33
- prompt:
34
- image: debian:bookworm-slim
35
- environment:
36
- PROMPT_TXT_06_BUNDLER: "Bundler running at http://localhost:${CARTESI_LISTEN_PORT}/bundler/rpc"
33
+ healthcheck:
34
+ test: ["CMD", "curl", "-fsS", "http://127.0.0.1:4337/health"]
35
+ start_period: 10s
36
+ start_interval: 200ms
37
+ interval: 10s
38
+ timeout: 1s
39
+ retries: 5
37
40
 
38
- traefik-config-generator:
39
- environment:
40
- TRAEFIK_CONFIG_BUNDLER: |
41
- http:
42
- routers:
43
- bundler:
44
- rule: "PathPrefix(`/bundler`)"
45
- middlewares:
46
- - "remove-bundler-prefix"
47
- service: bundler
48
- middlewares:
49
- remove-bundler-prefix:
50
- replacePathRegex:
51
- regex: "^/bundler/(.*)"
52
- replacement: "/$1"
53
- services:
54
- bundler:
55
- loadBalancer:
56
- servers:
57
- - url: "http://alto:4337"
41
+ proxy:
42
+ depends_on:
43
+ bundler:
44
+ condition: service_healthy
45
+ volumes:
46
+ - ./proxy/bundler.yaml:/etc/traefik/conf.d/bundler.yaml
@@ -1,10 +1,12 @@
1
1
  services:
2
2
  database:
3
- image: postgres:16-alpine
3
+ image: postgres:16
4
4
  healthcheck:
5
5
  test: ["CMD-SHELL", "pg_isready -U postgres || exit 1"]
6
+ start_period: 10s
7
+ start_interval: 200ms
6
8
  interval: 10s
7
- timeout: 5s
9
+ timeout: 1s
8
10
  retries: 5
9
11
  environment:
10
12
  - POSTGRES_PASSWORD=password
@@ -0,0 +1,103 @@
1
+ services:
2
+ espresso_database_creator:
3
+ image: postgres:16
4
+ command: ["createdb", "sequencer"]
5
+ depends_on:
6
+ database:
7
+ condition: service_healthy
8
+ environment:
9
+ PGHOST: database
10
+ PGPORT: 5432
11
+ PGUSER: postgres
12
+ PGPASSWORD: password
13
+ PGDATABASE: postgres
14
+
15
+ espresso:
16
+ image: ${CARTESI_SDK_IMAGE}
17
+ command: ["espresso-dev-node"]
18
+ deploy:
19
+ resources:
20
+ limits:
21
+ cpus: "4"
22
+ memory: "1G"
23
+ ports:
24
+ - 8770:8770
25
+ - 8771:8771
26
+ - 8772:8772
27
+ - 20000:20000
28
+ depends_on:
29
+ espresso_database_creator:
30
+ condition: service_completed_successfully
31
+ anvil:
32
+ condition: service_healthy
33
+ environment:
34
+ ESPRESSO_SEQUENCER_L1_PROVIDER: ${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}
35
+ ESPRESSO_SEQUENCER_API_PORT: 8770
36
+ ESPRESSO_BUILDER_PORT: 8771
37
+ ESPRESSO_PROVER_PORT: 8772
38
+ ESPRESSO_DEV_NODE_PORT: 20000
39
+ ESPRESSO_SEQUENCER_POSTGRES_HOST: database
40
+ ESPRESSO_SEQUENCER_POSTGRES_PORT: 5432
41
+ ESPRESSO_SEQUENCER_POSTGRES_USER: postgres
42
+ ESPRESSO_SEQUENCER_POSTGRES_PASSWORD: password
43
+ ESPRESSO_SEQUENCER_POSTGRES_DATABASE: sequencer
44
+ ESPRESSO_SEQUENCER_ETH_MNEMONIC: ${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}
45
+ ESPRESSO_SEQUENCER_L1_POLLING_INTERVAL: "1s"
46
+ ESPRESSO_STATE_PROVER_UPDATE_INTERVAL: "1s"
47
+ healthcheck:
48
+ test:
49
+ [
50
+ "CMD",
51
+ "curl",
52
+ "-fsS",
53
+ "http://127.0.0.1:8770/status/block-height",
54
+ ]
55
+ start_period: 10s
56
+ start_interval: 200ms
57
+ interval: 10s
58
+ timeout: 1s
59
+ retries: 5
60
+
61
+ rollups-node:
62
+ environment:
63
+ CARTESI_FEATURE_INPUT_READER_ENABLED: false
64
+
65
+ espresso_reader_migration:
66
+ image: ${CARTESI_SDK_IMAGE}
67
+ command:
68
+ - migrate
69
+ - -source
70
+ - file:///usr/share/cartesi/rollups-espresso-reader/migrations
71
+ - -database
72
+ - postgres://postgres:password@database:5432/postgres?sslmode=disable&x-migrations-table=espresso_schema_migrations
73
+ - up
74
+ depends_on:
75
+ rollups-node-migration:
76
+ condition: service_completed_successfully
77
+
78
+ espresso_reader:
79
+ image: ${CARTESI_SDK_IMAGE}
80
+ command: ["cartesi-rollups-espresso-reader"]
81
+ env_file:
82
+ - ${CARTESI_BIN_PATH}/compose/rollups/default.env
83
+ ports:
84
+ - 8081
85
+ depends_on:
86
+ espresso_reader_migration:
87
+ condition: service_completed_successfully
88
+ espresso:
89
+ condition: service_healthy
90
+ environment:
91
+ CARTESI_POSTGRES_ENDPOINT: postgres://postgres:password@database:5432/postgres?sslmode=disable
92
+ ESPRESSO_SERVICE_ENDPOINT: ":8081"
93
+ ESPRESSO_BASE_URL: http://espresso:8770
94
+ ESPRESSO_NAMESPACE: 51025
95
+ ESPRESSO_STARTING_BLOCK: 101
96
+
97
+ proxy:
98
+ depends_on:
99
+ espresso:
100
+ condition: service_healthy
101
+ volumes:
102
+ - ./proxy/espresso.yaml:/etc/traefik/conf.d/espresso.yaml
103
+ - ./proxy/espresso-reader.yaml:/etc/traefik/conf.d/espresso-reader.yaml
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  database_creator:
3
- image: postgres:16-alpine
3
+ image: postgres:16
4
4
  command: ["createdb", "squid"]
5
5
  depends_on:
6
6
  database:
@@ -23,6 +23,19 @@ services:
23
23
  expose:
24
24
  - 4350
25
25
  command: ["sqd", "serve:prod"]
26
+ healthcheck:
27
+ test:
28
+ [
29
+ "CMD",
30
+ "curl",
31
+ "-fsS",
32
+ "http://127.0.0.1:4350/graphql?query=%7B__typename%7D",
33
+ ]
34
+ start_period: 10s
35
+ start_interval: 200ms
36
+ interval: 10s
37
+ timeout: 1s
38
+ retries: 5
26
39
  depends_on:
27
40
  database_creator:
28
41
  condition: service_completed_successfully
@@ -50,39 +63,12 @@ services:
50
63
  database_creator:
51
64
  condition: service_completed_successfully
52
65
 
53
- prompt:
54
- image: debian:bookworm-slim
55
- environment:
56
- PROMPT_TXT_04_EXPLORER: "Explorer running at http://localhost:${CARTESI_LISTEN_PORT}/explorer/"
57
-
58
- traefik-config-generator:
59
- environment:
60
- TRAEFIK_CONFIG_EXPLORER_API: |
61
- http:
62
- routers:
63
- explorer-api:
64
- rule: "PathPrefix(`/explorer-api`)"
65
- middlewares:
66
- - "remove-explorer-api-prefix"
67
- service: explorer-api
68
- middlewares:
69
- remove-explorer-api-prefix:
70
- replacePathRegex:
71
- regex: "^/explorer-api/(.*)"
72
- replacement: "/$1"
73
- services:
74
- explorer-api:
75
- loadBalancer:
76
- servers:
77
- - url: "http://explorer_api:4350"
78
- TRAEFIK_CONFIG_EXPLORER: |
79
- http:
80
- routers:
81
- explorer:
82
- rule: "PathPrefix(`/explorer`)"
83
- service: explorer
84
- services:
85
- explorer:
86
- loadBalancer:
87
- servers:
88
- - url: "http://explorer:3000"
66
+ proxy:
67
+ depends_on:
68
+ explorer_api:
69
+ condition: service_healthy
70
+ explorer:
71
+ condition: service_healthy
72
+ volumes:
73
+ - ./proxy/explorer.yaml:/etc/traefik/conf.d/explorer.yaml
74
+ - ./proxy/explorer-api.yaml:/etc/traefik/conf.d/explorer-api.yaml
@@ -0,0 +1,52 @@
1
+ services:
2
+ graphql_database_creator:
3
+ image: postgres:16
4
+ command: ["createdb", "graphql"]
5
+ depends_on:
6
+ database:
7
+ condition: service_healthy
8
+ environment:
9
+ PGHOST: database
10
+ PGPORT: 5432
11
+ PGUSER: postgres
12
+ PGPASSWORD: password
13
+ PGDATABASE: postgres
14
+
15
+ graphql_database_migration:
16
+ image: ${CARTESI_SDK_IMAGE}
17
+ command:
18
+ - migrate
19
+ - -path
20
+ - /usr/share/cartesi/rollups-graphql/migrations
21
+ - -database
22
+ - postgres://postgres:password@database:5432/graphql?sslmode=disable
23
+ - up
24
+ depends_on:
25
+ graphql_database_creator:
26
+ condition: service_completed_successfully
27
+
28
+ graphql:
29
+ image: ${CARTESI_SDK_IMAGE}
30
+ environment:
31
+ POSTGRES_GRAPHQL_DB_URL: postgres://postgres:password@database:5432/graphql?sslmode=disable
32
+ POSTGRES_NODE_DB_URL: postgres://postgres:password@database:5432/postgres?sslmode=disable
33
+ expose:
34
+ - 8080
35
+ command: ["cartesi-rollups-graphql"]
36
+ healthcheck:
37
+ test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8080/health"]
38
+ start_period: 10s
39
+ start_interval: 200ms
40
+ interval: 10s
41
+ timeout: 1s
42
+ retries: 5
43
+ depends_on:
44
+ graphql_database_migration:
45
+ condition: service_completed_successfully
46
+
47
+ proxy:
48
+ depends_on:
49
+ graphql:
50
+ condition: service_healthy
51
+ volumes:
52
+ - ./proxy/graphql.yaml:/etc/traefik/conf.d/graphql.yaml
@@ -0,0 +1,7 @@
1
+ services:
2
+ rollups-node:
3
+ ptofiles: [cpu]
4
+ deploy:
5
+ resources:
6
+ limits:
7
+ cpus: "${CARTESI_ROLLUPS_NODE_CPUS}"
@@ -0,0 +1,6 @@
1
+ services:
2
+ rollups-node:
3
+ deploy:
4
+ resources:
5
+ limits:
6
+ memory: "${CARTESI_ROLLUPS_NODE_MEMORY}M"
@@ -0,0 +1,39 @@
1
+ services:
2
+ rollups-node-migration:
3
+ image: ${CARTESI_SDK_IMAGE}
4
+ command: ["cartesi-rollups-cli", "db", "upgrade"]
5
+ depends_on:
6
+ database:
7
+ condition: service_healthy
8
+ restart: "no"
9
+ env_file:
10
+ - ${CARTESI_BIN_PATH}/compose/rollups/default.env
11
+
12
+ rollups-node:
13
+ image: ${CARTESI_SDK_IMAGE}
14
+ depends_on:
15
+ rollups-node-migration:
16
+ condition: service_completed_successfully
17
+ anvil:
18
+ condition: service_healthy
19
+ expose:
20
+ - "10000"
21
+ - "10011"
22
+ - "10012"
23
+ healthcheck:
24
+ test: ["CMD", "curl", "-fsS", "http://127.0.0.1:10000/livez"]
25
+ start_period: 10s
26
+ start_interval: 200ms
27
+ interval: 10s
28
+ timeout: 1s
29
+ retries: 5
30
+ command: ["cartesi-rollups-node"]
31
+ env_file:
32
+ - ${CARTESI_BIN_PATH}/compose/rollups/default.env
33
+
34
+ proxy:
35
+ depends_on:
36
+ rollups-node:
37
+ condition: service_healthy
38
+ volumes:
39
+ - ./proxy/rollups-node.yaml:/etc/traefik/conf.d/rollups-node.yaml
@@ -0,0 +1,21 @@
1
+ services:
2
+ paymaster:
3
+ image: ${CARTESI_SDK_IMAGE}
4
+ command: "mock-verifying-paymaster"
5
+ environment:
6
+ - ALTO_RPC=http://bundler:4337
7
+ - ANVIL_RPC=http://anvil:8545
8
+ healthcheck:
9
+ test: ["CMD", "curl", "-fsS", "http://127.0.0.1:3000/ping"]
10
+ start_period: 10s
11
+ start_interval: 200ms
12
+ interval: 10s
13
+ timeout: 1s
14
+ retries: 5
15
+
16
+ proxy:
17
+ depends_on:
18
+ paymaster:
19
+ condition: service_healthy
20
+ volumes:
21
+ - ./proxy/paymaster.yaml:/etc/traefik/conf.d/paymaster.yaml
@@ -0,0 +1,22 @@
1
+ services:
2
+ proxy:
3
+ image: traefik:v3.3.4
4
+ healthcheck:
5
+ test: ["CMD", "traefik", "healthcheck", "--ping"]
6
+ start_period: 10s
7
+ start_interval: 200ms
8
+ interval: 10s
9
+ timeout: 1s
10
+ retries: 5
11
+ command:
12
+ [
13
+ "--ping=true",
14
+ "--entryPoints.web.address=:8088",
15
+ "--entryPoints.traefik.address=:8080",
16
+ "--metrics.prometheus=true",
17
+ "--metrics.prometheus.addServicesLabels=true",
18
+ "--providers.file.directory=/etc/traefik/conf.d",
19
+ "--providers.file.watch=true",
20
+ ]
21
+ ports:
22
+ - ${CARTESI_LISTEN_PORT:-8080}:8088
@@ -0,0 +1,17 @@
1
+ http:
2
+ routers:
3
+ bundler:
4
+ rule: "PathPrefix(`/bundler`)"
5
+ middlewares:
6
+ - "remove-bundler-prefix"
7
+ service: bundler
8
+ middlewares:
9
+ remove-bundler-prefix:
10
+ replacePathRegex:
11
+ regex: "^/bundler/(.*)"
12
+ replacement: "/$1"
13
+ services:
14
+ bundler:
15
+ loadBalancer:
16
+ servers:
17
+ - url: "http://bundler:4337"