Skip to content

Commit

Permalink
ip
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Sep 30, 2024
1 parent 3a58ad0 commit 418b8da
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-phones-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": minor
---

add espersso dev node to cartesi run
10 changes: 10 additions & 0 deletions apps/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export default class Run extends BaseCommand<typeof Run> {
"disable local paymaster service to save machine resources",
summary: "disable paymaster service",
}),
"enable-espresso": Flags.boolean({
default: false,
description: "enable Espresso development node ",
summary: "enable Espresso development node",
}),
"epoch-length": Flags.integer({
description: "length of an epoch (in blocks)",
default: 720,
Expand Down Expand Up @@ -153,6 +158,11 @@ export default class Run extends BaseCommand<typeof Run> {
composeFiles.push("docker-compose-paymaster.yaml");
}

// espresso development node
if (flags["enable-espresso"]) {
composeFiles.push("docker-compose-espresso.yaml");
}

// load the no-backend compose file
if (flags["no-backend"]) {
composeFiles.push("docker-compose-host.yaml");
Expand Down
4 changes: 3 additions & 1 deletion apps/cli/src/node/docker-compose-database.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
services:
database:
image: postgres:15-alpine
image: postgres:16-alpine
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres || exit 1"]
interval: 10s
timeout: 5s
retries: 5
environment:
- POSTGRES_PASSWORD=password
ports:
- 5432:5432
71 changes: 71 additions & 0 deletions apps/cli/src/node/docker-compose-espresso.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
services:
espresso_database_creator:
image: postgres:16-alpine
command: ["createdb", "sequencer"]
depends_on:
database:
condition: service_healthy
environment:
PGHOST: ${PGHOST:-database}
PGPORT: ${PGPORT:-5432}
PGUSER: ${PGUSER:-postgres}
PGPASSWORD: ${PGPASSWORD:-password}
PGDATABASE: ${PGDATABASE:-postgres}

espresso:
image: ghcr.io/espressosystems/espresso-sequencer/espresso-dev-node:20240925
#image: espresso-dev-node:local
command: ["/usr/bin/espresso-dev-node"]
deploy:
resources:
limits:
cpus: "4"
memory: "1G"
ports:
- 8770:8770
- 8771:8771
- 8772:8772
- 20000:20000
depends_on:
espresso_database_creator:
condition: service_completed_successfully
database:
condition: service_healthy
environment:
ESPRESSO_SEQUENCER_L1_PROVIDER: ${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}
ESPRESSO_SEQUENCER_API_PORT: 8770
ESPRESSO_BUILDER_PORT: 8771
ESPRESSO_PROVER_PORT: 8772
ESPRESSO_DEV_NODE_PORT: 20000
ESPRESSO_SEQUENCER_POSTGRES_HOST: database
ESPRESSO_SEQUENCER_POSTGRES_PORT: 5432
ESPRESSO_SEQUENCER_POSTGRES_USER: postgres
ESPRESSO_SEQUENCER_POSTGRES_PASSWORD: password
ESPRESSO_SEQUENCER_POSTGRES_DATABASE: sequencer
ESPRESSO_SEQUENCER_ETH_MNEMONI: ${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}

prompt:
image: debian:bookworm-slim
environment:
PROMPT_TXT_07_ESPRESSO: "Espresso running at http://localhost:${CARTESI_LISTEN_PORT}/espresso/"

traefik-config-generator:
environment:
TRAEFIK_CONFIG_ESPRESSO: |
http:
routers:
espresso:
rule: "PathPrefix(`/espresso`)"
middlewares:
- "remove-espresso-prefix"
service: espresso
middlewares:
remove-espresso-prefix:
replacePathRegex:
regex: "^/espresso/(.*)"
replacement: "/$1"
services:
espresso:
loadBalancer:
servers:
- url: "http://espresso:8770"
2 changes: 1 addition & 1 deletion apps/cli/src/node/docker-compose-explorer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
database_creator:
image: postgres:15-alpine
image: postgres:16-alpine
command: ["createdb", "squid"]
depends_on:
database:
Expand Down
23 changes: 23 additions & 0 deletions espresso-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Sequencer API

### Status API

```shell
curl -fsSL http://localhost:8770/status/block-height

curl -fsSL http://localhost:8770/status/success-rate

curl -fsSL http://localhost:8770/status/time-since-last-decide

curl -fsSL http://localhost:8770/status/metrics
```

### Node API

```shell
curl -fsSL http://localhost:8770/node/block-height

curl -fsSL http://localhost:8770/node/transactions/count

curl -fsSL http://localhost:8770/node/payloads/total-size
```

0 comments on commit 418b8da

Please sign in to comment.