request-vm-on-golem 0.1.51__tar.gz → 0.1.52__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.
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/PKG-INFO +59 -36
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/README.md +58 -35
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/pyproject.toml +1 -1
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/cli/commands.py +24 -9
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/config.py +112 -16
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/security/faucet.py +5 -2
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/provider_service.py +16 -3
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/__init__.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/api/main.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/cli/__init__.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/data/deployments/l2.json +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/db/__init__.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/db/sqlite.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/errors.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/payments/blockchain_service.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/payments/monitor.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/provider/__init__.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/provider/client.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/run.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/__init__.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/database_service.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/ssh_service.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/vm_service.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/ssh/__init__.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/ssh/manager.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/utils/logging.py +0 -0
- {request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/utils/spinner.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: request-vm-on-golem
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.52
|
4
4
|
Summary: VM on Golem Requestor CLI - Create and manage virtual machines on the Golem Network
|
5
5
|
Keywords: golem,vm,cloud,decentralized,cli
|
6
6
|
Author: Phillip Jensen
|
@@ -41,7 +41,40 @@ Description-Content-Type: text/markdown
|
|
41
41
|
|
42
42
|
# VM on Golem Requestor
|
43
43
|
|
44
|
-
|
44
|
+
Rent compute on demand — like Airbnb for servers. The `golem` CLI helps you discover providers, fund pay‑as‑you‑go streams, launch VMs, and connect via SSH.
|
45
|
+
|
46
|
+
## Quick Start (Rent a VM)
|
47
|
+
|
48
|
+
1) Install:
|
49
|
+
|
50
|
+
```bash
|
51
|
+
pip install request-vm-on-golem
|
52
|
+
```
|
53
|
+
|
54
|
+
2) Find providers (testnet by default):
|
55
|
+
|
56
|
+
```bash
|
57
|
+
golem vm providers
|
58
|
+
```
|
59
|
+
|
60
|
+
3) Create a VM (auto‑opens a payment stream if needed):
|
61
|
+
|
62
|
+
```bash
|
63
|
+
golem vm create my-vm --provider-id 0xProvider --cpu 2 --memory 4 --storage 20
|
64
|
+
```
|
65
|
+
|
66
|
+
4) SSH in:
|
67
|
+
|
68
|
+
```bash
|
69
|
+
golem vm ssh my-vm
|
70
|
+
```
|
71
|
+
|
72
|
+
5) Stop or destroy when done:
|
73
|
+
|
74
|
+
```bash
|
75
|
+
golem vm stop my-vm
|
76
|
+
golem vm destroy my-vm
|
77
|
+
```
|
45
78
|
|
46
79
|
## Architecture Overview
|
47
80
|
|
@@ -141,7 +174,7 @@ CLI helpers
|
|
141
174
|
- Open a stream for a planned VM (computes rate from provider pricing):
|
142
175
|
|
143
176
|
```bash
|
144
|
-
|
177
|
+
golem vm stream open \
|
145
178
|
--provider-id 0xProvider \
|
146
179
|
--cpu 2 --memory 4 --storage 20 \
|
147
180
|
--hours 1
|
@@ -152,39 +185,39 @@ poetry run golem vm stream open \
|
|
152
185
|
|
153
186
|
```bash
|
154
187
|
# Add 3 hours at prior rate
|
155
|
-
|
188
|
+
golem vm stream topup --stream-id 123 --hours 3
|
156
189
|
|
157
190
|
# Or specify exact GLM amount
|
158
|
-
|
191
|
+
golem vm stream topup --stream-id 123 --glm 25.0
|
159
192
|
```
|
160
193
|
|
161
194
|
- Check stream status via provider (by VM name recorded in your DB):
|
162
195
|
|
163
196
|
```bash
|
164
|
-
|
197
|
+
golem vm stream status my-vm
|
165
198
|
# add --json for machine-readable output
|
166
199
|
```
|
167
200
|
|
168
201
|
- Inspect a stream directly on-chain:
|
169
202
|
|
170
203
|
```bash
|
171
|
-
|
204
|
+
golem vm stream inspect --stream-id 123
|
172
205
|
```
|
173
206
|
|
174
207
|
- Stopping or destroying a VM ends the stream:
|
175
208
|
|
176
209
|
```bash
|
177
210
|
# Stop VM and terminate payment stream (best-effort)
|
178
|
-
|
211
|
+
golem vm stop my-vm
|
179
212
|
|
180
213
|
# Destroy VM and terminate stream
|
181
|
-
|
214
|
+
golem vm destroy my-vm
|
182
215
|
```
|
183
216
|
|
184
217
|
- Create a VM and attach an existing stream (no auto-streams are created by the requestor):
|
185
218
|
|
186
219
|
```bash
|
187
|
-
|
220
|
+
golem vm create my-vm \
|
188
221
|
--provider-id 0xProvider \
|
189
222
|
--cpu 2 --memory 4 --storage 20 \
|
190
223
|
--stream-id 123
|
@@ -192,7 +225,8 @@ poetry run golem vm create my-vm \
|
|
192
225
|
|
193
226
|
Environment (env prefix `GOLEM_REQUESTOR_`):
|
194
227
|
|
195
|
-
- `
|
228
|
+
- `payments_network` — Payments network profile (defaults to `l2.holesky`). Profiles provide RPC + faucet defaults.
|
229
|
+
- `polygon_rpc_url` — EVM RPC URL (defaults from `payments_network` profile; can be overridden)
|
196
230
|
- `stream_payment_address` — StreamPayment address (defaults from `contracts/deployments/l2.json`; overridden by provider info)
|
197
231
|
- `glm_token_address` — Token address (defaults from `contracts/deployments/l2.json`; zero address means native ETH)
|
198
232
|
- Optional override of deployments directory: set `GOLEM_DEPLOYMENTS_DIR` to a folder containing `l2.json`.
|
@@ -210,16 +244,16 @@ Monitoring and auto top-up:
|
|
210
244
|
- The requestor API runs a background monitor that keeps each running VM’s stream funded with at least 1 hour runway (configurable). It checks every 30s and tops up to the target runway.
|
211
245
|
- Configure via env (prefix `GOLEM_REQUESTOR_`): `stream_monitor_enabled` (default true), `stream_monitor_interval_seconds` (default 30), `stream_min_remaining_seconds` (default 3600), `stream_topup_target_seconds` (default 3600).
|
212
246
|
|
213
|
-
## Faucet (
|
247
|
+
## Faucet (Testnet only)
|
214
248
|
|
215
249
|
- Request L2 test ETH to cover stream transactions:
|
216
250
|
|
217
251
|
```bash
|
218
|
-
|
252
|
+
golem wallet faucet
|
219
253
|
```
|
220
254
|
|
221
255
|
- Defaults:
|
222
|
-
- Faucet
|
256
|
+
- Faucet URL and enablement come from the active `payments_network` profile. On `mainnet` (or other profiles without faucet) the command is disabled.
|
223
257
|
- CAPTCHA: `https://cap.gobas.me/05381a2cef5e`
|
224
258
|
- Override with env: `GOLEM_REQUESTOR_l2_faucet_url`, `GOLEM_REQUESTOR_captcha_url`, `GOLEM_REQUESTOR_captcha_api_key`.
|
225
259
|
|
@@ -227,7 +261,7 @@ poetry run golem wallet faucet
|
|
227
261
|
|
228
262
|
```bash
|
229
263
|
# Install using pip
|
230
|
-
pip install
|
264
|
+
pip install request-vm-on-golem
|
231
265
|
|
232
266
|
# Or install from source
|
233
267
|
git clone https://github.com/golem/vm-on-golem.git
|
@@ -249,11 +283,7 @@ First, source the development environment variables:
|
|
249
283
|
source .env.dev
|
250
284
|
```
|
251
285
|
|
252
|
-
Then, run any `golem` command. For example:
|
253
|
-
|
254
|
-
```bash
|
255
|
-
poetry run golem vm providers
|
256
|
-
```
|
286
|
+
Then, run any `golem` command. For example: `golem vm providers`
|
257
287
|
|
258
288
|
### Prepending variables
|
259
289
|
|
@@ -270,19 +300,15 @@ GOLEM_REQUESTOR_ENVIRONMENT="development" GOLEM_REQUESTOR_FORCE_LOCALHOST="true"
|
|
270
300
|
- Does not determine chain selection.
|
271
301
|
|
272
302
|
- Network Selection (`--network` or `GOLEM_REQUESTOR_NETWORK`)
|
273
|
-
- Filters
|
274
|
-
|
275
|
-
|
303
|
+
- Filters results by `testnet|mainnet`. Defaults are sensible; most users don’t need to change anything.
|
304
|
+
|
305
|
+
- Payments Network (`GOLEM_REQUESTOR_PAYMENTS_NETWORK`)
|
306
|
+
- Selects the payments chain profile (e.g., `l2.holesky`, `mainnet`) used for streaming payments; sets default RPC and faucet behavior.
|
307
|
+
- Provider discovery filters by this payments network via `vm providers` unless `--all-payments` is supplied. Override payments filter with `--payments-network <name>`.
|
276
308
|
|
277
309
|
Examples:
|
278
|
-
- List providers on mainnet without changing env:
|
279
|
-
|
280
|
-
poetry run golem vm providers --network mainnet
|
281
|
-
```
|
282
|
-
- Create a VM while targeting testnet:
|
283
|
-
```bash
|
284
|
-
poetry run golem vm create my-vm --provider-id 0xProvider --cpu 2 --memory 4 --storage 20 --network testnet
|
285
|
-
```
|
310
|
+
- List providers on mainnet without changing env: `golem vm providers --network mainnet`
|
311
|
+
- Create a VM while targeting testnet: `golem vm create my-vm --provider-id 0xProvider --cpu 2 --memory 4 --storage 20 --network testnet`
|
286
312
|
|
287
313
|
## Usage
|
288
314
|
|
@@ -388,9 +414,6 @@ The requestor uses a hierarchical configuration system:
|
|
388
414
|
1. Environment Variables:
|
389
415
|
|
390
416
|
```bash
|
391
|
-
# Discovery Service
|
392
|
-
export GOLEM_REQUESTOR_DISCOVERY_URL="http://discovery.golem.network:9001"
|
393
|
-
|
394
417
|
# Base Directory (default: ~/.golem)
|
395
418
|
export GOLEM_REQUESTOR_BASE_DIR="/path/to/golem/dir"
|
396
419
|
|
@@ -401,7 +424,7 @@ export GOLEM_REQUESTOR_DB_PATH="/path/to/database.db"
|
|
401
424
|
# Environment Mode (defaults to "production")
|
402
425
|
export GOLEM_REQUESTOR_ENVIRONMENT="development" # Optional: Switch to development mode
|
403
426
|
export GOLEM_REQUESTOR_FORCE_LOCALHOST="true" # Optional: Force localhost in development mode
|
404
|
-
export GOLEM_REQUESTOR_NETWORK="testnet" # Or "mainnet";
|
427
|
+
export GOLEM_REQUESTOR_NETWORK="testnet" # Or "mainnet"; optional filter for listing/creation
|
405
428
|
```
|
406
429
|
|
407
430
|
2. Directory Structure:
|
@@ -438,7 +461,7 @@ Local state is maintained in SQLite:
|
|
438
461
|
|
439
462
|
The requestor communicates with providers through:
|
440
463
|
|
441
|
-
1.
|
464
|
+
1. Network discovery (uses sane defaults; no setup required for most users)
|
442
465
|
2. Direct API calls for VM management
|
443
466
|
3. SSH proxy system for secure access
|
444
467
|
4. Resource tracking for capacity management
|
@@ -1,6 +1,39 @@
|
|
1
1
|
# VM on Golem Requestor
|
2
2
|
|
3
|
-
|
3
|
+
Rent compute on demand — like Airbnb for servers. The `golem` CLI helps you discover providers, fund pay‑as‑you‑go streams, launch VMs, and connect via SSH.
|
4
|
+
|
5
|
+
## Quick Start (Rent a VM)
|
6
|
+
|
7
|
+
1) Install:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
pip install request-vm-on-golem
|
11
|
+
```
|
12
|
+
|
13
|
+
2) Find providers (testnet by default):
|
14
|
+
|
15
|
+
```bash
|
16
|
+
golem vm providers
|
17
|
+
```
|
18
|
+
|
19
|
+
3) Create a VM (auto‑opens a payment stream if needed):
|
20
|
+
|
21
|
+
```bash
|
22
|
+
golem vm create my-vm --provider-id 0xProvider --cpu 2 --memory 4 --storage 20
|
23
|
+
```
|
24
|
+
|
25
|
+
4) SSH in:
|
26
|
+
|
27
|
+
```bash
|
28
|
+
golem vm ssh my-vm
|
29
|
+
```
|
30
|
+
|
31
|
+
5) Stop or destroy when done:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
golem vm stop my-vm
|
35
|
+
golem vm destroy my-vm
|
36
|
+
```
|
4
37
|
|
5
38
|
## Architecture Overview
|
6
39
|
|
@@ -100,7 +133,7 @@ CLI helpers
|
|
100
133
|
- Open a stream for a planned VM (computes rate from provider pricing):
|
101
134
|
|
102
135
|
```bash
|
103
|
-
|
136
|
+
golem vm stream open \
|
104
137
|
--provider-id 0xProvider \
|
105
138
|
--cpu 2 --memory 4 --storage 20 \
|
106
139
|
--hours 1
|
@@ -111,39 +144,39 @@ poetry run golem vm stream open \
|
|
111
144
|
|
112
145
|
```bash
|
113
146
|
# Add 3 hours at prior rate
|
114
|
-
|
147
|
+
golem vm stream topup --stream-id 123 --hours 3
|
115
148
|
|
116
149
|
# Or specify exact GLM amount
|
117
|
-
|
150
|
+
golem vm stream topup --stream-id 123 --glm 25.0
|
118
151
|
```
|
119
152
|
|
120
153
|
- Check stream status via provider (by VM name recorded in your DB):
|
121
154
|
|
122
155
|
```bash
|
123
|
-
|
156
|
+
golem vm stream status my-vm
|
124
157
|
# add --json for machine-readable output
|
125
158
|
```
|
126
159
|
|
127
160
|
- Inspect a stream directly on-chain:
|
128
161
|
|
129
162
|
```bash
|
130
|
-
|
163
|
+
golem vm stream inspect --stream-id 123
|
131
164
|
```
|
132
165
|
|
133
166
|
- Stopping or destroying a VM ends the stream:
|
134
167
|
|
135
168
|
```bash
|
136
169
|
# Stop VM and terminate payment stream (best-effort)
|
137
|
-
|
170
|
+
golem vm stop my-vm
|
138
171
|
|
139
172
|
# Destroy VM and terminate stream
|
140
|
-
|
173
|
+
golem vm destroy my-vm
|
141
174
|
```
|
142
175
|
|
143
176
|
- Create a VM and attach an existing stream (no auto-streams are created by the requestor):
|
144
177
|
|
145
178
|
```bash
|
146
|
-
|
179
|
+
golem vm create my-vm \
|
147
180
|
--provider-id 0xProvider \
|
148
181
|
--cpu 2 --memory 4 --storage 20 \
|
149
182
|
--stream-id 123
|
@@ -151,7 +184,8 @@ poetry run golem vm create my-vm \
|
|
151
184
|
|
152
185
|
Environment (env prefix `GOLEM_REQUESTOR_`):
|
153
186
|
|
154
|
-
- `
|
187
|
+
- `payments_network` — Payments network profile (defaults to `l2.holesky`). Profiles provide RPC + faucet defaults.
|
188
|
+
- `polygon_rpc_url` — EVM RPC URL (defaults from `payments_network` profile; can be overridden)
|
155
189
|
- `stream_payment_address` — StreamPayment address (defaults from `contracts/deployments/l2.json`; overridden by provider info)
|
156
190
|
- `glm_token_address` — Token address (defaults from `contracts/deployments/l2.json`; zero address means native ETH)
|
157
191
|
- Optional override of deployments directory: set `GOLEM_DEPLOYMENTS_DIR` to a folder containing `l2.json`.
|
@@ -169,16 +203,16 @@ Monitoring and auto top-up:
|
|
169
203
|
- The requestor API runs a background monitor that keeps each running VM’s stream funded with at least 1 hour runway (configurable). It checks every 30s and tops up to the target runway.
|
170
204
|
- Configure via env (prefix `GOLEM_REQUESTOR_`): `stream_monitor_enabled` (default true), `stream_monitor_interval_seconds` (default 30), `stream_min_remaining_seconds` (default 3600), `stream_topup_target_seconds` (default 3600).
|
171
205
|
|
172
|
-
## Faucet (
|
206
|
+
## Faucet (Testnet only)
|
173
207
|
|
174
208
|
- Request L2 test ETH to cover stream transactions:
|
175
209
|
|
176
210
|
```bash
|
177
|
-
|
211
|
+
golem wallet faucet
|
178
212
|
```
|
179
213
|
|
180
214
|
- Defaults:
|
181
|
-
- Faucet
|
215
|
+
- Faucet URL and enablement come from the active `payments_network` profile. On `mainnet` (or other profiles without faucet) the command is disabled.
|
182
216
|
- CAPTCHA: `https://cap.gobas.me/05381a2cef5e`
|
183
217
|
- Override with env: `GOLEM_REQUESTOR_l2_faucet_url`, `GOLEM_REQUESTOR_captcha_url`, `GOLEM_REQUESTOR_captcha_api_key`.
|
184
218
|
|
@@ -186,7 +220,7 @@ poetry run golem wallet faucet
|
|
186
220
|
|
187
221
|
```bash
|
188
222
|
# Install using pip
|
189
|
-
pip install
|
223
|
+
pip install request-vm-on-golem
|
190
224
|
|
191
225
|
# Or install from source
|
192
226
|
git clone https://github.com/golem/vm-on-golem.git
|
@@ -208,11 +242,7 @@ First, source the development environment variables:
|
|
208
242
|
source .env.dev
|
209
243
|
```
|
210
244
|
|
211
|
-
Then, run any `golem` command. For example:
|
212
|
-
|
213
|
-
```bash
|
214
|
-
poetry run golem vm providers
|
215
|
-
```
|
245
|
+
Then, run any `golem` command. For example: `golem vm providers`
|
216
246
|
|
217
247
|
### Prepending variables
|
218
248
|
|
@@ -229,19 +259,15 @@ GOLEM_REQUESTOR_ENVIRONMENT="development" GOLEM_REQUESTOR_FORCE_LOCALHOST="true"
|
|
229
259
|
- Does not determine chain selection.
|
230
260
|
|
231
261
|
- Network Selection (`--network` or `GOLEM_REQUESTOR_NETWORK`)
|
232
|
-
- Filters
|
233
|
-
|
234
|
-
|
262
|
+
- Filters results by `testnet|mainnet`. Defaults are sensible; most users don’t need to change anything.
|
263
|
+
|
264
|
+
- Payments Network (`GOLEM_REQUESTOR_PAYMENTS_NETWORK`)
|
265
|
+
- Selects the payments chain profile (e.g., `l2.holesky`, `mainnet`) used for streaming payments; sets default RPC and faucet behavior.
|
266
|
+
- Provider discovery filters by this payments network via `vm providers` unless `--all-payments` is supplied. Override payments filter with `--payments-network <name>`.
|
235
267
|
|
236
268
|
Examples:
|
237
|
-
- List providers on mainnet without changing env:
|
238
|
-
|
239
|
-
poetry run golem vm providers --network mainnet
|
240
|
-
```
|
241
|
-
- Create a VM while targeting testnet:
|
242
|
-
```bash
|
243
|
-
poetry run golem vm create my-vm --provider-id 0xProvider --cpu 2 --memory 4 --storage 20 --network testnet
|
244
|
-
```
|
269
|
+
- List providers on mainnet without changing env: `golem vm providers --network mainnet`
|
270
|
+
- Create a VM while targeting testnet: `golem vm create my-vm --provider-id 0xProvider --cpu 2 --memory 4 --storage 20 --network testnet`
|
245
271
|
|
246
272
|
## Usage
|
247
273
|
|
@@ -347,9 +373,6 @@ The requestor uses a hierarchical configuration system:
|
|
347
373
|
1. Environment Variables:
|
348
374
|
|
349
375
|
```bash
|
350
|
-
# Discovery Service
|
351
|
-
export GOLEM_REQUESTOR_DISCOVERY_URL="http://discovery.golem.network:9001"
|
352
|
-
|
353
376
|
# Base Directory (default: ~/.golem)
|
354
377
|
export GOLEM_REQUESTOR_BASE_DIR="/path/to/golem/dir"
|
355
378
|
|
@@ -360,7 +383,7 @@ export GOLEM_REQUESTOR_DB_PATH="/path/to/database.db"
|
|
360
383
|
# Environment Mode (defaults to "production")
|
361
384
|
export GOLEM_REQUESTOR_ENVIRONMENT="development" # Optional: Switch to development mode
|
362
385
|
export GOLEM_REQUESTOR_FORCE_LOCALHOST="true" # Optional: Force localhost in development mode
|
363
|
-
export GOLEM_REQUESTOR_NETWORK="testnet" # Or "mainnet";
|
386
|
+
export GOLEM_REQUESTOR_NETWORK="testnet" # Or "mainnet"; optional filter for listing/creation
|
364
387
|
```
|
365
388
|
|
366
389
|
2. Directory Structure:
|
@@ -397,7 +420,7 @@ Local state is maintained in SQLite:
|
|
397
420
|
|
398
421
|
The requestor communicates with providers through:
|
399
422
|
|
400
|
-
1.
|
423
|
+
1. Network discovery (uses sane defaults; no setup required for most users)
|
401
424
|
2. Direct API calls for VM management
|
402
425
|
3. SSH proxy system for secure access
|
403
426
|
4. Resource tracking for capacity management
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "request-vm-on-golem"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.52"
|
4
4
|
description = "VM on Golem Requestor CLI - Create and manage virtual machines on the Golem Network"
|
5
5
|
authors = ["Phillip Jensen <phillip+vm-on-golem@golemgrid.com>"]
|
6
6
|
readme = "README.md"
|
@@ -101,11 +101,13 @@ def vm():
|
|
101
101
|
@click.option('--storage', type=int, help='Minimum disk (GB) required')
|
102
102
|
@click.option('--country', help='Preferred provider country')
|
103
103
|
@click.option('--driver', type=click.Choice(['central', 'golem-base']), default=None, help='Discovery driver to use')
|
104
|
+
@click.option('--payments-network', type=str, default=None, help='Filter by payments network profile (default: current config)')
|
105
|
+
@click.option('--all-payments', is_flag=True, help='Do not filter by payments network (show all)')
|
104
106
|
@click.option('--json', 'as_json', is_flag=True, help='Output in JSON format')
|
105
107
|
@click.option('--network', type=click.Choice(['testnet', 'mainnet']), default=None,
|
106
108
|
help='Override network filter for this command')
|
107
109
|
@async_command
|
108
|
-
async def list_providers(cpu: Optional[int], memory: Optional[int], storage: Optional[int], country: Optional[str], driver: Optional[str], as_json: bool, network: Optional[str] = None):
|
110
|
+
async def list_providers(cpu: Optional[int], memory: Optional[int], storage: Optional[int], country: Optional[str], driver: Optional[str], payments_network: Optional[str] = None, all_payments: bool = False, as_json: bool = False, network: Optional[str] = None):
|
109
111
|
"""List available providers matching requirements."""
|
110
112
|
try:
|
111
113
|
if network:
|
@@ -124,7 +126,8 @@ async def list_providers(cpu: Optional[int], memory: Optional[int], storage: Opt
|
|
124
126
|
|
125
127
|
# Determine the discovery driver being used
|
126
128
|
discovery_driver = driver or config.discovery_driver
|
127
|
-
|
129
|
+
eff_pn = payments_network if payments_network is not None else getattr(config, 'payments_network', None)
|
130
|
+
logger.process(f"Querying discovery via {discovery_driver} (network={config.network}, payments={eff_pn if not all_payments else 'ALL'})")
|
128
131
|
|
129
132
|
# Initialize provider service
|
130
133
|
provider_service = ProviderService()
|
@@ -132,13 +135,21 @@ async def list_providers(cpu: Optional[int], memory: Optional[int], storage: Opt
|
|
132
135
|
# If a full spec is provided, enable per-provider estimate display
|
133
136
|
if cpu and memory and storage:
|
134
137
|
provider_service.estimate_spec = (cpu, memory, storage)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
138
|
+
try:
|
139
|
+
providers = await provider_service.find_providers(
|
140
|
+
cpu=cpu,
|
141
|
+
memory=memory,
|
142
|
+
storage=storage,
|
143
|
+
country=country,
|
144
|
+
driver=driver,
|
145
|
+
payments_network=eff_pn,
|
146
|
+
include_all_payments=bool(all_payments),
|
147
|
+
)
|
148
|
+
except TypeError:
|
149
|
+
# Backward compatibility with older/dummy service stubs in tests
|
150
|
+
providers = await provider_service.find_providers(
|
151
|
+
cpu=cpu, memory=memory, storage=storage, country=country, driver=driver
|
152
|
+
)
|
142
153
|
|
143
154
|
if not providers:
|
144
155
|
logger.warning("No providers found matching criteria")
|
@@ -606,6 +617,10 @@ def wallet():
|
|
606
617
|
async def wallet_faucet():
|
607
618
|
"""Request L2 faucet funds for the requestor's payment address."""
|
608
619
|
try:
|
620
|
+
if not getattr(config, 'faucet_enabled', False):
|
621
|
+
logger.warning("Faucet is disabled for the current payments network.")
|
622
|
+
click.echo(json.dumps({"error": "faucet_disabled", "network": getattr(config, 'payments_network', None)}, indent=2))
|
623
|
+
return
|
609
624
|
from ..security.faucet import L2FaucetService
|
610
625
|
from eth_account import Account
|
611
626
|
acct = Account.from_key(config.ethereum_private_key)
|
@@ -54,6 +54,13 @@ class RequestorConfig(BaseSettings):
|
|
54
54
|
description="Target network: 'testnet' or 'mainnet'"
|
55
55
|
)
|
56
56
|
|
57
|
+
# Payments chain selection (modular network profiles)
|
58
|
+
# Keep current standard as l2.holesky
|
59
|
+
payments_network: str = Field(
|
60
|
+
default="l2.holesky",
|
61
|
+
description="Payments network profile (e.g., 'l2.holesky', 'kaolin.holesky', 'mainnet')"
|
62
|
+
)
|
63
|
+
|
57
64
|
# Development Settings
|
58
65
|
force_localhost: bool = Field(
|
59
66
|
default=False,
|
@@ -102,8 +109,8 @@ class RequestorConfig(BaseSettings):
|
|
102
109
|
|
103
110
|
# Payments (EVM RPC)
|
104
111
|
polygon_rpc_url: str = Field(
|
105
|
-
default="
|
106
|
-
description="EVM RPC URL for streaming payments
|
112
|
+
default="",
|
113
|
+
description="EVM RPC URL for streaming payments; defaults from payments_network profile"
|
107
114
|
)
|
108
115
|
stream_payment_address: str = Field(
|
109
116
|
default="",
|
@@ -130,10 +137,10 @@ class RequestorConfig(BaseSettings):
|
|
130
137
|
default=3600,
|
131
138
|
description="Target runway after top-up (seconds)"
|
132
139
|
)
|
133
|
-
# Faucet settings (
|
140
|
+
# Faucet settings (payments)
|
134
141
|
l2_faucet_url: str = Field(
|
135
|
-
default="
|
136
|
-
description="
|
142
|
+
default="",
|
143
|
+
description="Faucet base URL (no trailing /api). Only used on testnets. Defaults from payments_network profile"
|
137
144
|
)
|
138
145
|
captcha_url: str = Field(
|
139
146
|
default="https://cap.gobas.me",
|
@@ -150,8 +157,8 @@ class RequestorConfig(BaseSettings):
|
|
150
157
|
|
151
158
|
@field_validator("polygon_rpc_url", mode='before')
|
152
159
|
@classmethod
|
153
|
-
def prefer_alt_env(cls, v: str) -> str:
|
154
|
-
# Accept alt aliases
|
160
|
+
def prefer_alt_env(cls, v: str, info: ValidationInfo) -> str:
|
161
|
+
# Accept alt aliases overriding the profile
|
155
162
|
for key in (
|
156
163
|
"GOLEM_REQUESTOR_l2_rpc_url",
|
157
164
|
"GOLEM_REQUESTOR_L2_RPC_URL",
|
@@ -160,22 +167,45 @@ class RequestorConfig(BaseSettings):
|
|
160
167
|
):
|
161
168
|
if os.environ.get(key):
|
162
169
|
return os.environ[key]
|
163
|
-
|
170
|
+
if v:
|
171
|
+
return v
|
172
|
+
# Default from payments profile
|
173
|
+
pn = info.data.get("payments_network") or "l2.holesky"
|
174
|
+
return RequestorConfig._profile_defaults(pn)["rpc_url"]
|
175
|
+
|
176
|
+
@field_validator("l2_faucet_url", mode='before')
|
177
|
+
@classmethod
|
178
|
+
def default_faucet_env(cls, v: str, info: ValidationInfo) -> str:
|
179
|
+
for key in (
|
180
|
+
"GOLEM_REQUESTOR_l2_faucet_url",
|
181
|
+
"GOLEM_REQUESTOR_L2_FAUCET_URL",
|
182
|
+
):
|
183
|
+
if os.environ.get(key):
|
184
|
+
return os.environ[key]
|
185
|
+
if v:
|
186
|
+
return v
|
187
|
+
pn = info.data.get("payments_network") or "l2.holesky"
|
188
|
+
return RequestorConfig._profile_defaults(pn).get("faucet_url", "")
|
164
189
|
|
165
190
|
@staticmethod
|
166
|
-
def
|
191
|
+
def _load_deployment(network: str) -> tuple[str | None, str | None]:
|
167
192
|
try:
|
168
193
|
base = os.environ.get("GOLEM_DEPLOYMENTS_DIR")
|
169
194
|
if base:
|
170
|
-
path = Path(base) / "
|
195
|
+
path = Path(base) / f"{RequestorConfig._deployment_basename(network)}.json"
|
171
196
|
else:
|
172
197
|
# repo root assumption: ../../ relative to this file
|
173
|
-
path =
|
198
|
+
path = (
|
199
|
+
Path(__file__).resolve().parents[2]
|
200
|
+
/ "contracts" / "deployments" / f"{RequestorConfig._deployment_basename(network)}.json"
|
201
|
+
)
|
174
202
|
if not path.exists():
|
175
203
|
# Try package resource fallback
|
176
204
|
try:
|
177
205
|
import importlib.resources as ir
|
178
|
-
with ir.files("requestor.data.deployments").joinpath(
|
206
|
+
with ir.files("requestor.data.deployments").joinpath(
|
207
|
+
f"{RequestorConfig._deployment_basename(network)}.json"
|
208
|
+
).open("r") as fh: # type: ignore[attr-defined]
|
179
209
|
import json as _json
|
180
210
|
data = _json.load(fh)
|
181
211
|
except Exception:
|
@@ -192,22 +222,83 @@ class RequestorConfig(BaseSettings):
|
|
192
222
|
pass
|
193
223
|
return None, None
|
194
224
|
|
225
|
+
@staticmethod
|
226
|
+
def _deployment_basename(network: str) -> str:
|
227
|
+
# Map well-known network aliases to deployment file base names
|
228
|
+
n = (network or "").lower()
|
229
|
+
if n in ("l2", "l2.holesky"): # current standard
|
230
|
+
return "l2"
|
231
|
+
if "." in n:
|
232
|
+
return n.split(".")[0]
|
233
|
+
return n or "l2"
|
234
|
+
|
235
|
+
@staticmethod
|
236
|
+
def _profile_defaults(network: str) -> Dict[str, str]:
|
237
|
+
n = (network or "l2.holesky").lower()
|
238
|
+
# Built-in profiles; extend easily in future
|
239
|
+
profiles = {
|
240
|
+
"l2.holesky": {
|
241
|
+
"rpc_url": "https://l2.holesky.golemdb.io/rpc",
|
242
|
+
"faucet_url": "https://l2.holesky.golemdb.io/faucet",
|
243
|
+
"faucet_enabled": True,
|
244
|
+
"token_symbol": "GLM",
|
245
|
+
"gas_symbol": "ETH",
|
246
|
+
},
|
247
|
+
# Example: mainnet has no faucet by default
|
248
|
+
"mainnet": {
|
249
|
+
"rpc_url": "",
|
250
|
+
"faucet_url": "",
|
251
|
+
"faucet_enabled": False,
|
252
|
+
"token_symbol": "GLM",
|
253
|
+
"gas_symbol": "ETH",
|
254
|
+
},
|
255
|
+
}
|
256
|
+
return profiles.get(n, profiles["l2.holesky"]) # default to current standard
|
257
|
+
|
195
258
|
@field_validator("stream_payment_address", mode='before')
|
196
259
|
@classmethod
|
197
|
-
def default_stream_addr(cls, v: str) -> str:
|
260
|
+
def default_stream_addr(cls, v: str, info: ValidationInfo) -> str:
|
198
261
|
if v:
|
199
262
|
return v
|
200
|
-
|
263
|
+
network = info.data.get("payments_network") or "l2.holesky"
|
264
|
+
addr, _ = RequestorConfig._load_deployment(network)
|
201
265
|
return addr or "0x0000000000000000000000000000000000000000"
|
202
266
|
|
203
267
|
@field_validator("glm_token_address", mode='before')
|
204
268
|
@classmethod
|
205
|
-
def default_token_addr(cls, v: str) -> str:
|
269
|
+
def default_token_addr(cls, v: str, info: ValidationInfo) -> str:
|
206
270
|
if v:
|
207
271
|
return v
|
208
|
-
|
272
|
+
network = info.data.get("payments_network") or "l2.holesky"
|
273
|
+
_, token = RequestorConfig._load_deployment(network)
|
209
274
|
return token or "0x0000000000000000000000000000000000000000"
|
210
275
|
|
276
|
+
# Optional convenience: expose token and gas symbols based on profile
|
277
|
+
token_symbol: str = Field(
|
278
|
+
default="",
|
279
|
+
description="Human-friendly symbol of payment token (e.g., GLM)"
|
280
|
+
)
|
281
|
+
gas_token_symbol: str = Field(
|
282
|
+
default="",
|
283
|
+
description="Symbol of gas token for the chain (e.g., ETH)"
|
284
|
+
)
|
285
|
+
|
286
|
+
@field_validator("token_symbol", mode="before")
|
287
|
+
@classmethod
|
288
|
+
def default_token_symbol(cls, v: str, info: ValidationInfo) -> str:
|
289
|
+
if v:
|
290
|
+
return v
|
291
|
+
pn = info.data.get("payments_network") or "l2.holesky"
|
292
|
+
return RequestorConfig._profile_defaults(pn).get("token_symbol", "")
|
293
|
+
|
294
|
+
@field_validator("gas_token_symbol", mode="before")
|
295
|
+
@classmethod
|
296
|
+
def default_gas_symbol(cls, v: str, info: ValidationInfo) -> str:
|
297
|
+
if v:
|
298
|
+
return v
|
299
|
+
pn = info.data.get("payments_network") or "l2.holesky"
|
300
|
+
return RequestorConfig._profile_defaults(pn).get("gas_symbol", "")
|
301
|
+
|
211
302
|
# Base Directory
|
212
303
|
base_dir: Path = Field(
|
213
304
|
default_factory=lambda: Path.home() / ".golem" / "requestor",
|
@@ -240,6 +331,11 @@ class RequestorConfig(BaseSettings):
|
|
240
331
|
kwargs['db_path'] = base_dir / "vms.db"
|
241
332
|
super().__init__(**kwargs)
|
242
333
|
|
334
|
+
@property
|
335
|
+
def faucet_enabled(self) -> bool:
|
336
|
+
"""Whether requesting funds from faucet is allowed for current payments network."""
|
337
|
+
return bool(self._profile_defaults(self.payments_network).get("faucet_enabled", False))
|
338
|
+
|
243
339
|
def get_provider_url(self, ip_address: str) -> str:
|
244
340
|
"""Get provider API URL.
|
245
341
|
|
@@ -15,7 +15,7 @@ class L2FaucetService:
|
|
15
15
|
self.cfg = config
|
16
16
|
self.web3 = Web3(Web3.HTTPProvider(config.polygon_rpc_url))
|
17
17
|
self.client = PowFaucetClient(
|
18
|
-
faucet_url=getattr(config, 'l2_faucet_url', 'https://l2.holesky.golemdb.io/faucet'
|
18
|
+
faucet_url=getattr(config, 'l2_faucet_url', '') or 'https://l2.holesky.golemdb.io/faucet',
|
19
19
|
captcha_base_url=getattr(config, 'captcha_url', 'https://cap.gobas.me'),
|
20
20
|
captcha_api_key=getattr(config, 'captcha_api_key', '05381a2cef5e'),
|
21
21
|
)
|
@@ -29,6 +29,10 @@ class L2FaucetService:
|
|
29
29
|
return 0.0
|
30
30
|
|
31
31
|
async def request_funds(self, address: str) -> Optional[str]:
|
32
|
+
# Disallow faucet if explicitly disabled by profile
|
33
|
+
if hasattr(self.cfg, 'faucet_enabled') and not getattr(self.cfg, 'faucet_enabled'):
|
34
|
+
logger.info("Faucet disabled for current payments network; skipping.")
|
35
|
+
return None
|
32
36
|
bal = self._balance_eth(address)
|
33
37
|
if bal > 0.01:
|
34
38
|
logger.info(f"Sufficient L2 funds ({bal} ETH), skipping faucet.")
|
@@ -51,4 +55,3 @@ class L2FaucetService:
|
|
51
55
|
if tx:
|
52
56
|
logger.success(f"L2 faucet sent tx: {tx}")
|
53
57
|
return tx
|
54
|
-
|
{request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/provider_service.py
RENAMED
@@ -66,7 +66,9 @@ class ProviderService:
|
|
66
66
|
memory: Optional[int] = None,
|
67
67
|
storage: Optional[int] = None,
|
68
68
|
country: Optional[str] = None,
|
69
|
-
driver: Optional[str] = None
|
69
|
+
driver: Optional[str] = None,
|
70
|
+
payments_network: Optional[str] = None,
|
71
|
+
include_all_payments: bool = False,
|
70
72
|
) -> List[Dict]:
|
71
73
|
"""Find providers matching requirements."""
|
72
74
|
discovery_driver = driver or config.discovery_driver
|
@@ -79,7 +81,11 @@ class ProviderService:
|
|
79
81
|
ws_url=config.golem_base_ws_url,
|
80
82
|
private_key=private_key_bytes,
|
81
83
|
)
|
82
|
-
return await self._find_providers_golem_base(
|
84
|
+
return await self._find_providers_golem_base(
|
85
|
+
cpu, memory, storage, country,
|
86
|
+
payments_network=payments_network,
|
87
|
+
include_all_payments=include_all_payments,
|
88
|
+
)
|
83
89
|
else:
|
84
90
|
return await self._find_providers_central(cpu, memory, storage, country)
|
85
91
|
|
@@ -88,7 +94,9 @@ class ProviderService:
|
|
88
94
|
cpu: Optional[int] = None,
|
89
95
|
memory: Optional[int] = None,
|
90
96
|
storage: Optional[int] = None,
|
91
|
-
country: Optional[str] = None
|
97
|
+
country: Optional[str] = None,
|
98
|
+
payments_network: Optional[str] = None,
|
99
|
+
include_all_payments: bool = False,
|
92
100
|
) -> List[Dict]:
|
93
101
|
"""Find providers using Golem Base."""
|
94
102
|
try:
|
@@ -104,6 +112,10 @@ class ProviderService:
|
|
104
112
|
# Filter by advertised network to avoid cross-network results
|
105
113
|
if config.network:
|
106
114
|
query += f' && golem_network="{config.network}"'
|
115
|
+
# Filter by payments network unless explicitly disabled
|
116
|
+
pn = payments_network if payments_network is not None else getattr(config, 'payments_network', None)
|
117
|
+
if pn and not include_all_payments:
|
118
|
+
query += f' && golem_payments_network="{pn}"'
|
107
119
|
if cpu:
|
108
120
|
query += f' && golem_cpu>={cpu}'
|
109
121
|
if memory:
|
@@ -130,6 +142,7 @@ class ProviderService:
|
|
130
142
|
'provider_name': annotations.get('golem_provider_name'),
|
131
143
|
'ip_address': annotations.get('golem_ip_address'),
|
132
144
|
'country': annotations.get('golem_country'),
|
145
|
+
'payments_network': annotations.get('golem_payments_network'),
|
133
146
|
'resources': {
|
134
147
|
'cpu': int(annotations.get('golem_cpu', 0)),
|
135
148
|
'memory': int(annotations.get('golem_memory', 0)),
|
File without changes
|
File without changes
|
File without changes
|
{request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/data/deployments/l2.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/payments/blockchain_service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{request_vm_on_golem-0.1.51 → request_vm_on_golem-0.1.52}/requestor/services/database_service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|