|
1 | 1 | # Run Archive Node |
2 | 2 |
|
3 | 3 | This guide is intended for setting up archive nodes on **Mina Devnet** only. Do |
4 | | -not use this guide for Mina Mainnet |
| 4 | +not use this guide for Mina Mainnet until necessary security audits are |
| 5 | +complete. |
5 | 6 |
|
6 | | -## Archive Mode Configuration |
| 7 | +--- |
7 | 8 |
|
8 | | -We start archive mode in Mina Rust by setting one of the following flags along |
9 | | -with their associated environment variables: |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +Ensure Docker and Docker Compose are installed on your system - |
| 12 | +[Docker Installation Guide](../appendix/docker-installation) |
10 | 13 |
|
11 | | -### Archiver Process (`--archive-archiver-process`) |
| 14 | +## Download & Start the Archive Node |
12 | 15 |
|
13 | | -Stores blocks in a database by receiving them directly from the Mina Rust node |
| 16 | +1. **Download the Latest Release** |
| 17 | + - Visit the |
| 18 | + [Mina Rust Releases](https://github.com/o1-labs/mina-rust/releases) |
| 19 | + - Download the latest `mina-rust-vX.Y.Z-docker-compose.zip` |
| 20 | + - Extract the Files: |
14 | 21 |
|
15 | | -**Required Environment Variables**: |
| 22 | + ```bash |
| 23 | + unzip mina-rust-vX.Y.Z-docker-compose.zip |
| 24 | + cd mina-rust-vX.Y.Z-docker-compose |
| 25 | + ``` |
16 | 26 |
|
17 | | -- `MINA_ARCHIVE_ADDRESS`: Network address for the archiver service |
| 27 | +2. **Launch Archive Node** |
| 28 | + |
| 29 | + The archive node setup includes a PostgreSQL database, the archiver process, |
| 30 | + and the Mina Rust node. The archiver process stores blocks in the database by |
| 31 | + receiving them from the Mina Rust node. |
| 32 | + |
| 33 | + ```bash |
| 34 | + docker compose -f docker-compose.archive.devnet.yml up -d --pull always |
| 35 | + ``` |
| 36 | + |
| 37 | + **Configuration Options:** |
| 38 | + - `MINA_RUST_TAG` - Docker image tag for the mina-rust node (default: |
| 39 | + `latest`) |
| 40 | + - `POSTGRES_PASSWORD` - Database password for PostgreSQL |
| 41 | + - `PG_PORT` - PostgreSQL port (default: `5432`) |
| 42 | + - `PG_DB` - Database name (default: `archive`) |
| 43 | + |
| 44 | + **Examples with different versions:** |
| 45 | + |
| 46 | + ```bash |
| 47 | + # Use specific version (recommended for production) |
| 48 | + env MINA_RUST_TAG="v1.4.2" \ |
| 49 | + docker compose -f docker-compose.archive.devnet.yml up -d --pull always |
| 50 | +
|
| 51 | + # Use development version (latest features, may be unstable) |
| 52 | + env MINA_RUST_TAG="develop" \ |
| 53 | + docker compose -f docker-compose.archive.devnet.yml up -d --pull always |
| 54 | + ``` |
| 55 | + |
| 56 | +3. **Monitor the Archive Node** |
| 57 | + |
| 58 | + The archive node will be accessible at: |
| 59 | + - **Archive API**: http://localhost:3086 |
| 60 | + - **Node API**: http://localhost:3000 |
| 61 | + |
| 62 | +## Node Parameters Reference |
| 63 | + |
| 64 | +For a complete list of all available archive node parameters and configuration |
| 65 | +options, see the |
| 66 | +[Mina Rust API Documentation](https://o1-labs.github.io/mina-rust/api-docs/mina_cli/commands/node/struct.NodeArgs.html). |
| 67 | +This includes detailed descriptions of: |
| 68 | + |
| 69 | +- **Archive configuration flags**: `--archive-archiver-process`, |
| 70 | + `--archive-local-storage`, `--archive-gcp-storage`, `--archive-aws-storage` |
| 71 | +- **Network settings**: `--libp2p-*`, `--network`, `--port` |
| 72 | +- **Logging and debugging options**: `--verbosity`, `--log-*` |
| 73 | +- **Performance tuning parameters**: Connection limits, timeouts, etc. |
| 74 | +- **Security and validation settings**: Key management, validation options |
| 75 | + |
| 76 | +You can also view available parameters by running: |
| 77 | + |
| 78 | +```bash |
| 79 | +# View all node subcommand options |
| 80 | +mina node --help |
| 81 | +
|
| 82 | +# View specific archive-related options |
| 83 | +mina node --help | grep -A 10 -B 2 archive |
| 84 | +``` |
| 85 | + |
| 86 | +The source code documentation can be found in |
| 87 | +[`cli/src/commands/node/mod.rs`](https://github.com/o1-labs/mina-rust/blob/develop/cli/src/commands/node/mod.rs) |
| 88 | +which contains comprehensive examples and parameter descriptions for all archive |
| 89 | +node configurations. |
18 | 90 |
|
19 | | -### Local Storage (`--archive-local-storage`) |
| 91 | +## Using Make Command |
20 | 92 |
|
21 | | -Stores blocks in the local filesystem |
| 93 | +As an alternative to Docker Compose, you can run the archive node directly using |
| 94 | +the Makefile target. This method requires building from source. |
22 | 95 |
|
23 | | -**Required Environment Variables**: |
| 96 | +### Prerequisites |
24 | 97 |
|
25 | | -- (None) |
| 98 | +- Rust toolchain installed |
| 99 | +- Git repository cloned and accessible |
| 100 | +- PostgreSQL database running and configured |
26 | 101 |
|
27 | | -**Optional Environment Variables**: |
| 102 | +### Archive Mode Configuration |
| 103 | + |
| 104 | +Mina Rust supports multiple archive modes that can be run simultaneously for |
| 105 | +redundancy: |
| 106 | + |
| 107 | +**Archiver Process (`--archive-archiver-process`)** |
| 108 | + |
| 109 | +Stores blocks in a database by receiving them directly from the Mina Rust node. |
| 110 | + |
| 111 | +**Required Environment Variables:** |
| 112 | + |
| 113 | +- `MINA_ARCHIVE_ADDRESS`: Network address for the archiver service |
| 114 | + |
| 115 | +**Local Storage (`--archive-local-storage`)** |
| 116 | + |
| 117 | +Stores blocks in the local filesystem. |
| 118 | + |
| 119 | +**Optional Environment Variables:** |
28 | 120 |
|
29 | 121 | - `MINA_ARCHIVE_LOCAL_STORAGE_PATH`: Custom path for block storage (default: |
30 | | - ~/.mina/archive-precomputed) |
| 122 | + `~/.mina/archive-precomputed`) |
31 | 123 |
|
32 | | -### GCP Storage (`--archive-gcp-storage`) |
| 124 | +**GCP Storage (`--archive-gcp-storage`)** |
33 | 125 |
|
34 | | -Uploads blocks to a Google Cloud Platform bucket |
| 126 | +Uploads blocks to a Google Cloud Platform bucket. |
35 | 127 |
|
36 | | -**Required Environment Variables**: |
| 128 | +**Required Environment Variables:** |
37 | 129 |
|
38 | 130 | - `GCP_CREDENTIALS_JSON`: Service account credentials JSON |
39 | 131 | - `GCP_BUCKET_NAME`: Target storage bucket name |
40 | 132 |
|
41 | | -### AWS Storage (`--archive-aws-storage`) |
| 133 | +**AWS Storage (`--archive-aws-storage`)** |
42 | 134 |
|
43 | | -Uploads blocks to an AWS S3 bucket |
| 135 | +Uploads blocks to an AWS S3 bucket. |
44 | 136 |
|
45 | | -**Required Environment Variables**: |
| 137 | +**Required Environment Variables:** |
46 | 138 |
|
47 | 139 | - `AWS_ACCESS_KEY_ID`: IAM user access key |
48 | 140 | - `AWS_SECRET_ACCESS_KEY`: IAM user secret key |
49 | 141 | - `AWS_DEFAULT_REGION`: AWS region name |
50 | 142 | - `AWS_SESSION_TOKEN`: Temporary session token for temporary credentials |
51 | 143 | - `MINA_AWS_BUCKET_NAME`: Target S3 bucket name |
52 | 144 |
|
53 | | -## Redundancy |
| 145 | +### Setup and Run |
54 | 146 |
|
55 | | -The archive mode is designed to be redundant. We can combine the flags to have |
56 | | -multiple options running simultaneously. |
| 147 | +1. **Run Archive Node with Archiver Process** |
57 | 148 |
|
58 | | -## Prerequisites |
| 149 | + For devnet (default): |
59 | 150 |
|
60 | | -Ensure Docker and Docker Compose are installed on your system - |
61 | | -[Docker Installation Guide](../appendix/docker-installation) |
| 151 | + ```bash |
| 152 | + MINA_ARCHIVE_ADDRESS="http://localhost:3086" \ |
| 153 | + make run-node NETWORK=devnet -- --archive-archiver-process |
| 154 | + ``` |
62 | 155 |
|
63 | | -## Docker compose setup (with archiver process) |
| 156 | + For mainnet (when supported): |
64 | 157 |
|
65 | | -The compose file sets up a PG database, the archiver process and the Mina Rust |
66 | | -node. The archiver process is responsible for storing the blocks in the database |
67 | | -by receiving the blocks from the Mina Rust node. |
| 158 | + ```bash |
| 159 | + MINA_ARCHIVE_ADDRESS="http://localhost:3086" \ |
| 160 | + make run-node NETWORK=mainnet -- --archive-archiver-process |
| 161 | + ``` |
68 | 162 |
|
69 | | -See |
70 | | -[docker-compose.archive.devnet.yml](https://github.com/o1-labs/mina-rust/blob/develop/docker-compose.archive.devnet.yml) |
71 | | -for more details. |
| 163 | +2. **Run with Multiple Archive Modes (Redundancy)** |
72 | 164 |
|
73 | | -### Starting the setup |
| 165 | + You can combine multiple archive modes for redundancy: |
74 | 166 |
|
75 | | -```bash |
76 | | -docker compose -f docker-compose.archive.devnet.yml up -d |
77 | | -``` |
| 167 | + ```bash |
| 168 | + # Archive to both database and local storage |
| 169 | + MINA_ARCHIVE_ADDRESS="http://localhost:3086" \ |
| 170 | + MINA_ARCHIVE_LOCAL_STORAGE_PATH="/path/to/archive" \ |
| 171 | + make run-node NETWORK=devnet -- \ |
| 172 | + --archive-archiver-process \ |
| 173 | + --archive-local-storage |
| 174 | + ``` |
| 175 | + |
| 176 | + ```bash |
| 177 | + # Archive to database, local storage, and AWS S3 |
| 178 | + MINA_ARCHIVE_ADDRESS="http://localhost:3086" \ |
| 179 | + MINA_ARCHIVE_LOCAL_STORAGE_PATH="/path/to/archive" \ |
| 180 | + AWS_ACCESS_KEY_ID="your-access-key" \ |
| 181 | + AWS_SECRET_ACCESS_KEY="your-secret-key" \ |
| 182 | + AWS_DEFAULT_REGION="us-west-2" \ |
| 183 | + MINA_AWS_BUCKET_NAME="your-bucket-name" \ |
| 184 | + make run-node NETWORK=devnet -- \ |
| 185 | + --archive-archiver-process \ |
| 186 | + --archive-local-storage \ |
| 187 | + --archive-aws-storage |
| 188 | + ``` |
| 189 | + |
| 190 | +3. **Monitor the Node** |
| 191 | + |
| 192 | + The node will start and listen on port 3000. You can monitor its status by |
| 193 | + checking the console output or connecting a frontend dashboard. |
| 194 | + |
| 195 | +### Access Logs |
| 196 | + |
| 197 | +Logs are stored in the working directory with filenames like |
| 198 | +`mina.log.2024-10-14`, `mina.log.2024-10-15`, etc. |
| 199 | + |
| 200 | +### Provide Feedback |
| 201 | + |
| 202 | +Collect logs and report issues on the |
| 203 | +[rust-node-testing](https://discord.com/channels/484437221055922177/1290662938734231552) |
| 204 | +Discord channel. Include reproduction steps if possible. |
0 commit comments