wnm 0.0.9__py3-none-any.whl → 0.0.10__py3-none-any.whl

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.

@@ -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.
@@ -0,0 +1,28 @@
1
+ wnm/__init__.py,sha256=7CHBeyet1CmnGNx7WojFYCb23tOP3zcbUbugUF8Bc5I,92
2
+ wnm/__main__.py,sha256=fMlM5gQIFGeFp19oowxmSKwtAE7-xS5-_ThTPaO7J-0,7989
3
+ wnm/actions.py,sha256=h3ieTbQQIggKHqCLVWe5eph5YGif39tZRW3ch82tqys,1314
4
+ wnm/common.py,sha256=AAuKvU3HtpsyKIHL105b9ZI_tIO_m8dp8bvKn3PDyF8,992
5
+ wnm/config.py,sha256=F-e_NBg0h2AXBjegyDZ7nrTvL5aSZ651Rkzz1m0pSyk,26575
6
+ wnm/decision_engine.py,sha256=l_vqrw7imj9EsueLKWkz94P0TtA7UCyNPxBCfgkmNUg,13817
7
+ wnm/executor.py,sha256=XeF6C5fwxkQEPR7D7xdJANRmE-b_TGhZBgdsUR_fZvg,52272
8
+ wnm/migration.py,sha256=QcfvN9S0FIrEDq68IrgM1JBO288ub1tiSXdsrg53eSQ,1389
9
+ wnm/models.py,sha256=qCCNu-Beg5TSQtIi7_1qnfuv5YmzzMq3We9PGektR1E,16684
10
+ wnm/reports.py,sha256=s8rXAy-lNi75C-NMIE7wI_Ux01SuqFyXyVSvYcl6AIc,9133
11
+ wnm/utils.py,sha256=Pzry_8y1nrHkdLshsO56wY_rn4ToPUS8Xaf3n9_HRnY,15642
12
+ wnm/firewall/__init__.py,sha256=2Ur3cSiP2hKVJp9guuuyDDgE2vklyU46KnstDfRq12Q,471
13
+ wnm/firewall/base.py,sha256=cQQ8v7pYgVIjDcXj2jsU4_iZDXRyw7xtlfoJhcy8Gps,1882
14
+ wnm/firewall/factory.py,sha256=zm_SVd1d_NaKkTaj73ai_4oMOhTb1SoHOu0-ylpu2M4,2870
15
+ wnm/firewall/null_firewall.py,sha256=ENmQM0UIubhuqpSqyjSRBCxb3GRPIOYVkMzdZyhUE0Q,1834
16
+ wnm/firewall/ufw_manager.py,sha256=CqkjSr4j8kdIsOdjUbj0h0ZeWhrvsxh_cLvxWUAWaoc,3171
17
+ wnm/process_managers/__init__.py,sha256=ohFXPcqpSBHEkclSaVMfPZdym2KNjcrCfxV6Kbl_3ZY,739
18
+ wnm/process_managers/base.py,sha256=kODNaXY302bCR8BRCISe6g47uDUjA4T7yPKP2s7DlIg,5721
19
+ wnm/process_managers/docker_manager.py,sha256=U-_VMkWK7WzxpWGtMStIRsXBKez8QOcCLZ0pHiHJzZY,11015
20
+ wnm/process_managers/factory.py,sha256=TVkcN-o3kRtf1VylsTXMvpcTM2rwfcZT6QY3JsG5HkQ,2437
21
+ wnm/process_managers/launchd_manager.py,sha256=c0QV_0eowCaNga81mNINvJM3We8BJm2_UvPX0v6-4v4,19860
22
+ wnm/process_managers/setsid_manager.py,sha256=DW3BylkmmdUa4_mk68wpdwy5kqG-IJ_s13vG5eKE_Rs,10650
23
+ wnm/process_managers/systemd_manager.py,sha256=4wcWTj_foHdB0Mp88_u1LH7SSenXeqt66CwegHu2VPk,14641
24
+ wnm-0.0.10.dist-info/METADATA,sha256=lka-IqCY4A0YosJCufnPMR13EDyl65PnMFlkCp0GGfM,8835
25
+ wnm-0.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ wnm-0.0.10.dist-info/entry_points.txt,sha256=jfoemjoLVPeeiBMHKqAExrHQ4Rhf9IXxL4JCnS7ZYFo,42
27
+ wnm-0.0.10.dist-info/top_level.txt,sha256=E6dTE5k6efMEB9LaJAZSBu8zzs__l4R55t0-F-LwufI,4
28
+ wnm-0.0.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,95 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: wnm
3
- Version: 0.0.9
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
- Provides-Extra: dev
28
- Requires-Dist: black; extra == "dev"
29
- Requires-Dist: isort; extra == "dev"
30
- Requires-Dist: build; extra == "dev"
31
- Requires-Dist: twine; extra == "dev"
32
-
33
- # Weave Node Manager
34
-
35
- ## Overview
36
- Weave Node Manager (wnm) is a Python application designed to manage nodes for decentralized networks.
37
-
38
- ## Features
39
- - Update node metrics and statuses.
40
- - Manage systemd services and ufw firewall for linux nodes.
41
- - Support for configuration via YAML, JSON, or command-line parameters.
42
-
43
- ## Installation
44
- 1. Create a directory to hold data:
45
- ```
46
- mkdir /home/ubuntu/wnm
47
- ```
48
- 2. Navigate to the project directory:
49
- ```
50
- cd /home/ubuntu/wnm
51
- 3. Install the required dependencies:
52
- ```
53
- sudo apt install -y python3.12-venv python3-dotenv
54
- ```
55
- 4. Create a virtual environment
56
- ```
57
- python3 -m venv .venv
58
- ```
59
- 5. Activate the virtual environment
60
- ```
61
- . .venv/bin/activate
62
- ```
63
- 6. Install the package:
64
- ```
65
- pip install wnm
66
- ```
67
- 7. Run to initialize environment from anm
68
- ```
69
- wnm
70
- ```
71
- 8. Add to cron to run every minute
72
- ```
73
- echo <<EOF
74
- SHELL=/bin/bash
75
- PATH=/home/ubuntu/.local/bin:/home/ubuntu/wnm/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
76
- */1 * * * * ubuntu cd /home/ubuntu/wnm && wnm > /home/ubuntu/wnm/cron.out 2>&1
77
- EOF
78
- ```
79
-
80
- ## Configuration
81
- Configuration can be done through a `.env` file, YAML, or JSON files. The application will prioritize these configurations over default values.
82
-
83
- Upon finding an existing installation of [anm - aatonnomicc node manager](https://github.com/safenetforum-community/NTracking/tree/main/anm), wnm will disable anm and take over management of the cluster. The /var/antctl/config is only read on first ingestion, configuration priority then moves to the `.env` file or a named configuration file.
84
-
85
- ## Usage
86
- To run the application, execute the following command:
87
- ```
88
- python main.py
89
- ```
90
-
91
- ## Contributing
92
- Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.
93
-
94
- ## License
95
- This project is licensed under the MIT License. See the LICENSE file for more details.
@@ -1,9 +0,0 @@
1
- wnm/__init__.py,sha256=wnR-RpRGfmQSlcHdue7DLD-ZZ_i7JqSQgh-EpgYdyKk,91
2
- wnm/__main__.py,sha256=MhRLjRv3VrwVlbtUmhBpfcLgyxe0oERexVIKNVchD3I,44447
3
- wnm/config.py,sha256=nMJlzxZX7NA0iI_QAuJDE0uI3V_ROjP5v99wdKDfuDs,47
4
- wnm/models.py,sha256=4FRgDcUxT9Hk4VT1FL2kxhep5G3vkxaU0v9LftylDkA,9997
5
- wnm-0.0.9.dist-info/METADATA,sha256=hBb-_t8RJsCHg713Owb1I-M6kfybPb_nzLgzwd85Zdc,3119
6
- wnm-0.0.9.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
7
- wnm-0.0.9.dist-info/entry_points.txt,sha256=jfoemjoLVPeeiBMHKqAExrHQ4Rhf9IXxL4JCnS7ZYFo,42
8
- wnm-0.0.9.dist-info/top_level.txt,sha256=E6dTE5k6efMEB9LaJAZSBu8zzs__l4R55t0-F-LwufI,4
9
- wnm-0.0.9.dist-info/RECORD,,