From 04cba2b61542cf8106e3642fbc649895b4cfb022 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Wed, 30 Oct 2024 10:36:31 -0300 Subject: [PATCH] fixup! wip --- apps/cli/src/commands/run.ts | 13 ------- apps/cli/src/node/default.env | 16 ++++---- apps/cli/src/node/docker-compose-anvil.yaml | 39 +++++++------------ .../cli/src/node/docker-compose-database.yaml | 8 +++- 4 files changed, 31 insertions(+), 45 deletions(-) diff --git a/apps/cli/src/commands/run.ts b/apps/cli/src/commands/run.ts index 76f22a1e..4dd12bb6 100644 --- a/apps/cli/src/commands/run.ts +++ b/apps/cli/src/commands/run.ts @@ -116,19 +116,6 @@ export default class Run extends BaseCommand { CARTESI_LISTEN_PORT: listenPort.toString(), CARTESI_VALIDATOR_CPUS: flags.cpus?.toString(), CARTESI_VALIDATOR_MEMORY: flags.memory?.toString(), - CARTESI_POSTGRES_ENDPOINT: - "postgres://postgres:password@database:5432/postgres?sslmode=disable", - CARTESI_BLOCKCHAIN_HTTP_ENDPOINT: "http://anvil:8545", - CARTESI_BLOCKCHAIN_WS_ENDPOINT: "ws://anvil:8545", - CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: - "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6", - CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER: "7", - CARTESI_AUTH_MNEMONIC: - "test test test test test test test test test test test junk", - CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS: - "0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3", - CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS: - "0xB897F7Fe78f220aE34B7FA9493092701a873Ed45", }; // validator diff --git a/apps/cli/src/node/default.env b/apps/cli/src/node/default.env index e324d3cc..044dbf66 100644 --- a/apps/cli/src/node/default.env +++ b/apps/cli/src/node/default.env @@ -18,25 +18,27 @@ CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY="${CARTESI_EVM_READER_RETRY_POLICY_MAX # blockchain CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-31337}" -CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="http://anvil:8545" -CARTESI_BLOCKCHAIN_WS_ENDPOINT="ws://anvil:8545" +CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}" +CARTESI_BLOCKCHAIN_WS_ENDPOINT="${CARTESI_BLOCKCHAIN_WS_ENDPOINT:-ws://anvil:8545}" CARTESI_LEGACY_BLOCKCHAIN_ENABLED="${CARTESI_LEGACY_BLOCKCHAIN_ENABLED:-false}" CARTESI_BLOCKCHAIN_FINALITY_OFFSET="${CARTESI_BLOCKCHAIN_FINALITY_OFFSET:-0}" CARTESI_EVM_READER_DEFAULT_BLOCK="${CARTESI_EVM_READER_DEFAULT_BLOCK:-latest}" CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT="${CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT:-60}" #contracts -CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="0x593E5BCf894D6829Dd26D0810DA7F064406aebB6" -CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="7" +CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x593E5BCf894D6829Dd26D0810DA7F064406aebB6}" +CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-7}" +CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3}" +CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS:-0xB897F7Fe78f220aE34B7FA9493092701a873Ed45}" # snapshot -CARTESI_SNAPSHOT_DIR="/usr/share/rollups-node/snapshot" +CARTESI_SNAPSHOT_DIR="${CARTESI_SNAPSHOT_DIR:-/usr/share/rollups-node/snapshot}" # auth -CARTESI_AUTH_MNEMONIC="test test test test test test test test test test test junk" +CARTESI_AUTH_MNEMONIC="${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}" # postgres -CARTESI_POSTGRES_ENDPOINT="postgres://postgres:password@database:5432/postgres?sslmode=disable" +CARTESI_POSTGRES_ENDPOINT="${CARTESI_POSTGRES_ENDPOINT:-postgres://postgres:password@database:5432/postgres?sslmode=disable}" # http CARTESI_HTTP_ADDRESS="${CARTESI_HTTP_ADDRESS:-0.0.0.0}" diff --git a/apps/cli/src/node/docker-compose-anvil.yaml b/apps/cli/src/node/docker-compose-anvil.yaml index 6ea187df..fe3393d0 100644 --- a/apps/cli/src/node/docker-compose-anvil.yaml +++ b/apps/cli/src/node/docker-compose-anvil.yaml @@ -29,30 +29,21 @@ services: env_file: - ${CARTESI_BIN_PATH}/node/default.env command: - [ - "cartesi-rollups-cli", - "app", - "deploy", - "--print-json", - "--postgres-endpoint", - "${CARTESI_POSTGRES_ENDPOINT}", - "--rpc-url", - "${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT}", - "--inputbox-block-number", - "${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER}", - "--mnemonic", - "${CARTESI_AUTH_MNEMONIC}", - "--epoch-length", - "${CARTESI_EPOCH_LENGTH}", - "--app-factory", - "${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS}", - "--authority-factory", - "${CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS}", - "--app-owner", - "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "--template-path", - "${CARTESI_SNAPSHOT_DIR}", - ] + - /bin/bash + - -c + - -x + - | + cartesi-rollups-cli app deploy \ + --print-json \ + --postgres-endpoint "$$CARTESI_POSTGRES_ENDPOINT" \ + --rpc-url "$$CARTESI_BLOCKCHAIN_HTTP_ENDPOINT" \ + --inputbox-block-number "$$CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER" \ + --mnemonic "$$CARTESI_AUTH_MNEMONIC" \ + --epoch-length "$$CARTESI_EPOCH_LENGTH" \ + --app-factory "$$CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS" \ + --authority-factory "$$CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS" \ + --app-owner "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" \ + --template-path $$CARTESI_SNAPSHOT_DIR prompt: image: debian:bookworm-slim diff --git a/apps/cli/src/node/docker-compose-database.yaml b/apps/cli/src/node/docker-compose-database.yaml index dac4bb12..17e34d65 100644 --- a/apps/cli/src/node/docker-compose-database.yaml +++ b/apps/cli/src/node/docker-compose-database.yaml @@ -11,7 +11,13 @@ services: migration: image: cartesi/rollups-node:devel - command: cartesi-rollups-cli db upgrade -p ${CARTESI_POSTGRES_ENDPOINT} + command: + - /bin/bash + - -c + - -x + - | + cartesi-rollups-cli db upgrade -p "$$CARTESI_POSTGRES_ENDPOINT" + depends_on: database: condition: service_healthy