Skip to content

Commit

Permalink
feat: Add Doc on run Node without Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoura committed Jan 31, 2024
1 parent c9b4b61 commit 63b5111
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ check-generate: generate graphql-schema ## Check whether the generated files are
exit 1; \
fi

.PHONY: docker-build-deps
docker-build-deps: ## Build the dependencies images using bake
@cd build && docker buildx bake --load rollups-node-devnet rollups-node-snapshot

.PHONY: docker-build
docker-build: ## Build the docker images using bake
@cd build && docker buildx bake --load
Expand Down
60 changes: 60 additions & 0 deletions docs/run-without-docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Run Node Locally without Docker

## Pre-requisites

### Install

[Docker](https://docs.docker.com/engine/install/)
[Redis](https://redis.io/docs/install/install-redis/)
[Cartesi Machine](https://github.com/cartesi/machine-emulator)
[Server Manager](https://github.com/cartesi/server-manager)


### Build Dependencies

Some dependencies needs to be built. Open a shell and execute the command below:

```shell
make docker-build-deps
```


### Save Machine Snapshot

The Node needs an Application Cartesi Machine Snapshot to run. To save one locally, open a shell
and excute the following command:

```shell
go run ./cmd/cartesi-rollups-cli/ save-snapshot
```

This will save Snapshot for a default Echo Application. in order to save a Snapshot for a custom application
please check cartesi-rollups-cli `save-snapshot` command docs


## Run

The Node confguration is done through Environment variables. To quick start with default values open a shell
and execute the following command:

```shell
source ./setup_env.sh
```

Once configured, start the dependencies, on a shell start the Server Manager with the following command:

```shell
server-manager --manager-address=0.0.0.0:5001
```

On other shell, start the other dependencies with the follwing command:

```shell
go run ./cmd/cartesi-rollups-cli/ run-deps
```

Finally start the node by opening another shell and executing the node:

```shell
go run ./cmd/cartesi-rollups-node/
```
27 changes: 27 additions & 0 deletions setup_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export CARTESI_POSTGRES_ENDPOINT=postgres://postgres:password@localhost:5432/postgres
export CARTESI_BLOCKCHAIN_ID=31337
export CARTESI_BLOCKCHAIN_HTTP_ENDPOINT=http://localhost:8545
export CARTESI_BLOCKCHAIN_WS_ENDPOINT=ws://localhost:8545
export CARTESI_BLOCKCHAIN_IS_LEGACY=false
export CARTESI_BLOCKCHAIN_FINALITY_OFFSET=1
export CARTESI_CONTRACTS_DAPP_ADDRESS=0x180763470853cAF642Df79a908F9282c61692A45
export CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER=17
export CARTESI_CONTRACTS_HISTORY_ADDRESS=0xbCc4067dfdeE8274E531951f0968EC895f397A44
export CARTESI_CONTRACTS_AUTHORITY_ADDRESS=0xb090149a3cA43000681B74875500854B54355496
export CARTESI_CONTRACTS_INPUT_BOX_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
export CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER=17
export CARTESI_EPOCH_DURATION=120
export CARTESI_AUTH_MNEMONIC="test test test test test test test test test test test junk"
export CARTESI_LOG_LEVEL=info
export CARTESI_LOG_TIMESTAMP=false
export CARTESI_FEATURE_HOST_MODE=false
export CARTESI_FEATURE_READER_MODE=false
export CARTESI_HTTP_ADDRESS=0.0.0.0
export CARTESI_HTTP_PORT=10000
export CARTESI_SNAPSHOT_DIR=$PWD/machine-snapshot

rust_bin_path="$PWD/offchain/target/debug"
# Check if the path is already in $PATH
if [[ ":$PATH:" != *":$rust_bin_path:"* ]]; then
export PATH=$PATH:$rust_bin_path
fi

0 comments on commit 63b5111

Please sign in to comment.