Skip to main content

Manager for Autonomi nodes

Project description

Weave Node Manager

Overview

Weave Node Manager (wnm) is a Python application designed to manage Autonomi nodes on Linux and macOS systems.

Platforms:

  • Linux: systemd or setsid for process management, UFW for firewall
  • macOS: launchd for process management (native support)
  • Python 3.12.3+ required

Features

  • Automatic node lifecycle management (create, start, stop, upgrade, remove)
  • Resource-based decision engine (CPU, memory, disk, I/O, load average thresholds)
  • Platform-specific process management (systemd on Linux, launchd on macOS)
  • Per-node binary copies for independent upgrades
  • SQLite database for configuration and state tracking
  • Support for configuration via environment variables, config files, or command-line parameters

Warning - Alpha Software

This code is Alpha. On Linux, it can migrate from an existing anm installation. On macOS, it provides native development and testing support using launchd.

Installation

macOS (Development & Testing)

macOS support uses launchd for process management and is ideal for development and testing.

1. Install antup (Autonomi binary manager)

curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash

2. Download antnode binary

~/.local/bin/antup node

3. Install WNM from PyPI

pip3 install weave-node-manager

4. Or install from source

git clone https://github.com/dawn-code/weave-node-manager.git
cd weave-node-manager
pip3 install -e .

5. Initialize and configure

# Initialize with your rewards address
wnm --init --rewards_address 0xYourEthereumAddress

# Run in dry-run mode to test
wnm --dry_run

# Or run normally to start managing nodes
wnm

6. Optional: Add to cron for automatic management

# Add to crontab (runs every minute)
crontab -e

# Add this line:
*/1 * * * * /usr/local/bin/wnm >> ~/Library/Logs/autonomi/wnm-cron.log 2>&1

macOS Notes:

  • Uses ~/Library/Application Support/autonomi/node/ for data
  • Uses ~/Library/Logs/autonomi/ for logs
  • Nodes managed via launchd (~/Library/LaunchAgents/)
  • No root/sudo access required

Linux (User-Level, Recommended)

Non-root installation using setsid for process management.

1. Install antup (Autonomi binary manager)

curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash

2. Download antnode binary

~/.local/bin/antup node

3. Install WNM from PyPI

pip3 install weave-node-manager

4. Or install from source

git clone https://github.com/dawn-code/weave-node-manager.git
cd weave-node-manager
pip3 install -e .

5. Initialize and configure

# Initialize with your rewards address
wnm --init --rewards_address 0xYourEthereumAddress

# Run in dry-run mode to test
wnm --dry_run

# Or run normally
wnm

6. Optional: Add to cron

crontab -e

# Add this line:
*/1 * * * * ~/.local/bin/wnm >> ~/.local/share/autonomi/logs/wnm-cron.log 2>&1

Linux User-Level Notes:

  • Uses ~/.local/share/autonomi/node/ for data (XDG spec)
  • Uses ~/.local/share/autonomi/logs/ for logs
  • Nodes run as background processes (setsid)
  • No root/sudo required

Linux (Root-Level, Production)

Root installation using systemd for process management.

1. Install system dependencies

sudo apt install -y python3.12-venv python3-pip

2. Install antup and antnode

curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
~/.local/bin/antup node
sudo cp ~/.local/bin/antnode /usr/local/bin/

3. Install WNM

sudo pip3 install weave-node-manager

4. Initialize as root

# Migrate from existing anm installation
sudo wnm --init --migrate_anm

# Or initialize fresh
sudo wnm --init --rewards_address 0xYourEthereumAddress

5. Add to cron

sudo crontab -e

# Add this line:
*/1 * * * * /usr/local/bin/wnm >> /var/log/antnode/wnm-cron.log 2>&1

Linux Root-Level Notes:

  • Uses /var/antctl/ for data (legacy anm compatibility)
  • Uses /var/log/antnode/ for logs
  • Nodes managed via systemd (/etc/systemd/system/)
  • Requires root/sudo access
  • Supports migration from anm

Configuration

Configuration follows a multi-layer priority system (highest to lowest):

  1. Command-line arguments: wnm --cpu_less_than 70 --node_cap 50
  2. Environment variables: Set in .env file or shell
  3. Config files:
    • macOS: ~/Library/Application Support/autonomi/config
    • Linux (user): ~/.local/share/autonomi/config
    • Linux (root): /var/antctl/config
  4. Database-stored config: Persisted in colony.db after initialization
  5. Default values: Built-in defaults

Key Configuration Parameters

Resource thresholds control when nodes are added or removed:

  • --cpu_less_than / --cpu_remove: CPU percentage thresholds (default: 70% / 80%)
  • --mem_less_than / --mem_remove: Memory percentage thresholds (default: 70% / 80%)
  • --hd_less_than / --hd_remove: Disk usage percentage thresholds (default: 70% / 80%)
  • --desired_load_average / --max_load_average_allowed: Load average thresholds
  • --node_cap: Maximum number of nodes (default: 50)
  • --rewards_address: Ethereum address for node rewards (required)
  • --node_storage: Root directory for node data (auto-detected per platform)

anm Migration (Linux Only)

Upon finding an existing anm installation, wnm will:

  1. Disable anm by removing /etc/cron.d/anm
  2. Import configuration from /var/antctl/config
  3. Discover and import existing nodes from systemd
  4. Take over management of the cluster

Use wnm --init --migrate_anm to trigger migration.

Usage

Run Once

# macOS or Linux
wnm

# With dry-run (no actual changes)
wnm --dry_run

# Initialize first time
wnm --init --rewards_address 0xYourEthereumAddress

Run via Cron (Recommended)

WNM is designed to run every minute via cron, making one decision per cycle:

macOS:

crontab -e
# Add: */1 * * * * /usr/local/bin/wnm >> ~/Library/Logs/autonomi/wnm-cron.log 2>&1

Linux (user):

crontab -e
# Add: */1 * * * * ~/.local/bin/wnm >> ~/.local/share/autonomi/logs/wnm-cron.log 2>&1

Linux (root):

sudo crontab -e
# Add: */1 * * * * /usr/local/bin/wnm >> /var/log/antnode/wnm-cron.log 2>&1

Development Mode

For development with live code reloading:

macOS (native):

python3 -m wnm --dry_run

Linux (Docker):

./scripts/dev.sh
# Inside container:
python3 -m wnm --dry_run

See DOCKER-DEV.md for comprehensive Docker development workflow.

Platform Support

See PLATFORM-SUPPORT.md for detailed information about:

  • Platform-specific process managers (systemd, launchd, setsid)
  • Firewall management (UFW, null)
  • Path conventions per platform
  • Binary management and upgrades
  • Testing strategies

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wnm-0.0.11.tar.gz (68.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wnm-0.0.11-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

Details for the file wnm-0.0.11.tar.gz.

File metadata

  • Download URL: wnm-0.0.11.tar.gz
  • Upload date:
  • Size: 68.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for wnm-0.0.11.tar.gz
Algorithm Hash digest
SHA256 d8a35c8d101135445d6660ce54e69ce37bc8d14cf750efb965e44e3a5b235dfa
MD5 53e6f434b7695cff07fa53e4a44a4029
BLAKE2b-256 c0cb361954590429953a8ed95cfc9ded519422dea3ac56e1df179720dd7eba76

See more details on using hashes here.

File details

Details for the file wnm-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: wnm-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 59.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for wnm-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 751a13a56d9f595247cf925f596c521985ad67ac2a953f587c7ac6028dbeff36
MD5 f0cdd9c6fccd81ad6e91d986288afc9b
BLAKE2b-256 07334a88e7d279f7ab03022731582785318ceb235b94944ece67f6d05652da16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page