wnm 0.0.8__tar.gz → 0.0.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of wnm might be problematic. Click here for more details.

Files changed (53) hide show
  1. wnm-0.0.10/PKG-INFO +316 -0
  2. wnm-0.0.10/README.md +277 -0
  3. {wnm-0.0.8 → wnm-0.0.10}/pyproject.toml +18 -2
  4. wnm-0.0.10/requirements-dev.txt +10 -0
  5. {wnm-0.0.8 → wnm-0.0.10}/requirements.txt +1 -0
  6. {wnm-0.0.8 → wnm-0.0.10}/setup.cfg +0 -3
  7. {wnm-0.0.8 → wnm-0.0.10/src}/wnm/__init__.py +1 -1
  8. wnm-0.0.10/src/wnm/__main__.py +236 -0
  9. wnm-0.0.10/src/wnm/actions.py +45 -0
  10. wnm-0.0.10/src/wnm/common.py +21 -0
  11. wnm-0.0.10/src/wnm/config.py +655 -0
  12. wnm-0.0.10/src/wnm/decision_engine.py +388 -0
  13. wnm-0.0.10/src/wnm/executor.py +1292 -0
  14. wnm-0.0.10/src/wnm/firewall/__init__.py +13 -0
  15. wnm-0.0.10/src/wnm/firewall/base.py +71 -0
  16. wnm-0.0.10/src/wnm/firewall/factory.py +95 -0
  17. wnm-0.0.10/src/wnm/firewall/null_firewall.py +71 -0
  18. wnm-0.0.10/src/wnm/firewall/ufw_manager.py +118 -0
  19. wnm-0.0.10/src/wnm/migration.py +42 -0
  20. wnm-0.0.10/src/wnm/models.py +459 -0
  21. wnm-0.0.10/src/wnm/process_managers/__init__.py +23 -0
  22. wnm-0.0.10/src/wnm/process_managers/base.py +203 -0
  23. wnm-0.0.10/src/wnm/process_managers/docker_manager.py +371 -0
  24. wnm-0.0.10/src/wnm/process_managers/factory.py +83 -0
  25. wnm-0.0.10/src/wnm/process_managers/launchd_manager.py +592 -0
  26. wnm-0.0.10/src/wnm/process_managers/setsid_manager.py +340 -0
  27. wnm-0.0.10/src/wnm/process_managers/systemd_manager.py +443 -0
  28. wnm-0.0.10/src/wnm/reports.py +286 -0
  29. wnm-0.0.10/src/wnm/utils.py +403 -0
  30. wnm-0.0.10/src/wnm.egg-info/PKG-INFO +316 -0
  31. wnm-0.0.10/src/wnm.egg-info/SOURCES.txt +41 -0
  32. wnm-0.0.10/src/wnm.egg-info/requires.txt +20 -0
  33. wnm-0.0.10/src/wnm.egg-info/top_level.txt +1 -0
  34. wnm-0.0.10/tests/test_decision_engine.py +557 -0
  35. wnm-0.0.10/tests/test_firewall.py +356 -0
  36. wnm-0.0.10/tests/test_forced_actions.py +1051 -0
  37. wnm-0.0.10/tests/test_macos_native.py +122 -0
  38. wnm-0.0.10/tests/test_models.py +161 -0
  39. wnm-0.0.10/tests/test_process_managers.py +559 -0
  40. wnm-0.0.10/tests/test_reports.py +400 -0
  41. wnm-0.0.10/tests/test_system_metrics.py +269 -0
  42. wnm-0.0.8/PKG-INFO +0 -93
  43. wnm-0.0.8/README.md +0 -63
  44. wnm-0.0.8/requirements-dev.txt +0 -4
  45. wnm-0.0.8/wnm/__main__.py +0 -983
  46. wnm-0.0.8/wnm/config.py +0 -3
  47. wnm-0.0.8/wnm/models.py +0 -192
  48. wnm-0.0.8/wnm.egg-info/PKG-INFO +0 -93
  49. wnm-0.0.8/wnm.egg-info/SOURCES.txt +0 -15
  50. wnm-0.0.8/wnm.egg-info/requires.txt +0 -13
  51. wnm-0.0.8/wnm.egg-info/top_level.txt +0 -3
  52. {wnm-0.0.8 → wnm-0.0.10/src}/wnm.egg-info/dependency_links.txt +0 -0
  53. {wnm-0.0.8 → wnm-0.0.10/src}/wnm.egg-info/entry_points.txt +0 -0
wnm-0.0.10/PKG-INFO ADDED
@@ -0,0 +1,316 @@
1
+ Metadata-Version: 2.4
2
+ Name: wnm
3
+ Version: 0.0.10
4
+ Summary: Manager for Autonomi nodes
5
+ Author-email: Troy Johnson <troy@weave.sh>
6
+ License: GPL-3.0
7
+ Project-URL: Repository, https://github.com/iweave/weave-node-manager.git
8
+ Project-URL: Issues, https://github.com/iweave/weave-node-manager/issues
9
+ Keywords: Autonomi,antnode,weave,xd7
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Topic :: System :: Distributed Computing
18
+ Requires-Python: >=3.12.3
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: python-dotenv
21
+ Requires-Dist: requests
22
+ Requires-Dist: packaging
23
+ Requires-Dist: sqlalchemy
24
+ Requires-Dist: alembic
25
+ Requires-Dist: json-fix
26
+ Requires-Dist: psutil
27
+ Requires-Dist: configargparse
28
+ Provides-Extra: dev
29
+ Requires-Dist: black; extra == "dev"
30
+ Requires-Dist: isort; extra == "dev"
31
+ Requires-Dist: build; extra == "dev"
32
+ Requires-Dist: twine; extra == "dev"
33
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
35
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
36
+ Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
37
+ Requires-Dist: pytest-docker>=3.1.0; extra == "dev"
38
+ Requires-Dist: docker>=7.0.0; extra == "dev"
39
+
40
+ # Weave Node Manager
41
+
42
+ ## Overview
43
+ Weave Node Manager (wnm) is a Python application designed to manage Autonomi nodes on Linux and macOS systems.
44
+
45
+ **Platforms**:
46
+ - **Linux**: systemd or setsid for process management, UFW for firewall
47
+ - **macOS**: launchd for process management (native support)
48
+ - **Python 3.12.3+** required
49
+
50
+ ## Features
51
+ - Automatic node lifecycle management (create, start, stop, upgrade, remove)
52
+ - Resource-based decision engine (CPU, memory, disk, I/O, load average thresholds)
53
+ - Platform-specific process management (systemd on Linux, launchd on macOS)
54
+ - Per-node binary copies for independent upgrades
55
+ - SQLite database for configuration and state tracking
56
+ - Support for configuration via environment variables, config files, or command-line parameters
57
+
58
+ ## Warning - Alpha Software
59
+
60
+ This code is Alpha. On Linux, it can migrate from an existing [anm](https://github.com/safenetforum-community/NTracking/tree/main/anm) installation. On macOS, it provides native development and testing support using launchd.
61
+
62
+ ## Installation
63
+
64
+ ### macOS (Development & Testing)
65
+
66
+ macOS support uses launchd for process management and is ideal for development and testing.
67
+
68
+ #### 1. Install antup (Autonomi binary manager)
69
+ ```bash
70
+ curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
71
+ ```
72
+
73
+ #### 2. Download antnode binary
74
+ ```bash
75
+ ~/.local/bin/antup node
76
+ ```
77
+
78
+ #### 3. Install WNM from PyPI
79
+ ```bash
80
+ pip3 install weave-node-manager
81
+ ```
82
+
83
+ #### 4. Or install from source
84
+ ```bash
85
+ git clone https://github.com/dawn-code/weave-node-manager.git
86
+ cd weave-node-manager
87
+ pip3 install -e .
88
+ ```
89
+
90
+ #### 5. Initialize and configure
91
+ ```bash
92
+ # Initialize with your rewards address
93
+ wnm --init --rewards_address 0xYourEthereumAddress
94
+
95
+ # Run in dry-run mode to test
96
+ wnm --dry_run
97
+
98
+ # Or run normally to start managing nodes
99
+ wnm
100
+ ```
101
+
102
+ #### 6. Optional: Add to cron for automatic management
103
+ ```bash
104
+ # Add to crontab (runs every minute)
105
+ crontab -e
106
+
107
+ # Add this line:
108
+ */1 * * * * /usr/local/bin/wnm >> ~/Library/Logs/autonomi/wnm-cron.log 2>&1
109
+ ```
110
+
111
+ **macOS Notes:**
112
+ - Uses `~/Library/Application Support/autonomi/node/` for data
113
+ - Uses `~/Library/Logs/autonomi/` for logs
114
+ - Nodes managed via launchd (`~/Library/LaunchAgents/`)
115
+ - No root/sudo access required
116
+
117
+ ### Linux (User-Level, Recommended)
118
+
119
+ Non-root installation using setsid for process management.
120
+
121
+ #### 1. Install antup (Autonomi binary manager)
122
+ ```bash
123
+ curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
124
+ ```
125
+
126
+ #### 2. Download antnode binary
127
+ ```bash
128
+ ~/.local/bin/antup node
129
+ ```
130
+
131
+ #### 3. Install WNM from PyPI
132
+ ```bash
133
+ pip3 install weave-node-manager
134
+ ```
135
+
136
+ #### 4. Or install from source
137
+ ```bash
138
+ git clone https://github.com/dawn-code/weave-node-manager.git
139
+ cd weave-node-manager
140
+ pip3 install -e .
141
+ ```
142
+
143
+ #### 5. Initialize and configure
144
+ ```bash
145
+ # Initialize with your rewards address
146
+ wnm --init --rewards_address 0xYourEthereumAddress
147
+
148
+ # Run in dry-run mode to test
149
+ wnm --dry_run
150
+
151
+ # Or run normally
152
+ wnm
153
+ ```
154
+
155
+ #### 6. Optional: Add to cron
156
+ ```bash
157
+ crontab -e
158
+
159
+ # Add this line:
160
+ */1 * * * * ~/.local/bin/wnm >> ~/.local/share/autonomi/logs/wnm-cron.log 2>&1
161
+ ```
162
+
163
+ **Linux User-Level Notes:**
164
+ - Uses `~/.local/share/autonomi/node/` for data (XDG spec)
165
+ - Uses `~/.local/share/autonomi/logs/` for logs
166
+ - Nodes run as background processes (setsid)
167
+ - No root/sudo required
168
+
169
+ ### Linux (Root-Level, Production)
170
+
171
+ Root installation using systemd for process management.
172
+
173
+ #### 1. Install system dependencies
174
+ ```bash
175
+ sudo apt install -y python3.12-venv python3-pip
176
+ ```
177
+
178
+ #### 2. Install antup and antnode
179
+ ```bash
180
+ curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
181
+ ~/.local/bin/antup node
182
+ sudo cp ~/.local/bin/antnode /usr/local/bin/
183
+ ```
184
+
185
+ #### 3. Install WNM
186
+ ```bash
187
+ sudo pip3 install weave-node-manager
188
+ ```
189
+
190
+ #### 4. Initialize as root
191
+ ```bash
192
+ # Migrate from existing anm installation
193
+ sudo wnm --init --migrate_anm
194
+
195
+ # Or initialize fresh
196
+ sudo wnm --init --rewards_address 0xYourEthereumAddress
197
+ ```
198
+
199
+ #### 5. Add to cron
200
+ ```bash
201
+ sudo crontab -e
202
+
203
+ # Add this line:
204
+ */1 * * * * /usr/local/bin/wnm >> /var/log/antnode/wnm-cron.log 2>&1
205
+ ```
206
+
207
+ **Linux Root-Level Notes:**
208
+ - Uses `/var/antctl/` for data (legacy anm compatibility)
209
+ - Uses `/var/log/antnode/` for logs
210
+ - Nodes managed via systemd (`/etc/systemd/system/`)
211
+ - Requires root/sudo access
212
+ - Supports migration from anm
213
+
214
+ ## Configuration
215
+
216
+ Configuration follows a multi-layer priority system (highest to lowest):
217
+
218
+ 1. **Command-line arguments**: `wnm --cpu_less_than 70 --node_cap 50`
219
+ 2. **Environment variables**: Set in `.env` file or shell
220
+ 3. **Config files**:
221
+ - macOS: `~/Library/Application Support/autonomi/config`
222
+ - Linux (user): `~/.local/share/autonomi/config`
223
+ - Linux (root): `/var/antctl/config`
224
+ 4. **Database-stored config**: Persisted in `colony.db` after initialization
225
+ 5. **Default values**: Built-in defaults
226
+
227
+ ### Key Configuration Parameters
228
+
229
+ Resource thresholds control when nodes are added or removed:
230
+
231
+ - `--cpu_less_than` / `--cpu_remove`: CPU percentage thresholds (default: 70% / 80%)
232
+ - `--mem_less_than` / `--mem_remove`: Memory percentage thresholds (default: 70% / 80%)
233
+ - `--hd_less_than` / `--hd_remove`: Disk usage percentage thresholds (default: 70% / 80%)
234
+ - `--desired_load_average` / `--max_load_average_allowed`: Load average thresholds
235
+ - `--node_cap`: Maximum number of nodes (default: 50)
236
+ - `--rewards_address`: Ethereum address for node rewards (required)
237
+ - `--node_storage`: Root directory for node data (auto-detected per platform)
238
+
239
+ ### anm Migration (Linux Only)
240
+
241
+ Upon finding an existing [anm](https://github.com/safenetforum-community/NTracking/tree/main/anm) installation, wnm will:
242
+ 1. Disable anm by removing `/etc/cron.d/anm`
243
+ 2. Import configuration from `/var/antctl/config`
244
+ 3. Discover and import existing nodes from systemd
245
+ 4. Take over management of the cluster
246
+
247
+ Use `wnm --init --migrate_anm` to trigger migration.
248
+
249
+ ## Usage
250
+
251
+ ### Run Once
252
+ ```bash
253
+ # macOS or Linux
254
+ wnm
255
+
256
+ # With dry-run (no actual changes)
257
+ wnm --dry_run
258
+
259
+ # Initialize first time
260
+ wnm --init --rewards_address 0xYourEthereumAddress
261
+ ```
262
+
263
+ ### Run via Cron (Recommended)
264
+
265
+ WNM is designed to run every minute via cron, making one decision per cycle:
266
+
267
+ **macOS:**
268
+ ```bash
269
+ crontab -e
270
+ # Add: */1 * * * * /usr/local/bin/wnm >> ~/Library/Logs/autonomi/wnm-cron.log 2>&1
271
+ ```
272
+
273
+ **Linux (user):**
274
+ ```bash
275
+ crontab -e
276
+ # Add: */1 * * * * ~/.local/bin/wnm >> ~/.local/share/autonomi/logs/wnm-cron.log 2>&1
277
+ ```
278
+
279
+ **Linux (root):**
280
+ ```bash
281
+ sudo crontab -e
282
+ # Add: */1 * * * * /usr/local/bin/wnm >> /var/log/antnode/wnm-cron.log 2>&1
283
+ ```
284
+
285
+ ### Development Mode
286
+
287
+ For development with live code reloading:
288
+
289
+ **macOS (native):**
290
+ ```bash
291
+ python3 -m wnm --dry_run
292
+ ```
293
+
294
+ **Linux (Docker):**
295
+ ```bash
296
+ ./scripts/dev.sh
297
+ # Inside container:
298
+ python3 -m wnm --dry_run
299
+ ```
300
+
301
+ See `DOCKER-DEV.md` for comprehensive Docker development workflow.
302
+
303
+ ## Platform Support
304
+
305
+ See `PLATFORM-SUPPORT.md` for detailed information about:
306
+ - Platform-specific process managers (systemd, launchd, setsid)
307
+ - Firewall management (UFW, null)
308
+ - Path conventions per platform
309
+ - Binary management and upgrades
310
+ - Testing strategies
311
+
312
+ ## Contributing
313
+ Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.
314
+
315
+ ## License
316
+ This project is licensed under the MIT License. See the LICENSE file for more details.
wnm-0.0.10/README.md ADDED
@@ -0,0 +1,277 @@
1
+ # Weave Node Manager
2
+
3
+ ## Overview
4
+ Weave Node Manager (wnm) is a Python application designed to manage Autonomi nodes on Linux and macOS systems.
5
+
6
+ **Platforms**:
7
+ - **Linux**: systemd or setsid for process management, UFW for firewall
8
+ - **macOS**: launchd for process management (native support)
9
+ - **Python 3.12.3+** required
10
+
11
+ ## Features
12
+ - Automatic node lifecycle management (create, start, stop, upgrade, remove)
13
+ - Resource-based decision engine (CPU, memory, disk, I/O, load average thresholds)
14
+ - Platform-specific process management (systemd on Linux, launchd on macOS)
15
+ - Per-node binary copies for independent upgrades
16
+ - SQLite database for configuration and state tracking
17
+ - Support for configuration via environment variables, config files, or command-line parameters
18
+
19
+ ## Warning - Alpha Software
20
+
21
+ This code is Alpha. On Linux, it can migrate from an existing [anm](https://github.com/safenetforum-community/NTracking/tree/main/anm) installation. On macOS, it provides native development and testing support using launchd.
22
+
23
+ ## Installation
24
+
25
+ ### macOS (Development & Testing)
26
+
27
+ macOS support uses launchd for process management and is ideal for development and testing.
28
+
29
+ #### 1. Install antup (Autonomi binary manager)
30
+ ```bash
31
+ curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
32
+ ```
33
+
34
+ #### 2. Download antnode binary
35
+ ```bash
36
+ ~/.local/bin/antup node
37
+ ```
38
+
39
+ #### 3. Install WNM from PyPI
40
+ ```bash
41
+ pip3 install weave-node-manager
42
+ ```
43
+
44
+ #### 4. Or install from source
45
+ ```bash
46
+ git clone https://github.com/dawn-code/weave-node-manager.git
47
+ cd weave-node-manager
48
+ pip3 install -e .
49
+ ```
50
+
51
+ #### 5. Initialize and configure
52
+ ```bash
53
+ # Initialize with your rewards address
54
+ wnm --init --rewards_address 0xYourEthereumAddress
55
+
56
+ # Run in dry-run mode to test
57
+ wnm --dry_run
58
+
59
+ # Or run normally to start managing nodes
60
+ wnm
61
+ ```
62
+
63
+ #### 6. Optional: Add to cron for automatic management
64
+ ```bash
65
+ # Add to crontab (runs every minute)
66
+ crontab -e
67
+
68
+ # Add this line:
69
+ */1 * * * * /usr/local/bin/wnm >> ~/Library/Logs/autonomi/wnm-cron.log 2>&1
70
+ ```
71
+
72
+ **macOS Notes:**
73
+ - Uses `~/Library/Application Support/autonomi/node/` for data
74
+ - Uses `~/Library/Logs/autonomi/` for logs
75
+ - Nodes managed via launchd (`~/Library/LaunchAgents/`)
76
+ - No root/sudo access required
77
+
78
+ ### Linux (User-Level, Recommended)
79
+
80
+ Non-root installation using setsid for process management.
81
+
82
+ #### 1. Install antup (Autonomi binary manager)
83
+ ```bash
84
+ curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
85
+ ```
86
+
87
+ #### 2. Download antnode binary
88
+ ```bash
89
+ ~/.local/bin/antup node
90
+ ```
91
+
92
+ #### 3. Install WNM from PyPI
93
+ ```bash
94
+ pip3 install weave-node-manager
95
+ ```
96
+
97
+ #### 4. Or install from source
98
+ ```bash
99
+ git clone https://github.com/dawn-code/weave-node-manager.git
100
+ cd weave-node-manager
101
+ pip3 install -e .
102
+ ```
103
+
104
+ #### 5. Initialize and configure
105
+ ```bash
106
+ # Initialize with your rewards address
107
+ wnm --init --rewards_address 0xYourEthereumAddress
108
+
109
+ # Run in dry-run mode to test
110
+ wnm --dry_run
111
+
112
+ # Or run normally
113
+ wnm
114
+ ```
115
+
116
+ #### 6. Optional: Add to cron
117
+ ```bash
118
+ crontab -e
119
+
120
+ # Add this line:
121
+ */1 * * * * ~/.local/bin/wnm >> ~/.local/share/autonomi/logs/wnm-cron.log 2>&1
122
+ ```
123
+
124
+ **Linux User-Level Notes:**
125
+ - Uses `~/.local/share/autonomi/node/` for data (XDG spec)
126
+ - Uses `~/.local/share/autonomi/logs/` for logs
127
+ - Nodes run as background processes (setsid)
128
+ - No root/sudo required
129
+
130
+ ### Linux (Root-Level, Production)
131
+
132
+ Root installation using systemd for process management.
133
+
134
+ #### 1. Install system dependencies
135
+ ```bash
136
+ sudo apt install -y python3.12-venv python3-pip
137
+ ```
138
+
139
+ #### 2. Install antup and antnode
140
+ ```bash
141
+ curl -sSL https://raw.githubusercontent.com/maidsafe/antup/main/install.sh | bash
142
+ ~/.local/bin/antup node
143
+ sudo cp ~/.local/bin/antnode /usr/local/bin/
144
+ ```
145
+
146
+ #### 3. Install WNM
147
+ ```bash
148
+ sudo pip3 install weave-node-manager
149
+ ```
150
+
151
+ #### 4. Initialize as root
152
+ ```bash
153
+ # Migrate from existing anm installation
154
+ sudo wnm --init --migrate_anm
155
+
156
+ # Or initialize fresh
157
+ sudo wnm --init --rewards_address 0xYourEthereumAddress
158
+ ```
159
+
160
+ #### 5. Add to cron
161
+ ```bash
162
+ sudo crontab -e
163
+
164
+ # Add this line:
165
+ */1 * * * * /usr/local/bin/wnm >> /var/log/antnode/wnm-cron.log 2>&1
166
+ ```
167
+
168
+ **Linux Root-Level Notes:**
169
+ - Uses `/var/antctl/` for data (legacy anm compatibility)
170
+ - Uses `/var/log/antnode/` for logs
171
+ - Nodes managed via systemd (`/etc/systemd/system/`)
172
+ - Requires root/sudo access
173
+ - Supports migration from anm
174
+
175
+ ## Configuration
176
+
177
+ Configuration follows a multi-layer priority system (highest to lowest):
178
+
179
+ 1. **Command-line arguments**: `wnm --cpu_less_than 70 --node_cap 50`
180
+ 2. **Environment variables**: Set in `.env` file or shell
181
+ 3. **Config files**:
182
+ - macOS: `~/Library/Application Support/autonomi/config`
183
+ - Linux (user): `~/.local/share/autonomi/config`
184
+ - Linux (root): `/var/antctl/config`
185
+ 4. **Database-stored config**: Persisted in `colony.db` after initialization
186
+ 5. **Default values**: Built-in defaults
187
+
188
+ ### Key Configuration Parameters
189
+
190
+ Resource thresholds control when nodes are added or removed:
191
+
192
+ - `--cpu_less_than` / `--cpu_remove`: CPU percentage thresholds (default: 70% / 80%)
193
+ - `--mem_less_than` / `--mem_remove`: Memory percentage thresholds (default: 70% / 80%)
194
+ - `--hd_less_than` / `--hd_remove`: Disk usage percentage thresholds (default: 70% / 80%)
195
+ - `--desired_load_average` / `--max_load_average_allowed`: Load average thresholds
196
+ - `--node_cap`: Maximum number of nodes (default: 50)
197
+ - `--rewards_address`: Ethereum address for node rewards (required)
198
+ - `--node_storage`: Root directory for node data (auto-detected per platform)
199
+
200
+ ### anm Migration (Linux Only)
201
+
202
+ Upon finding an existing [anm](https://github.com/safenetforum-community/NTracking/tree/main/anm) installation, wnm will:
203
+ 1. Disable anm by removing `/etc/cron.d/anm`
204
+ 2. Import configuration from `/var/antctl/config`
205
+ 3. Discover and import existing nodes from systemd
206
+ 4. Take over management of the cluster
207
+
208
+ Use `wnm --init --migrate_anm` to trigger migration.
209
+
210
+ ## Usage
211
+
212
+ ### Run Once
213
+ ```bash
214
+ # macOS or Linux
215
+ wnm
216
+
217
+ # With dry-run (no actual changes)
218
+ wnm --dry_run
219
+
220
+ # Initialize first time
221
+ wnm --init --rewards_address 0xYourEthereumAddress
222
+ ```
223
+
224
+ ### Run via Cron (Recommended)
225
+
226
+ WNM is designed to run every minute via cron, making one decision per cycle:
227
+
228
+ **macOS:**
229
+ ```bash
230
+ crontab -e
231
+ # Add: */1 * * * * /usr/local/bin/wnm >> ~/Library/Logs/autonomi/wnm-cron.log 2>&1
232
+ ```
233
+
234
+ **Linux (user):**
235
+ ```bash
236
+ crontab -e
237
+ # Add: */1 * * * * ~/.local/bin/wnm >> ~/.local/share/autonomi/logs/wnm-cron.log 2>&1
238
+ ```
239
+
240
+ **Linux (root):**
241
+ ```bash
242
+ sudo crontab -e
243
+ # Add: */1 * * * * /usr/local/bin/wnm >> /var/log/antnode/wnm-cron.log 2>&1
244
+ ```
245
+
246
+ ### Development Mode
247
+
248
+ For development with live code reloading:
249
+
250
+ **macOS (native):**
251
+ ```bash
252
+ python3 -m wnm --dry_run
253
+ ```
254
+
255
+ **Linux (Docker):**
256
+ ```bash
257
+ ./scripts/dev.sh
258
+ # Inside container:
259
+ python3 -m wnm --dry_run
260
+ ```
261
+
262
+ See `DOCKER-DEV.md` for comprehensive Docker development workflow.
263
+
264
+ ## Platform Support
265
+
266
+ See `PLATFORM-SUPPORT.md` for detailed information about:
267
+ - Platform-specific process managers (systemd, launchd, setsid)
268
+ - Firewall management (UFW, null)
269
+ - Path conventions per platform
270
+ - Binary management and upgrades
271
+ - Testing strategies
272
+
273
+ ## Contributing
274
+ Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.
275
+
276
+ ## License
277
+ This project is licensed under the MIT License. See the LICENSE file for more details.
@@ -11,7 +11,7 @@ description = "Manager for Autonomi nodes"
11
11
  license = {text = "GPL-3.0"}
12
12
  keywords = ["Autonomi", "antnode", "weave", "xd7"]
13
13
  dynamic = ["version", "dependencies", "optional-dependencies"]
14
- readme = "README.md"
14
+ readme = {file = "README.md", content-type = "text/markdown"}
15
15
  requires-python = ">=3.12.3"
16
16
  classifiers = [
17
17
  "Development Status :: 3 - Alpha",
@@ -24,6 +24,9 @@ classifiers = [
24
24
  "Topic :: System :: Distributed Computing",
25
25
  ]
26
26
 
27
+ [project.urls]
28
+ Repository = "https://github.com/iweave/weave-node-manager.git"
29
+ Issues = "https://github.com/iweave/weave-node-manager/issues"
27
30
 
28
31
  [project.scripts]
29
32
  wnm = "wnm.__main__:main"
@@ -34,5 +37,18 @@ optional-dependencies.dev = { file = ["requirements-dev.txt"] }
34
37
  version = {attr = "wnm.__version__"}
35
38
 
36
39
  [tool.setuptools.packages.find]
37
- where = ["."]
40
+ where = ["src"]
38
41
 
42
+ [tool.black]
43
+ line-length = 88
44
+
45
+ [tool.isort]
46
+ profile = "black"
47
+
48
+ [tool.pytest.ini_options]
49
+ markers = [
50
+ "linux_only: tests that require Linux (systemd, ufw, etc.)",
51
+ "macos_only: tests that require macOS (launchctl, etc.)",
52
+ "requires_docker: tests that require Docker",
53
+ "integration: integration tests (slow)",
54
+ ]
@@ -0,0 +1,10 @@
1
+ black
2
+ isort
3
+ build
4
+ twine
5
+ pytest>=8.0.0
6
+ pytest-cov>=4.1.0
7
+ pytest-asyncio>=0.23.0
8
+ pytest-mock>=3.12.0
9
+ pytest-docker>=3.1.0
10
+ docker>=7.0.0
@@ -5,3 +5,4 @@ sqlalchemy
5
5
  alembic
6
6
  json-fix
7
7
  psutil
8
+ configargparse
@@ -1,6 +1,3 @@
1
- [options]
2
- packages = find:
3
-
4
1
  [egg_info]
5
2
  tag_build =
6
3
  tag_date = 0
@@ -1,3 +1,3 @@
1
1
  """A service to manage a cluster of decentralized Autonomi nodes"""
2
2
 
3
- __version__ = "0.0.8"
3
+ __version__ = "0.0.10"