clonebox 0.1.1__tar.gz → 0.1.2__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.
@@ -0,0 +1,301 @@
1
+ Metadata-Version: 2.4
2
+ Name: clonebox
3
+ Version: 0.1.2
4
+ Summary: Clone your workstation environment to an isolated VM with selective apps, paths and services
5
+ Author: CloneBox Team
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/wronai/clonebox
8
+ Project-URL: Repository, https://github.com/wronai/clonebox
9
+ Project-URL: Issues, https://github.com/wronai/clonebox/issues
10
+ Keywords: vm,virtualization,libvirt,clone,workstation,qemu,kvm
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: System :: Systems Administration
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: libvirt-python>=9.0.0
29
+ Requires-Dist: rich>=13.0.0
30
+ Requires-Dist: questionary>=2.0.0
31
+ Requires-Dist: psutil>=5.9.0
32
+ Requires-Dist: pyyaml>=6.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
36
+ Requires-Dist: black>=23.0.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ # CloneBox 📦
41
+
42
+ ```commandline
43
+ ╔═══════════════════════════════════════════════════════╗
44
+ ║ ____ _ ____ ║
45
+ ║ / ___|| | ___ _ __ ___| _ \ ___ __ __ ║
46
+ ║ | | | | / _ \ | '_ \ / _ \ |_) |/ _ \\ \/ / ║
47
+ ║ | |___ | || (_) || | | | __/ _ <| (_) |> < ║
48
+ ║ \____||_| \___/ |_| |_|\___|_| \_\\___//_/\_\ ║
49
+ ║ ║
50
+ ║ Clone your workstation to an isolated VM ║
51
+ ╚═══════════════════════════════════════════════════════╝
52
+ ```
53
+ **Clone your workstation environment to an isolated VM with selective apps, paths and services.**
54
+
55
+ CloneBox lets you create isolated virtual machines with only the applications, directories and services you need - using bind mounts instead of full disk cloning. Perfect for development, testing, or creating reproducible environments.
56
+
57
+ ## Features
58
+
59
+ - 🎯 **Selective cloning** - Choose exactly which paths, services and apps to include
60
+ - 🔍 **Auto-detection** - Automatically detects running services, applications, and project directories
61
+ - 🔗 **Bind mounts** - Share directories with the VM without copying data
62
+ - ☁️ **Cloud-init** - Automatic package installation and service setup
63
+ - 🖥️ **GUI support** - SPICE graphics with virt-viewer integration
64
+ - ⚡ **Fast creation** - No full disk cloning, VMs are ready in seconds
65
+
66
+ ## Installation
67
+
68
+ ### Prerequisites
69
+
70
+ ```bash
71
+ # Install libvirt and QEMU/KVM
72
+ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager virt-viewer
73
+
74
+ # Enable and start libvirtd
75
+ sudo systemctl enable --now libvirtd
76
+
77
+ # Add user to libvirt group
78
+ sudo usermod -aG libvirt $USER
79
+ newgrp libvirt
80
+
81
+ # Install genisoimage for cloud-init
82
+ sudo apt install genisoimage
83
+ ```
84
+
85
+ ### Install CloneBox
86
+
87
+ ```bash
88
+ # From source
89
+ git clone https://github.com/wronai/clonebox.git
90
+ cd clonebox
91
+ pip install -e .
92
+
93
+ # Or directly
94
+ pip install clonebox
95
+ ```
96
+ lub
97
+ ```bash
98
+ # Aktywuj venv
99
+ source .venv/bin/activate
100
+
101
+ # Interaktywny tryb (wizard)
102
+ clonebox
103
+
104
+ # Lub poszczególne komendy
105
+ clonebox detect # Pokaż wykryte usługi/apps/ścieżki
106
+ clonebox list # Lista VM
107
+ clonebox create --config ... # Utwórz VM z JSON config
108
+ clonebox start <name> # Uruchom VM
109
+ clonebox stop <name> # Zatrzymaj VM
110
+ clonebox delete <name> # Usuń VM
111
+ ```
112
+
113
+ ## Quick Start
114
+
115
+ ### Interactive Mode (Recommended)
116
+
117
+ Simply run `clonebox` to start the interactive wizard:
118
+
119
+ ```bash
120
+ clonebox
121
+ ```
122
+
123
+ The wizard will:
124
+ 1. Detect running services (Docker, PostgreSQL, nginx, etc.)
125
+ 2. Detect running applications and their working directories
126
+ 3. Detect project directories and config files
127
+ 4. Let you select what to include in the VM
128
+ 5. Create and optionally start the VM
129
+
130
+ ### Command Line
131
+
132
+ ```bash
133
+ # Create VM with specific config
134
+ clonebox create --name my-dev-vm --config '{
135
+ "paths": {
136
+ "/home/user/projects": "/mnt/projects",
137
+ "/home/user/.config": "/mnt/config"
138
+ },
139
+ "packages": ["python3", "nodejs", "docker.io"],
140
+ "services": ["docker"]
141
+ }' --ram 4096 --vcpus 4 --start
142
+
143
+ # List VMs
144
+ clonebox list
145
+
146
+ # Start/Stop VM
147
+ clonebox start my-dev-vm
148
+ clonebox stop my-dev-vm
149
+
150
+ # Delete VM
151
+ clonebox delete my-dev-vm
152
+
153
+ # Detect system state (useful for scripting)
154
+ clonebox detect --json
155
+ ```
156
+
157
+ ## Usage Examples
158
+
159
+ ### Python Development Environment
160
+
161
+ ```bash
162
+ clonebox create --name python-dev --config '{
163
+ "paths": {
164
+ "/home/user/my-python-project": "/workspace",
165
+ "/home/user/.pyenv": "/root/.pyenv"
166
+ },
167
+ "packages": ["python3", "python3-pip", "python3-venv", "build-essential"],
168
+ "services": []
169
+ }' --ram 2048 --start
170
+ ```
171
+
172
+ ### Docker Development
173
+
174
+ ```bash
175
+ clonebox create --name docker-dev --config '{
176
+ "paths": {
177
+ "/home/user/docker-projects": "/projects",
178
+ "/var/run/docker.sock": "/var/run/docker.sock"
179
+ },
180
+ "packages": ["docker.io", "docker-compose"],
181
+ "services": ["docker"]
182
+ }' --ram 4096 --start
183
+ ```
184
+
185
+ ### Full Stack (Node.js + PostgreSQL)
186
+
187
+ ```bash
188
+ clonebox create --name fullstack --config '{
189
+ "paths": {
190
+ "/home/user/my-app": "/app",
191
+ "/home/user/pgdata": "/var/lib/postgresql/data"
192
+ },
193
+ "packages": ["nodejs", "npm", "postgresql"],
194
+ "services": ["postgresql"]
195
+ }' --ram 4096 --vcpus 4 --start
196
+ ```
197
+
198
+ ## Inside the VM
199
+
200
+ After the VM boots, mount shared directories:
201
+
202
+ ```bash
203
+ # Mount shared paths (9p filesystem)
204
+ sudo mkdir -p /mnt/projects
205
+ sudo mount -t 9p -o trans=virtio,version=9p2000.L mount0 /mnt/projects
206
+
207
+ # Or add to /etc/fstab for permanent mount
208
+ echo "mount0 /mnt/projects 9p trans=virtio,version=9p2000.L 0 0" | sudo tee -a /etc/fstab
209
+ ```
210
+
211
+ ## Architecture
212
+
213
+ ```
214
+ ┌────────────────────────────────────────────────────────┐
215
+ │ HOST SYSTEM │
216
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
217
+ │ │ /home/user/ │ │ /var/www/ │ │ Docker │ │
218
+ │ │ projects/ │ │ html/ │ │ Socket │ │
219
+ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
220
+ │ │ │ │ │
221
+ │ │ 9p/virtio │ │ │
222
+ │ │ bind mounts │ │ │
223
+ │ ┌──────▼─────────────────▼─────────────────▼───────┐ │
224
+ │ │ CloneBox VM │ │
225
+ │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
226
+ │ │ │ /mnt/proj │ │ /mnt/www │ │ /var/run/ │ │ │
227
+ │ │ │ │ │ │ │ docker.sock│ │ │
228
+ │ │ └────────────┘ └────────────┘ └────────────┘ │ │
229
+ │ │ │ │
230
+ │ │ cloud-init installed packages & services │ │
231
+ │ └──────────────────────────────────────────────────┘ │
232
+ └────────────────────────────────────────────────────────┘
233
+ ```
234
+
235
+ ## Quick Clone (Recommended)
236
+
237
+ The fastest way to clone your current working directory:
238
+
239
+ ```bash
240
+ # Clone current directory - generates .clonebox.yaml and asks to create VM
241
+ clonebox clone .
242
+
243
+ # Clone specific path
244
+ clonebox clone ~/projects/my-app
245
+
246
+ # Clone with custom name and auto-start
247
+ clonebox clone ~/projects/my-app --name my-dev-vm --run
248
+
249
+ # Clone and edit config before creating
250
+ clonebox clone . --edit
251
+ ```
252
+
253
+ Later, start the VM from any directory with `.clonebox.yaml`:
254
+
255
+ ```bash
256
+ # Start VM from config in current directory
257
+ clonebox start .
258
+
259
+ # Start VM from specific path
260
+ clonebox start ~/projects/my-app
261
+ ```
262
+
263
+ ### Export YAML Config
264
+
265
+ ```bash
266
+ # Export detected state as YAML (with deduplication)
267
+ clonebox detect --yaml --dedupe
268
+
269
+ # Save to file
270
+ clonebox detect --yaml --dedupe -o my-config.yaml
271
+ ```
272
+
273
+ ## Commands Reference
274
+
275
+ | Command | Description |
276
+ |---------|-------------|
277
+ | `clonebox` | Interactive VM creation wizard |
278
+ | `clonebox clone <path>` | Generate `.clonebox.yaml` from path + running processes |
279
+ | `clonebox clone . --run` | Clone and immediately start VM |
280
+ | `clonebox clone . --edit` | Clone, edit config, then create |
281
+ | `clonebox start .` | Start VM from `.clonebox.yaml` in current dir |
282
+ | `clonebox start <name>` | Start existing VM by name |
283
+ | `clonebox stop <name>` | Stop a VM (graceful shutdown) |
284
+ | `clonebox stop -f <name>` | Force stop a VM |
285
+ | `clonebox delete <name>` | Delete VM and storage |
286
+ | `clonebox list` | List all VMs |
287
+ | `clonebox detect` | Show detected services/apps/paths |
288
+ | `clonebox detect --yaml` | Output as YAML config |
289
+ | `clonebox detect --yaml --dedupe` | YAML with duplicates removed |
290
+ | `clonebox detect --json` | Output as JSON |
291
+
292
+ ## Requirements
293
+
294
+ - Linux with KVM support (`/dev/kvm`)
295
+ - libvirt daemon running
296
+ - Python 3.8+
297
+ - User in `libvirt` group
298
+
299
+ ## License
300
+
301
+ MIT License - see [LICENSE](LICENSE) file.
@@ -0,0 +1,262 @@
1
+ # CloneBox 📦
2
+
3
+ ```commandline
4
+ ╔═══════════════════════════════════════════════════════╗
5
+ ║ ____ _ ____ ║
6
+ ║ / ___|| | ___ _ __ ___| _ \ ___ __ __ ║
7
+ ║ | | | | / _ \ | '_ \ / _ \ |_) |/ _ \\ \/ / ║
8
+ ║ | |___ | || (_) || | | | __/ _ <| (_) |> < ║
9
+ ║ \____||_| \___/ |_| |_|\___|_| \_\\___//_/\_\ ║
10
+ ║ ║
11
+ ║ Clone your workstation to an isolated VM ║
12
+ ╚═══════════════════════════════════════════════════════╝
13
+ ```
14
+ **Clone your workstation environment to an isolated VM with selective apps, paths and services.**
15
+
16
+ CloneBox lets you create isolated virtual machines with only the applications, directories and services you need - using bind mounts instead of full disk cloning. Perfect for development, testing, or creating reproducible environments.
17
+
18
+ ## Features
19
+
20
+ - 🎯 **Selective cloning** - Choose exactly which paths, services and apps to include
21
+ - 🔍 **Auto-detection** - Automatically detects running services, applications, and project directories
22
+ - 🔗 **Bind mounts** - Share directories with the VM without copying data
23
+ - ☁️ **Cloud-init** - Automatic package installation and service setup
24
+ - 🖥️ **GUI support** - SPICE graphics with virt-viewer integration
25
+ - ⚡ **Fast creation** - No full disk cloning, VMs are ready in seconds
26
+
27
+ ## Installation
28
+
29
+ ### Prerequisites
30
+
31
+ ```bash
32
+ # Install libvirt and QEMU/KVM
33
+ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager virt-viewer
34
+
35
+ # Enable and start libvirtd
36
+ sudo systemctl enable --now libvirtd
37
+
38
+ # Add user to libvirt group
39
+ sudo usermod -aG libvirt $USER
40
+ newgrp libvirt
41
+
42
+ # Install genisoimage for cloud-init
43
+ sudo apt install genisoimage
44
+ ```
45
+
46
+ ### Install CloneBox
47
+
48
+ ```bash
49
+ # From source
50
+ git clone https://github.com/wronai/clonebox.git
51
+ cd clonebox
52
+ pip install -e .
53
+
54
+ # Or directly
55
+ pip install clonebox
56
+ ```
57
+ lub
58
+ ```bash
59
+ # Aktywuj venv
60
+ source .venv/bin/activate
61
+
62
+ # Interaktywny tryb (wizard)
63
+ clonebox
64
+
65
+ # Lub poszczególne komendy
66
+ clonebox detect # Pokaż wykryte usługi/apps/ścieżki
67
+ clonebox list # Lista VM
68
+ clonebox create --config ... # Utwórz VM z JSON config
69
+ clonebox start <name> # Uruchom VM
70
+ clonebox stop <name> # Zatrzymaj VM
71
+ clonebox delete <name> # Usuń VM
72
+ ```
73
+
74
+ ## Quick Start
75
+
76
+ ### Interactive Mode (Recommended)
77
+
78
+ Simply run `clonebox` to start the interactive wizard:
79
+
80
+ ```bash
81
+ clonebox
82
+ ```
83
+
84
+ The wizard will:
85
+ 1. Detect running services (Docker, PostgreSQL, nginx, etc.)
86
+ 2. Detect running applications and their working directories
87
+ 3. Detect project directories and config files
88
+ 4. Let you select what to include in the VM
89
+ 5. Create and optionally start the VM
90
+
91
+ ### Command Line
92
+
93
+ ```bash
94
+ # Create VM with specific config
95
+ clonebox create --name my-dev-vm --config '{
96
+ "paths": {
97
+ "/home/user/projects": "/mnt/projects",
98
+ "/home/user/.config": "/mnt/config"
99
+ },
100
+ "packages": ["python3", "nodejs", "docker.io"],
101
+ "services": ["docker"]
102
+ }' --ram 4096 --vcpus 4 --start
103
+
104
+ # List VMs
105
+ clonebox list
106
+
107
+ # Start/Stop VM
108
+ clonebox start my-dev-vm
109
+ clonebox stop my-dev-vm
110
+
111
+ # Delete VM
112
+ clonebox delete my-dev-vm
113
+
114
+ # Detect system state (useful for scripting)
115
+ clonebox detect --json
116
+ ```
117
+
118
+ ## Usage Examples
119
+
120
+ ### Python Development Environment
121
+
122
+ ```bash
123
+ clonebox create --name python-dev --config '{
124
+ "paths": {
125
+ "/home/user/my-python-project": "/workspace",
126
+ "/home/user/.pyenv": "/root/.pyenv"
127
+ },
128
+ "packages": ["python3", "python3-pip", "python3-venv", "build-essential"],
129
+ "services": []
130
+ }' --ram 2048 --start
131
+ ```
132
+
133
+ ### Docker Development
134
+
135
+ ```bash
136
+ clonebox create --name docker-dev --config '{
137
+ "paths": {
138
+ "/home/user/docker-projects": "/projects",
139
+ "/var/run/docker.sock": "/var/run/docker.sock"
140
+ },
141
+ "packages": ["docker.io", "docker-compose"],
142
+ "services": ["docker"]
143
+ }' --ram 4096 --start
144
+ ```
145
+
146
+ ### Full Stack (Node.js + PostgreSQL)
147
+
148
+ ```bash
149
+ clonebox create --name fullstack --config '{
150
+ "paths": {
151
+ "/home/user/my-app": "/app",
152
+ "/home/user/pgdata": "/var/lib/postgresql/data"
153
+ },
154
+ "packages": ["nodejs", "npm", "postgresql"],
155
+ "services": ["postgresql"]
156
+ }' --ram 4096 --vcpus 4 --start
157
+ ```
158
+
159
+ ## Inside the VM
160
+
161
+ After the VM boots, mount shared directories:
162
+
163
+ ```bash
164
+ # Mount shared paths (9p filesystem)
165
+ sudo mkdir -p /mnt/projects
166
+ sudo mount -t 9p -o trans=virtio,version=9p2000.L mount0 /mnt/projects
167
+
168
+ # Or add to /etc/fstab for permanent mount
169
+ echo "mount0 /mnt/projects 9p trans=virtio,version=9p2000.L 0 0" | sudo tee -a /etc/fstab
170
+ ```
171
+
172
+ ## Architecture
173
+
174
+ ```
175
+ ┌────────────────────────────────────────────────────────┐
176
+ │ HOST SYSTEM │
177
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
178
+ │ │ /home/user/ │ │ /var/www/ │ │ Docker │ │
179
+ │ │ projects/ │ │ html/ │ │ Socket │ │
180
+ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
181
+ │ │ │ │ │
182
+ │ │ 9p/virtio │ │ │
183
+ │ │ bind mounts │ │ │
184
+ │ ┌──────▼─────────────────▼─────────────────▼───────┐ │
185
+ │ │ CloneBox VM │ │
186
+ │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
187
+ │ │ │ /mnt/proj │ │ /mnt/www │ │ /var/run/ │ │ │
188
+ │ │ │ │ │ │ │ docker.sock│ │ │
189
+ │ │ └────────────┘ └────────────┘ └────────────┘ │ │
190
+ │ │ │ │
191
+ │ │ cloud-init installed packages & services │ │
192
+ │ └──────────────────────────────────────────────────┘ │
193
+ └────────────────────────────────────────────────────────┘
194
+ ```
195
+
196
+ ## Quick Clone (Recommended)
197
+
198
+ The fastest way to clone your current working directory:
199
+
200
+ ```bash
201
+ # Clone current directory - generates .clonebox.yaml and asks to create VM
202
+ clonebox clone .
203
+
204
+ # Clone specific path
205
+ clonebox clone ~/projects/my-app
206
+
207
+ # Clone with custom name and auto-start
208
+ clonebox clone ~/projects/my-app --name my-dev-vm --run
209
+
210
+ # Clone and edit config before creating
211
+ clonebox clone . --edit
212
+ ```
213
+
214
+ Later, start the VM from any directory with `.clonebox.yaml`:
215
+
216
+ ```bash
217
+ # Start VM from config in current directory
218
+ clonebox start .
219
+
220
+ # Start VM from specific path
221
+ clonebox start ~/projects/my-app
222
+ ```
223
+
224
+ ### Export YAML Config
225
+
226
+ ```bash
227
+ # Export detected state as YAML (with deduplication)
228
+ clonebox detect --yaml --dedupe
229
+
230
+ # Save to file
231
+ clonebox detect --yaml --dedupe -o my-config.yaml
232
+ ```
233
+
234
+ ## Commands Reference
235
+
236
+ | Command | Description |
237
+ |---------|-------------|
238
+ | `clonebox` | Interactive VM creation wizard |
239
+ | `clonebox clone <path>` | Generate `.clonebox.yaml` from path + running processes |
240
+ | `clonebox clone . --run` | Clone and immediately start VM |
241
+ | `clonebox clone . --edit` | Clone, edit config, then create |
242
+ | `clonebox start .` | Start VM from `.clonebox.yaml` in current dir |
243
+ | `clonebox start <name>` | Start existing VM by name |
244
+ | `clonebox stop <name>` | Stop a VM (graceful shutdown) |
245
+ | `clonebox stop -f <name>` | Force stop a VM |
246
+ | `clonebox delete <name>` | Delete VM and storage |
247
+ | `clonebox list` | List all VMs |
248
+ | `clonebox detect` | Show detected services/apps/paths |
249
+ | `clonebox detect --yaml` | Output as YAML config |
250
+ | `clonebox detect --yaml --dedupe` | YAML with duplicates removed |
251
+ | `clonebox detect --json` | Output as JSON |
252
+
253
+ ## Requirements
254
+
255
+ - Linux with KVM support (`/dev/kvm`)
256
+ - libvirt daemon running
257
+ - Python 3.8+
258
+ - User in `libvirt` group
259
+
260
+ ## License
261
+
262
+ MIT License - see [LICENSE](LICENSE) file.
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "clonebox"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Clone your workstation environment to an isolated VM with selective apps, paths and services"
9
9
  readme = "README.md"
10
- license = {text = "MIT"}
10
+ license = {text = "Apache-2.0"}
11
11
  requires-python = ">=3.8"
12
12
  authors = [
13
13
  {name = "CloneBox Team"}
@@ -18,7 +18,7 @@ classifiers = [
18
18
  "Environment :: Console",
19
19
  "Intended Audience :: Developers",
20
20
  "Intended Audience :: System Administrators",
21
- "License :: OSI Approved :: MIT License",
21
+ "License :: OSI Approved :: Apache Software License",
22
22
  "Operating System :: POSIX :: Linux",
23
23
  "Programming Language :: Python :: 3",
24
24
  "Programming Language :: Python :: 3.8",