Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/test-docs-scripts-node-management.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Test Documentation Scripts - Node Operators

# Test node-operators documentation scripts to ensure they work correctly
# These scripts demonstrate node management commands for users
# Run locally: gh act -W .github/workflows/test-docs-scripts-node-management.yaml
on:
push:
branches: [main, develop]
pull_request:

jobs:
test-build-info-scripts:
name: Test Build Info Scripts (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install Docker on macOS
if: runner.os == 'macOS'
run: |
brew install docker
brew install colima
colima delete
colima start

- name: Test build-info-docker script
run: |
bash website/docs/node-operators/scripts/build-info-docker.sh

- name: Test build-info-docker-version script
run: |
bash website/docs/node-operators/scripts/build-info-docker.sh

- name: Test verify-build-info-docker script
run: |
bash website/docs/node-operators/scripts/verify-build-info-docker.sh

- name: Check build-info output format matches example
run: |
bash website/docs/node-operators/scripts/check-build-info-format.sh

test-management-scripts:
name: Test Management Scripts (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install timeout on macOS
if: runner.os == 'macOS'
run: |
brew install coreutils
sudo ln -s /opt/homebrew/bin/gtimeout /usr/local/bin/timeout || sudo ln -s /usr/local/bin/gtimeout /usr/local/bin/timeout

- name: Create test environment
run: |
mkdir -p mina-workdir/producer-key
echo "test-key" > mina-workdir/producer-key/test.key
mkdir -p ~/mina-backup

- name: Test backup-configuration script
run: |
bash website/docs/node-operators/scripts/backup-configuration.sh
test -f ~/mina-backup/producer-key/test.key
test -f mina-backup-$(date +%Y%m%d).tar.gz

- name: Test manage-file-permissions script
run: |
bash website/docs/node-operators/scripts/manage-file-permissions.sh

- name: Test check-system-resources script
run: |
timeout 5 bash website/docs/node-operators/scripts/check-system-resources.sh || true

- name: Test create-empty-env script
run: |
cd $(mktemp -d)
bash $GITHUB_WORKSPACE/website/docs/node-operators/scripts/create-empty-env.sh
test -f .env

- name: Test create-env-custom script
run: |
cd $(mktemp -d)
bash $GITHUB_WORKSPACE/website/docs/node-operators/scripts/create-env-custom.sh
test -f .env
grep -q "MINA_RUST_TAG=latest" .env

- name: Test create-env-archive script
run: |
cd $(mktemp -d)
bash $GITHUB_WORKSPACE/website/docs/node-operators/scripts/create-env-archive.sh
test -f .env
grep -q "POSTGRES_PASSWORD=mina" .env
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1513](https://github.com/o1-labs/mina-rust/pull/1513))
- **scan_state**: refactorize `transaction_logic.rs` in smaller modules
([#1515](https://github.com/o1-labs/mina-rust/pull/1515))
- **Website/CI**: run most commands from the page node management in CI after
moving them into scripts imported on the page
([#1511](https://github.com/o1-labs/mina-rust/pull/1511))

## v0.17.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Version: 0341fff
Build time: 2025-09-10T18:11:40.953050700Z
Commit SHA: 0341fffedba4900371504ad4b30853674960a209
Commit time: 2025-09-10T19:30:31.000000000+02:00
Commit branch: release/v0.17.0
Rustc channel: stable
Rustc version: 1.84.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ title: Node Management
description: Essential commands and tools for managing your Mina Rust node
---

import CodeBlock from "@theme/CodeBlock";
import BuildInfoDocker from "!!raw-loader!./scripts/build-info-docker.sh";
import BuildInfoDockerVersion from "!!raw-loader!./scripts/build-info-docker-version.sh";
import BuildInfoNative from "!!raw-loader!./scripts/build-info-native.sh";
import BuildInfoNativePath from "!!raw-loader!./scripts/build-info-native-path.sh";
import VerifyBuildInfoDocker from "!!raw-loader!./scripts/verify-build-info-docker.sh";
import VerifyBuildInfoNative from "!!raw-loader!./scripts/verify-build-info-native.sh";
import BuildInfoExample from "!!raw-loader!./example-output/build-info-example.txt";
import BackupConfiguration from "!!raw-loader!./scripts/backup-configuration.sh";
import ManageFilePermissions from "!!raw-loader!./scripts/manage-file-permissions.sh";
import CheckSystemResources from "!!raw-loader!./scripts/check-system-resources.sh";
import CreateEmptyEnv from "!!raw-loader!./scripts/create-empty-env.sh";
import CreateEnvCustom from "!!raw-loader!./scripts/create-env-custom.sh";
import CreateEnvArchive from "!!raw-loader!./scripts/create-env-archive.sh";

# Node Management

This guide covers essential commands and tools for managing your Mina Rust node,
Expand All @@ -18,40 +33,35 @@ ensure you're running the correct version and to help with troubleshooting.

To check the build information of your Docker-based node:

```bash
# Get build information
docker run --rm o1labs/mina-rust:latest build-info
```
<CodeBlock language="bash" title="scripts/build-info-docker.sh">
{BuildInfoDocker}
</CodeBlock>

Example output:

```
Version: 0341fff
Build time: 2025-09-10T18:11:40.953050700Z
Commit SHA: 0341fffedba4900371504ad4b30853674960a209
Commit time: 2025-09-10T19:30:31.000000000+02:00
Commit branch: release/v0.17.0
Rustc channel: stable
Rustc version: 1.84.1
```
<CodeBlock language="text" title="example-output/build-info-example.txt">
{BuildInfoExample}
</CodeBlock>

For a specific version:

```bash
docker run --rm o1labs/mina-rust:v0.17.0 build-info
```
<CodeBlock language="bash" title="scripts/build-info-docker-version.sh">
{BuildInfoDockerVersion}
</CodeBlock>

### Using Native Binary

If you've built from source or are running the binary directly:

```bash
# Get build information
mina build-info
<CodeBlock language="bash" title="scripts/build-info-native.sh">
{BuildInfoNative}
</CodeBlock>

# Or with the full path if not in PATH
./target/release/mina build-info
```
Or with the full path if not in PATH:

<CodeBlock language="bash" title="scripts/build-info-native-path.sh">
{BuildInfoNativePath}
</CodeBlock>

### Understanding Build Information

Expand All @@ -69,13 +79,17 @@ The build info provides critical details:

Always verify your node version after installation or updates:

```bash
# For Docker users
docker run --rm o1labs/mina-rust:latest build-info | grep "Version\|branch"
For Docker users:

# For native binary users
mina build-info | grep "Version\|branch"
```
<CodeBlock language="bash" title="scripts/verify-build-info-docker.sh">
{VerifyBuildInfoDocker}
</CodeBlock>

For native binary users:

<CodeBlock language="bash" title="scripts/verify-build-info-native.sh">
{VerifyBuildInfoNative}
</CodeBlock>

## Monitoring Your Node

Expand Down Expand Up @@ -155,36 +169,25 @@ docker compose up -d --force-recreate

Always backup your keys and configuration:

```bash
# Backup producer key (if running block producer)
cp -r mina-workdir/producer-key ~/mina-backup/

# Backup entire working directory
tar -czf mina-backup-$(date +%Y%m%d).tar.gz mina-workdir/
```
<CodeBlock language="bash" title="scripts/backup-configuration.sh">
{BackupConfiguration}
</CodeBlock>

### Managing File Permissions

Docker containers often run as root, creating files owned by root on your host:

```bash
# Check file ownership
ls -la mina-workdir/

# Fix ownership for all files in mina-workdir
sudo chown -R $(id -u):$(id -g) mina-workdir/

# Set appropriate permissions for the producer key
chmod 600 mina-workdir/producer-key
```
<CodeBlock language="bash" title="scripts/manage-file-permissions.sh">
{ManageFilePermissions}
</CodeBlock>

<!-- prettier-ignore-start -->

:::tip
:::tip Best Practice

Best Practice Always fix file ownership after Docker operations to ensure your
local user can properly access, backup, and manage the files. This is especially
important for sensitive files like producer keys.
Always fix file ownership after Docker operations to ensure your local user can
properly access, backup, and manage the files. This is especially important for
sensitive files like producer keys.

:::

Expand All @@ -211,32 +214,23 @@ environment variables:

**For regular node and block producer:**

```bash
# Quick fix: Create an empty .env file (has defaults)
touch .env

# Or create with custom settings
cat > .env << EOF
MINA_RUST_TAG=latest
MINA_FRONTEND_TAG=latest
MINA_LIBP2P_PORT=8302
MINA_LIBP2P_EXTERNAL_IP=
MINA_PRIVKEY_PASS=
COINBASE_RECEIVER=
EOF
```
Quick fix: Create an empty .env file (has defaults)

<CodeBlock language="bash" title="scripts/create-empty-env.sh">
{CreateEmptyEnv}
</CodeBlock>

Or create with custom settings:

<CodeBlock language="bash" title="scripts/create-env-custom.sh">
{CreateEnvCustom}
</CodeBlock>

**For archive node (required):**

```bash
# Archive node requires specific database settings
cat > .env << EOF
POSTGRES_PASSWORD=mina
PG_PORT=5432
PG_DB=archive
MINA_RUST_TAG=latest
EOF
```
<CodeBlock language="bash" title="scripts/create-env-archive.sh">
{CreateEnvArchive}
</CodeBlock>

Regular node docker-compose files have default values, but the archive node
docker-compose file requires the `.env` file with PostgreSQL configuration.
Expand All @@ -253,11 +247,11 @@ docker-compose file requires the `.env` file with PostgreSQL configuration.
### Performance Issues

1. Check system resources:
```bash
free -h
df -h
docker stats
```

<CodeBlock language="bash" title="scripts/check-system-resources.sh">
{CheckSystemResources}
</CodeBlock>

2. Review node logs for warnings
3. Consider adjusting Docker resource limits

Expand Down
6 changes: 6 additions & 0 deletions website/docs/node-operators/scripts/backup-configuration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# Backup producer key (if running block producer)
cp -r mina-workdir/producer-key ~/mina-backup/

# Backup entire working directory
tar -czf "mina-backup-$(date +%Y%m%d).tar.gz" mina-workdir/
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker run --rm o1labs/mina-rust:v0.17.0 build-info
2 changes: 2 additions & 0 deletions website/docs/node-operators/scripts/build-info-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker run --rm o1labs/mina-rust:latest build-info
2 changes: 2 additions & 0 deletions website/docs/node-operators/scripts/build-info-native-path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./target/release/mina build-info
2 changes: 2 additions & 0 deletions website/docs/node-operators/scripts/build-info-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
mina build-info
Loading
Loading