request-vm-on-golem 0.1.0__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.
@@ -0,0 +1,296 @@
1
+ Metadata-Version: 2.1
2
+ Name: request-vm-on-golem
3
+ Version: 0.1.0
4
+ Summary: VM on Golem Requestor CLI - Create and manage virtual machines on the Golem Network
5
+ Home-page: https://github.com/cryptobench/vm-on-golem
6
+ Keywords: golem,vm,cloud,decentralized,cli
7
+ Author: Phillip Jensen
8
+ Author-email: phillip+vm-on-golem@golemgrid.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: System :: Distributed Computing
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Requires-Dist: aiohttp (>=3.7.4,<4.0.0)
24
+ Requires-Dist: aiosqlite (>=0.17.0,<0.18.0)
25
+ Requires-Dist: asyncssh (>=2.7.0,<3.0.0)
26
+ Requires-Dist: click (>=8.0.1,<9.0.0)
27
+ Requires-Dist: colorlog (>=6.7.0,<7.0.0)
28
+ Requires-Dist: cryptography (>=3.4.7,<4.0.0)
29
+ Requires-Dist: pydantic (>=1.8.2,<2.0.0)
30
+ Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
31
+ Requires-Dist: tabulate (>=0.9.0,<0.10.0)
32
+ Project-URL: Repository, https://github.com/cryptobench/vm-on-golem
33
+ Description-Content-Type: text/markdown
34
+
35
+ # VM on Golem Requestor
36
+
37
+ A sophisticated command-line interface for managing virtual machines on the Golem Network. The requestor works in tandem with provider nodes to create and manage VMs with secure SSH access.
38
+
39
+ ## Architecture Overview
40
+
41
+ ```mermaid
42
+ graph TB
43
+ subgraph Requestor
44
+ CLI[CLI Interface]
45
+ DB[Local Database]
46
+ SSH[SSH Manager]
47
+ PC[Provider Client]
48
+ end
49
+
50
+ subgraph Provider
51
+ API[Provider API]
52
+ VM[VM Manager]
53
+ Proxy[SSH Proxy]
54
+ RT[Resource Tracker]
55
+ end
56
+
57
+ CLI --> PC
58
+ PC --> API
59
+ SSH --> Proxy
60
+ VM --> RT
61
+ ```
62
+
63
+ ## How It Works
64
+
65
+ ### 1. VM Creation Flow
66
+
67
+ ```mermaid
68
+ sequenceDiagram
69
+ participant User
70
+ participant CLI
71
+ participant SSH
72
+ participant Provider
73
+ participant VM
74
+
75
+ User->>CLI: Create VM Command
76
+ CLI->>SSH: Generate SSH Key
77
+ SSH-->>CLI: Key Pair
78
+ CLI->>Provider: Create VM Request + Public Key
79
+ Provider->>VM: Launch with Cloud-Init
80
+ Provider->>Proxy: Configure SSH Port
81
+ Provider-->>CLI: VM Details + Port
82
+ CLI->>DB: Save VM State
83
+ CLI-->>User: Connection Info
84
+ ```
85
+
86
+ When you create a VM:
87
+ 1. The requestor generates an SSH key pair or uses your system's existing keys
88
+ 2. The provider receives the public key and injects it during VM creation via cloud-init
89
+ 3. The provider allocates a dedicated port and configures SSH forwarding
90
+ 4. Connection details are stored locally for future access
91
+
92
+ ### 2. SSH Connection Flow
93
+
94
+ ```mermaid
95
+ sequenceDiagram
96
+ participant User
97
+ participant CLI
98
+ participant DB
99
+ participant Proxy
100
+ participant VM
101
+
102
+ User->>CLI: SSH Command
103
+ CLI->>DB: Get VM Details
104
+ DB-->>CLI: Connection Info
105
+ CLI->>Proxy: SSH Connection
106
+ Proxy->>VM: Forward Connection
107
+ VM-->>User: Interactive Shell
108
+ ```
109
+
110
+ The SSH connection process:
111
+ 1. The CLI retrieves stored VM details from the local database
112
+ 2. The provider's proxy system forwards your SSH connection to the VM
113
+ 3. All traffic is securely routed through the allocated port
114
+
115
+ ## Installation
116
+
117
+ ```bash
118
+ # Install using pip
119
+ pip install golem-vm-requestor
120
+
121
+ # Or install from source
122
+ git clone https://github.com/golem/vm-on-golem.git
123
+ cd vm-on-golem/requestor-server
124
+ pip install -e .
125
+ ```
126
+
127
+ ## Usage
128
+
129
+ ### Provider Discovery
130
+
131
+ List available providers with their resources:
132
+
133
+ ```bash
134
+ golem vm providers
135
+ ```
136
+
137
+ Example output:
138
+ ```
139
+ ────────────────────────────────────────────────
140
+ 🌍 Available Providers (3 total)
141
+ ────────────────────────────────────────────────
142
+ Provider ID Country CPU Memory Storage
143
+ provider-1 🌍 SE 💻 4 🧠 8GB 💾 40GB
144
+ provider-2 🌍 US 💻 8 🧠 16GB 💾 80GB
145
+ provider-3 🌍 DE 💻 2 🧠 4GB 💾 20GB
146
+ ────────────────────────────────────────────────
147
+ ```
148
+
149
+ ### Creating a VM
150
+
151
+ ```bash
152
+ golem vm create my-webserver --provider-id provider-1 --cpu 2 --memory 4 --storage 20
153
+ ```
154
+
155
+ The system will:
156
+ 1. Verify provider availability
157
+ 2. Check resource requirements
158
+ 3. Set up SSH access
159
+ 4. Deploy and configure the VM
160
+ 5. Save connection details locally
161
+
162
+ Example output:
163
+ ```
164
+ ────────────────────────────────────────────────
165
+ 🎉 VM Deployed Successfully!
166
+ ────────────────────────────────────────────────
167
+
168
+ VM Details
169
+ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
170
+ 🏷️ Name : my-webserver
171
+ 💻 Resources : 2 CPU, 4GB RAM, 20GB Storage
172
+ 🟢 Status : running
173
+
174
+ Connection Details
175
+ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
176
+ 🌐 IP Address : 192.168.1.100
177
+ 🔌 Port : 50800
178
+
179
+ Quick Connect
180
+ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
181
+ 🔑 SSH Command : ssh -i ~/.golem/ssh/id_rsa -p 50800 ubuntu@192.168.1.100
182
+ ────────────────────────────────────────────────
183
+ ```
184
+
185
+ ### Managing VMs
186
+
187
+ List your VMs:
188
+ ```bash
189
+ golem vm list
190
+ ```
191
+
192
+ Example output:
193
+ ```
194
+ ────────────────────────────────────────────────
195
+ 📋 Your VMs (2 total)
196
+ ────────────────────────────────────────────────
197
+ Name Status IP Address Resources
198
+ my-webserver ● running 192.168.1.100 2 CPU, 4GB RAM
199
+ my-database ● stopped 192.168.1.101 4 CPU, 8GB RAM
200
+ ────────────────────────────────────────────────
201
+ ```
202
+
203
+ Other commands:
204
+ ```bash
205
+ # SSH into a VM
206
+ golem vm ssh my-webserver
207
+
208
+ # Stop a VM
209
+ golem vm stop my-webserver
210
+
211
+ # Start a VM
212
+ golem vm start my-webserver
213
+
214
+ # Destroy a VM
215
+ golem vm destroy my-webserver
216
+ ```
217
+
218
+ ## Configuration
219
+
220
+ The requestor uses a hierarchical configuration system:
221
+
222
+ 1. Environment Variables:
223
+ ```bash
224
+ # Discovery Service
225
+ export GOLEM_REQUESTOR_DISCOVERY_URL="http://discovery.golem.network:7465"
226
+
227
+ # Base Directory (default: ~/.golem)
228
+ export GOLEM_REQUESTOR_BASE_DIR="/path/to/golem/dir"
229
+
230
+ # Individual Paths (override base dir)
231
+ export GOLEM_REQUESTOR_SSH_KEY_DIR="/path/to/keys"
232
+ export GOLEM_REQUESTOR_DB_PATH="/path/to/database.db"
233
+
234
+ # Environment Mode
235
+ export GOLEM_REQUESTOR_ENVIRONMENT="production" # or "development"
236
+ ```
237
+
238
+ 2. Directory Structure:
239
+ ```
240
+ ~/.golem/
241
+ ├── ssh/ # SSH keys
242
+ │ ├── id_rsa # Private key
243
+ │ └── id_rsa.pub # Public key
244
+ └── vms.db # SQLite database
245
+ ```
246
+
247
+ ## Technical Details
248
+
249
+ ### SSH Key Management
250
+
251
+ The system intelligently handles SSH keys:
252
+ 1. Uses existing system SSH keys if available
253
+ 2. Generates and manages Golem-specific keys if needed
254
+ 3. Ensures proper key permissions (0600 for private, 0644 for public)
255
+ 4. Supports key reuse across VMs
256
+
257
+ ### State Management
258
+
259
+ Local state is maintained in SQLite:
260
+ - VM details and configuration
261
+ - Provider information
262
+ - Connection parameters
263
+ - VM status tracking
264
+
265
+ ### Provider Integration
266
+
267
+ The requestor communicates with providers through:
268
+ 1. Discovery service for provider location
269
+ 2. Direct API calls for VM management
270
+ 3. SSH proxy system for secure access
271
+ 4. Resource tracking for capacity management
272
+
273
+ ## Error Handling
274
+
275
+ The system provides clear error messages and recovery steps:
276
+
277
+ ```
278
+ Error: Unable to establish SSH connection (VM may be starting up)
279
+ Solution: Wait a few moments and try again. The VM is likely still initializing.
280
+
281
+ Error: Provider is no longer available (they may have gone offline)
282
+ Solution: Choose a different provider or wait for the original to come back online.
283
+
284
+ Error: VM not found in local database
285
+ Solution: The VM may have been manually removed. Use 'golem vm list' to see available VMs.
286
+ ```
287
+
288
+ ## Contributing
289
+
290
+ 1. Fork the repository
291
+ 2. Create a feature branch
292
+ 3. Make your changes
293
+ 4. Run the tests
294
+ 5. Submit a pull request
295
+
296
+
@@ -0,0 +1,18 @@
1
+ requestor/__init__.py,sha256=OqSUAh1uZBMx7GW0MoSMg967PVdmT8XdPJx3QYjwkak,116
2
+ requestor/cli/__init__.py,sha256=e3E4oEGxmGj-STPtFkQwg_qIWhR0JAiAQdw3G1hXciU,37
3
+ requestor/cli/commands.py,sha256=RCdAAoyFbzfAxd2_EXXCymSEP7VQMGu7VjnsYWd-tB8,24223
4
+ requestor/config.py,sha256=CWULCWpzpGwSSgn7L2IMUNywHK7Bng_b84kmObVLFLc,2191
5
+ requestor/db/__init__.py,sha256=Gm5DfWls6uvCZZ3HGGnyRHswbUQdeA5OGN8yPwH0hc8,88
6
+ requestor/db/sqlite.py,sha256=kqutQMs3srcZHa5kI1cbHvOYr66cCfQCb2xuioNAbLc,4638
7
+ requestor/errors.py,sha256=wVpHBuYgQx5pTe_SamugfK-k768noikY1RxvPOjQGko,665
8
+ requestor/provider/__init__.py,sha256=fmW23aYUVciF8-gmBZkG-PLhn22upmcDzdPfAOLHG6g,103
9
+ requestor/provider/client.py,sha256=OUP7CoOCCtKD6DB9eqFkOXK6A2BLFdM4DWSkoulJQxg,3213
10
+ requestor/run.py,sha256=mFqoP93KuRpQZ8pmzP5pHvByaDjHJ9xRYRjYC77s6bg,1386
11
+ requestor/ssh/__init__.py,sha256=hNgSqJ5s1_AwwxVRyFjUqh_LTBpI4Hmzq0F-f_wXN9g,119
12
+ requestor/ssh/manager.py,sha256=h-93AXFJqzGo2lNTG2u-q4ivU9cCFeNDhYN55skPLBo,6566
13
+ requestor/utils/logging.py,sha256=oFNpO8pJboYM8Wp7g3HOU4HFyBTKypVdY15lUiz1a4I,3721
14
+ requestor/utils/spinner.py,sha256=PUHJdTD9jpUHur__01_qxXy87WFfNmjQbD_sLG-KlGo,2459
15
+ request_vm_on_golem-0.1.0.dist-info/METADATA,sha256=Kz8UZmfYOlHkDDQ_aaJFBuVQqvPHa1QyEXU7epzvU_k,8898
16
+ request_vm_on_golem-0.1.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
+ request_vm_on_golem-0.1.0.dist-info/entry_points.txt,sha256=Z-skRNpJ8aZcIl_En9mEm1ygkp9FKy0bzQoL3zO52-0,44
18
+ request_vm_on_golem-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ golem=requestor.run:main
3
+
requestor/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """
2
+ VM on Golem Requestor Node
3
+
4
+ A simple CLI tool for managing VMs on the Golem Network.
5
+ """
6
+
7
+ __version__ = "0.1.0"
@@ -0,0 +1 @@
1
+ """CLI interface for VM on Golem."""