Skip to content

Commit 37aa78c

Browse files
committed
docs: unify node runner documentation with makefile targets
- Redirect build instructions from Node Runners to Developer Getting Started guide for consistency and maintainability - Add run-node Makefile target with NETWORK and VERBOSITY variables - Focus Node Runners documentation on binary execution and Makefile variables only - Document comprehensive CLI parameters in Rust code with examples - Add detailed multiaddr format documentation for peer configuration - Link to Rust API documentation for complete parameter reference - Reference comprehensive Archive Node documentation - Fix parameter name from log-level to verbosity to match actual CLI This creates a cleaner separation where build instructions are centralized in the tested Developer guide, while Node Runners focuses on runtime configuration using simple Makefile targets.
1 parent 148d26b commit 37aa78c

File tree

3 files changed

+164
-86
lines changed

3 files changed

+164
-86
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ OPENMINA_LIBP2P_PORT ?= 8302
2222

2323
# Utilities
2424
NETWORK ?= devnet
25+
VERBOSITY ?= info
2526
GIT_COMMIT := $(shell git rev-parse --short=8 HEAD)
2627

2728
.PHONY: help
@@ -38,7 +39,7 @@ build-ledger: download-circuits ## Build the ledger binary and library, requires
3839

3940
.PHONY: build-release
4041
build-release: ## Build the project in release mode
41-
cargo build --release --package=cli --bin openmina
42+
@cargo build --release --package=cli --bin openmina
4243

4344
.PHONY: build-testing
4445
build-testing: ## Build the testing binary with scenario generators
@@ -294,6 +295,11 @@ docker-build-test: ## Build test Docker image
294295
docker build -t $(DOCKER_ORG)/openmina-test:$(GIT_COMMIT) \
295296
-f node/testing/docker/Dockerfile.test node/testing/docker/
296297

298+
# Node running targets
299+
.PHONY: run-node
300+
run-node: build-release ## Run a basic node (NETWORK=devnet, VERBOSITY=info)
301+
@cargo run --release --package=cli --bin openmina -- node --network $(NETWORK) --verbosity $(VERBOSITY)
302+
297303
# Postgres related targets + archive node
298304
.PHONY: run-archive
299305
run-archive: build-release ## Run an archive node with local storage

cli/src/commands/node/mod.rs

Lines changed: 107 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,41 @@ use node::{
2020

2121
use openmina_node_native::{archive::config::ArchiveStorageOptions, tracing, NodeBuilder};
2222

23-
/// Openmina node
23+
/// OpenMina node configuration and runtime options
24+
///
25+
/// This struct defines all available command-line parameters for running an OpenMina node.
26+
/// The node can operate in different modes (basic node, block producer, archive node)
27+
/// depending on the parameters provided.
28+
///
29+
/// # Basic Usage
30+
///
31+
/// ```bash
32+
/// # Run a basic node on devnet
33+
/// openmina node --network devnet
34+
///
35+
/// # Run with custom ports and logging
36+
/// openmina node --network devnet --port 3001 --libp2p-port 8303 --verbosity debug
37+
/// ```
38+
///
39+
/// # Block Producer Mode
40+
///
41+
/// ```bash
42+
/// # Run as block producer
43+
/// openmina node --network devnet --producer-key /path/to/key --coinbase-receiver B62q...
44+
/// ```
45+
///
46+
/// # Archive Node Mode
47+
///
48+
/// ```bash
49+
/// # Run as archive node with local storage
50+
/// openmina node --network devnet --archive-local-storage
51+
/// ```
2452
#[derive(Debug, clap::Args)]
2553
pub struct Node {
54+
/// Working directory for node data, logs, and configuration files
55+
///
56+
/// Can be set via OPENMINA_HOME environment variable.
57+
/// Defaults to ~/.openmina
2658
#[arg(
2759
long,
2860
short = 'd',
@@ -31,7 +63,10 @@ pub struct Node {
3163
)]
3264
pub work_dir: String,
3365

34-
/// Peer secret key
66+
/// P2P networking secret key for node identity
67+
///
68+
/// If not provided, a new key will be generated automatically.
69+
/// Can be set via OPENMINA_P2P_SEC_KEY environment variable.
3570
#[arg(long, short = 's', env = "OPENMINA_P2P_SEC_KEY")]
3671
pub p2p_secret_key: Option<SecretKey>,
3772

@@ -49,15 +84,28 @@ pub struct Node {
4984
#[arg(long)]
5085
pub libp2p_external_ip: Vec<String>,
5186

52-
/// Http port to listen on
87+
/// HTTP server port for RPC API and web interface
88+
///
89+
/// The node will serve its HTTP API and dashboard on this port.
90+
/// Default: 3000
5391
#[arg(long, short, env, default_value = "3000")]
5492
pub port: u16,
5593

56-
/// LibP2P port to listen on
94+
/// LibP2P networking port for peer-to-peer communication
95+
///
96+
/// This port is used for connecting to other nodes in the network.
97+
/// Default: 8302
5798
#[arg(long, env, default_value = "8302")]
5899
pub libp2p_port: u16,
59100

60-
/// Verbosity level (options: trace, debug, info, warn, error)
101+
/// Logging verbosity level
102+
///
103+
/// Controls the amount of logging output. Options in order of verbosity:
104+
/// - error: Only show errors
105+
/// - warn: Show warnings and errors
106+
/// - info: Show informational messages, warnings, and errors (default)
107+
/// - debug: Show debug information and all above
108+
/// - trace: Show all possible logging output
61109
#[arg(long, short, env, default_value = "info")]
62110
pub verbosity: Level,
63111

@@ -73,21 +121,71 @@ pub struct Node {
73121
#[arg(long, env = "OPENMINA_LOG_PATH", default_value = "$OPENMINA_HOME")]
74122
pub log_path: String,
75123

124+
/// Initial peers to connect to on startup
125+
///
126+
/// Specify peer multiaddresses to connect to when the node starts.
127+
/// Can be used multiple times to add multiple peers.
128+
///
129+
/// # Multiaddr Format
130+
///
131+
/// Multiaddresses follow the format: `/protocol/address/protocol/port/protocol/peer_id`
132+
///
133+
/// **IPv4 Example:**
134+
/// ```
135+
/// /ip4/192.168.1.100/tcp/8302/p2p/12D3KooWABCDEF1234567890abcdef...
136+
/// ```
137+
///
138+
/// **IPv6 Example:**
139+
/// ```
140+
/// /ip6/2001:db8::1/tcp/8302/p2p/12D3KooWABCDEF1234567890abcdef...
141+
/// ```
142+
///
143+
/// **DNS Example:**
144+
/// ```
145+
/// /dns4/node.example.com/tcp/8302/p2p/12D3KooWABCDEF1234567890abcdef...
146+
/// ```
147+
///
148+
/// Where:
149+
/// - `ip4/ip6/dns4` specifies the address type
150+
/// - IP address or hostname
151+
/// - `tcp` protocol with port number (typically 8302 for OpenMina)
152+
/// - `p2p` protocol with the peer's public key identifier
76153
#[arg(long, short = 'P', alias = "peer")]
77154
pub peers: Vec<P2pConnectionOutgoingInitOpts>,
78155

79-
/// File containing initial peers.
156+
/// File containing initial peers to connect to
80157
///
81-
/// Each line should contain peer's multiaddr.
158+
/// Each line should contain a peer's multiaddr following the format described above.
159+
///
160+
/// **Example file content:**
161+
/// ```
162+
/// /ip4/192.168.1.100/tcp/8302/p2p/12D3KooWABCDEF1234567890abcdef...
163+
/// /ip4/10.0.0.50/tcp/8302/p2p/12D3KooWXYZ9876543210fedcba...
164+
/// /dns4/bootstrap.example.com/tcp/8302/p2p/12D3KooW123ABC...
165+
/// ```
166+
///
167+
/// Empty lines and lines starting with `#` are ignored.
82168
#[arg(long, env)]
83169
pub peer_list_file: Option<PathBuf>,
84170

85-
/// File containing initial peers.
171+
/// URL to fetch initial peers list from
86172
///
87-
/// Each line should contain peer's multiaddr.
173+
/// The URL should return a text file with one peer multiaddr per line,
174+
/// using the same format as described in `peer_list_file`.
175+
/// Useful for dynamic peer discovery from a central bootstrap service.
176+
///
177+
/// **Example URL response:**
178+
/// ```
179+
/// /ip4/bootstrap1.example.com/tcp/8302/p2p/12D3KooW...
180+
/// /ip4/bootstrap2.example.com/tcp/8302/p2p/12D3KooX...
181+
/// ```
88182
#[arg(long, env)]
89183
pub peer_list_url: Option<Url>,
90184

185+
/// Maximum number of peer connections to maintain
186+
///
187+
/// The node will attempt to maintain up to this many connections
188+
/// to other peers in the network. Default: 100
91189
#[arg(long, default_value = "100")]
92190
pub max_peers: usize,
93191

Lines changed: 50 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,78 @@
11
# How to build and launch a node from source
22

3-
This installation guide has been tested on Debian and Ubuntu and should work on
4-
most distributions of Linux.
3+
## Building from Source
54

6-
## Prerequisites
5+
For detailed instructions on how to build OpenMina from source, including system
6+
dependencies, toolchain setup, and platform-specific instructions, please refer
7+
to the [Getting Started for Developers](../developers/getting-started.mdx)
8+
guide.
79

8-
Ubuntu or Debian-based Linux distribution with the following packages installed:
10+
The developer guide includes:
911

10-
- `curl`
11-
- `git`
12-
- `libssl-dev`
13-
- `pkg-config`
14-
- `protobuf-compiler`
15-
- `build-essential`
12+
- Tested setup instructions for Ubuntu 22.04, Ubuntu 24.04, and macOS
13+
- Complete toolchain installation (Rust, Node.js, Docker, etc.)
14+
- Build verification and testing procedures
15+
- Environment configuration
1616

17-
Example (debian-based):
17+
## Running the Node
1818

19-
```sh
20-
# Either using "sudo" or as the "root" user
21-
sudo apt install curl git libssl-dev pkg-config protobuf-compiler build-essential
22-
```
23-
24-
Example (macOS):
25-
26-
If you have not yet installed homebrew:
19+
Once you have built OpenMina following the developer guide, you can run the node
20+
using the provided Makefile targets:
2721

28-
```sh
29-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
30-
```
31-
32-
```sh
33-
brew install curl git openssl pkg-config protobuf gcc make
34-
```
22+
### Available Make Targets
3523

36-
## Steps (for Debian-based Linux distros and macOS):
24+
#### Basic Node
3725

38-
Open up the command line and enter the following:
39-
40-
And then:
26+
```bash
27+
# Run a basic node (defaults: NETWORK=devnet, VERBOSITY=info)
28+
make run-node
4129

42-
```sh
43-
# Install rustup and set the default Rust toolchain to 1.84 (newer versions work too)
44-
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.84
45-
# Setup the current shell with rustup
46-
source "$HOME/.cargo/env"
47-
# Clone the openmina repository
48-
git clone https://github.com/openmina/openmina.git
49-
cd openmina/
50-
# Build and run the node
51-
cargo run --release -p cli node
30+
# Run with custom network and verbosity level
31+
make run-node NETWORK=mainnet VERBOSITY=debug
5232
```
5333

54-
# How to launch the UI:
55-
56-
## Prerequisites
57-
58-
### 1. Node.js v20.11.1
59-
60-
#### MacOS
34+
#### Archive Node
6135

6236
```bash
63-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
64-
brew install [email protected]
65-
```
66-
67-
#### Linux
37+
# Run an archive node with local storage
38+
make run-archive
6839

69-
```bash
70-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
71-
source ~/.bashrc
72-
nvm install 20.11.1
40+
# Run archive node on mainnet
41+
make run-archive NETWORK=mainnet
7342
```
7443

75-
#### Windows
44+
For comprehensive archive node setup including different storage options,
45+
database configuration, and Docker Compose deployment, see the detailed
46+
[Archive Node](./archive-node.md) documentation.
7647

77-
Download [Node.js v20.11.1](https://nodejs.org/) from the official website, open
78-
the installer and follow the prompts to complete the installation.
48+
### Configuration Variables
7949

80-
### 2. Angular CLI v16.2.0
50+
The Makefile supports the following configuration variables that can be
51+
overridden:
8152

82-
```bash
83-
npm install -g @angular/[email protected]
84-
```
53+
- `NETWORK` - Network to connect to (default: `devnet`, options: `devnet`,
54+
`mainnet`)
55+
- `VERBOSITY` - Logging verbosity level (default: `info`, options: `error`,
56+
`warn`, `info`, `debug`, `trace`)
8557

86-
### 3. Installation
58+
### Advanced Configuration and CLI Parameters
8759

88-
Open a terminal and navigate to this project's root directory
60+
For detailed information about all available command-line parameters and
61+
advanced configuration options, please refer to the
62+
[Rust API Documentation](https://o1-labs.github.io/openmina/api-docs/cli/commands/node/struct.Node.html)
63+
which contains comprehensive documentation for all supported parameters
64+
including:
8965

90-
```bash
91-
cd PROJECT_LOCATION/openmina/frontend
92-
```
93-
94-
Install the dependencies
95-
96-
```bash
97-
npm install
98-
```
66+
- Network and connection options
67+
- Block producer configuration
68+
- Archive node settings
69+
- Logging and debugging options
70+
- P2P networking parameters
71+
- Snarker configuration
72+
- And more
9973

100-
## Run the application
74+
You can also get help directly from the command line:
10175

10276
```bash
103-
npm start
77+
./target/release/openmina node --help
10478
```

0 commit comments

Comments
 (0)