-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add instructions to run the node with Docker
- Loading branch information
Showing
16 changed files
with
238 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ jobs: | |
version: v1.54.2 | ||
|
||
- name: Check auto generated files | ||
run: make | ||
run: make check-generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,80 @@ | ||
.PHONY: all generate cargo diff | ||
.PHONY: all | ||
all: help | ||
|
||
all: diff | ||
.PHONY: submodules | ||
submodules: ## Download the git submodules | ||
@git submodule update --init --recursive | ||
|
||
generate: | ||
.PHONY: test | ||
test: ## Execute the node tests | ||
@echo "Running the tests" | ||
@go test ./... | ||
|
||
.PHONY: lint | ||
lint: ## Run the linter | ||
@echo "Running the linter" | ||
@golangci-lint run | ||
|
||
.PHONY: generate | ||
generate: ## Generate the file that are commited to the repo | ||
@echo "Generating Go files" | ||
@go mod tidy | ||
@go generate -v ./... | ||
|
||
cargo: | ||
.PHONY: graphql-schema | ||
graphql-schema: ## Generate the graphql schema file | ||
@cd offchain; cargo run --bin generate-schema | ||
@mv offchain/schema.graphql api/graphql/reader.graphql | ||
|
||
diff: cargo generate | ||
.PHONY: check-generate | ||
check-generate: generate graphql-schema ## Check whether the generated files are in sync | ||
@echo "Checking differences on the repository..." | ||
@if git diff --exit-code; then \ | ||
echo "No differences found."; \ | ||
else \ | ||
echo "ERROR: Differences found in the resulting files."; \ | ||
exit 1; \ | ||
fi | ||
|
||
.PHONY: docker-build | ||
docker-build: ## Build the docker images using bake | ||
@cd build && docker buildx bake --load | ||
|
||
.PHONY: docker-run | ||
docker-run: docker-clean ## Run the node with the anvil devnet | ||
@docker compose \ | ||
-f ./build/compose-database.yaml \ | ||
-f ./build/compose-devnet.yaml \ | ||
-f ./build/compose-snapshot.yaml \ | ||
-f ./build/compose-node.yaml \ | ||
up | ||
|
||
.PHONY: docker-run-sepolia | ||
docker-run-sepolia: docker-clean ## Run the node with the sepolia testnet | ||
@if [ ! -n "$$RPC_HTTP_URL" ]; then \ | ||
echo "RPC_HTTP_URL was not set"; \ | ||
exit 1; \ | ||
fi | ||
@if [ ! -n "$$RPC_WS_URL" ]; then \ | ||
echo "RPC_WS_URL was not set"; \ | ||
exit 1; \ | ||
fi | ||
@docker compose \ | ||
-f ./build/compose-database.yaml \ | ||
-f ./build/compose-snapshot.yaml \ | ||
-f ./build/compose-node.yaml \ | ||
-f ./build/compose-sepolia.yaml \ | ||
up | ||
|
||
.PHONY: docker-clean | ||
docker-clean: ## Remove the containers and volumes from previous compose run | ||
@docker compose \ | ||
-f ./build/compose-database.yaml \ | ||
-f ./build/compose-devnet.yaml \ | ||
-f ./build/compose-snapshot.yaml \ | ||
-f ./build/compose-node.yaml \ | ||
down -v | ||
|
||
.PHONY: help | ||
help: ## Show help for each of the Makefile recipes | ||
@grep "##" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/:.*##\(.*\)/:\n\t\1\n/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This compose file contains the PostgreSQL database necessary to run the node. | ||
|
||
version: "3.9" | ||
|
||
name: rollups-node | ||
services: | ||
database: | ||
image: postgres:13-alpine | ||
ports: | ||
- 5432:5432 | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres || exit 1"] | ||
interval: 1s | ||
timeout: 1s | ||
retries: 5 | ||
environment: | ||
- POSTGRES_PASSWORD=password | ||
|
||
node: | ||
depends_on: | ||
database: | ||
condition: service_healthy | ||
environment: | ||
CARTESI_POSTGRES_ENDPOINT: "postgres://postgres:password@database:5432/postgres" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file contains the bare configuration to run the node. | ||
# This file should be merged with the other compose files to run the node with | ||
# the desired configuration. | ||
|
||
version: "3.9" | ||
|
||
name: rollups-node | ||
services: | ||
node: | ||
image: "cartesi/rollups-node:devel" | ||
ports: | ||
- "10000:10000" # Supervisor | ||
- "10004:10004" # GraphQL Server | ||
- "10009:10009" # Inspect Server | ||
environment: | ||
CARTESI_LOG_LEVEL: "info" | ||
CARTESI_LOG_TIMESTAMP: "false" | ||
CARTESI_FEATURE_HOST_MODE: "false" | ||
CARTESI_FEATURE_READER_MODE: "false" | ||
CARTESI_HTTP_ADDRESS: "0.0.0.0" | ||
CARTESI_HTTP_PORT: "10000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This compose file contains the config to run the node with the Sepolia testnet. | ||
# The config points to the echo Python application running in Sepolia. | ||
# It is necessary to set the RPC provider URLs in the RPC_*_URL environment variables. | ||
# Notice the node will run in reader mode, so it doesn't need a Ethereum wallet. | ||
|
||
version: "3.9" | ||
|
||
name: rollups-node | ||
services: | ||
node: | ||
environment: | ||
CARTESI_BLOCKCHAIN_ID: "11155111" | ||
CARTESI_BLOCKCHAIN_HTTP_ENDPOINT: "${RPC_HTTP_URL}" | ||
CARTESI_BLOCKCHAIN_WS_ENDPOINT: "${RPC_WS_URL}" | ||
CARTESI_BLOCKCHAIN_IS_LEGACY: "false" | ||
CARTESI_BLOCKCHAIN_FINALITY_OFFSET: "1" | ||
CARTESI_CONTRACTS_DAPP_ADDRESS: "0x9f12D4365806FC000D6555ACB85c5371b464E506" | ||
CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER: "4152308" | ||
CARTESI_CONTRACTS_HISTORY_ADDRESS: "0x76f4dCaC0920826541EE718214EEE4be07346cEE" | ||
CARTESI_CONTRACTS_AUTHORITY_ADDRESS: "0x5827Ec9365D3a9b27bF1dB982d258Ad234D37242" | ||
CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: "0x59b22D57D4f067708AB0c00552767405926dc768" | ||
CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER: "3963384" | ||
CARTESI_EPOCH_DURATION: "86400" | ||
CARTESI_FEATURE_READER_MODE: "true" | ||
CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This compose file contains cartesi-machine test-application snapshot. | ||
# It creates a dummy container just to create the volume with the snapshot. | ||
|
||
version: "3.9" | ||
|
||
name: rollups-node | ||
services: | ||
machine_snapshot_setup: | ||
image: cartesi/rollups-node-snapshot:devel | ||
volumes: | ||
- machine:/usr/share/cartesi/snapshots | ||
|
||
node: | ||
depends_on: | ||
machine_snapshot_setup: | ||
condition: service_completed_successfully | ||
environment: | ||
CARTESI_SNAPSHOT_DIR: "/usr/share/cartesi/snapshots" | ||
volumes: | ||
- machine:/usr/share/cartesi/snapshots | ||
|
||
volumes: | ||
machine: {} |
Oops, something went wrong.