vagrant-orbstack 0.1.0

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.
data/README.md ADDED
@@ -0,0 +1,622 @@
1
+ # vagrant-orbstack-provider
2
+
3
+ A Vagrant provider plugin that enables [OrbStack](https://orbstack.dev/) as a backend for managing Linux development environments on macOS.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/vagrant-orbstack.svg)](https://badge.fury.io/rb/vagrant-orbstack)
6
+ [![Build Status](https://github.com/spiralhouse/vagrant-orbstack-provider/workflows/CI/badge.svg)](https://github.com/spiralhouse/vagrant-orbstack-provider/actions)
7
+ [![codecov](https://codecov.io/gh/spiralhouse/vagrant-orbstack-provider/graph/badge.svg?token=VIHOdRkRJ9)](https://codecov.io/gh/spiralhouse/vagrant-orbstack-provider)
8
+ ![License](https://img.shields.io/badge/license-MIT-green)
9
+
10
+ ## Project Overview
11
+
12
+ OrbStack is a high-performance alternative to traditional VM solutions on macOS, offering:
13
+ - Sub-3-second startup times
14
+ - Near-zero idle resource consumption
15
+ - Native macOS integration with excellent file sharing
16
+ - First-class support for Apple Silicon and Intel Macs
17
+
18
+ This provider allows you to leverage OrbStack's performance while maintaining the familiar Vagrant workflow.
19
+
20
+ > **Development Status**: This provider is under active development. Most features are not yet implemented. See [Project Status](#project-status) for details.
21
+
22
+ ## Table of Contents
23
+
24
+ - [Requirements](#requirements)
25
+ - [Installation](#installation)
26
+ - [Quick Start](#quick-start)
27
+ - [Usage](#usage)
28
+ - [Configuration](#configuration)
29
+ - [Known Limitations](#known-limitations)
30
+ - [Project Status](#project-status)
31
+ - [Development](#development)
32
+ - [Documentation](#documentation)
33
+ - [Contributing](#contributing)
34
+ - [Support](#support)
35
+ - [License](#license)
36
+
37
+ ## Requirements
38
+
39
+ ### System Requirements
40
+ - **Operating System**: macOS 12 (Monterey) or later
41
+ - **Architecture**: Apple Silicon (ARM64) or Intel (x86_64)
42
+ - **Vagrant**: Version 2.2.0 or higher
43
+ - **Ruby**: Version 2.6 or higher
44
+ - **OrbStack**: Latest stable version with CLI tools installed
45
+
46
+ ### Installation
47
+
48
+ OrbStack must be installed and running on your system:
49
+ 1. Download and install [OrbStack](https://orbstack.dev/)
50
+ 2. Verify OrbStack CLI is available: `orb version`
51
+
52
+ ## Installation
53
+
54
+ Install the plugin directly from RubyGems:
55
+
56
+ ```bash
57
+ vagrant plugin install vagrant-orbstack
58
+ ```
59
+
60
+ Verify the installation:
61
+
62
+ ```bash
63
+ vagrant plugin list
64
+ ```
65
+
66
+ You should see `vagrant-orbstack (0.1.0)` in the output.
67
+
68
+ ## Quick Start
69
+
70
+ Create a `Vagrantfile` in your project directory:
71
+
72
+ ```ruby
73
+ Vagrant.configure("2") do |config|
74
+ config.vm.box = "ubuntu"
75
+
76
+ config.vm.provider :orbstack do |os|
77
+ os.distro = "ubuntu"
78
+ os.version = "22.04"
79
+ end
80
+ end
81
+ ```
82
+
83
+ Basic commands:
84
+
85
+ ```bash
86
+ # Create and start the machine
87
+ vagrant up --provider=orbstack
88
+
89
+ # Check machine status
90
+ vagrant status
91
+
92
+ # SSH into the machine
93
+ vagrant ssh
94
+
95
+ # Stop the machine
96
+ vagrant halt
97
+
98
+ # Destroy the machine
99
+ vagrant destroy
100
+ ```
101
+
102
+ ## Usage
103
+
104
+ ### Creating a Machine
105
+
106
+ Create and start an OrbStack machine with Vagrant:
107
+
108
+ ```bash
109
+ vagrant up --provider=orbstack
110
+ ```
111
+
112
+ This will:
113
+ - Create a new OrbStack machine with automatic naming
114
+ - Start the machine immediately
115
+ - Be idempotent (safe to run multiple times—existing machines are not recreated)
116
+
117
+ ### Machine Naming
118
+
119
+ Machines are automatically named using the convention:
120
+ - Format: `vagrant-<machine-name>-<short-id>`
121
+ - Example: `vagrant-default-a3b2c1`
122
+ - The short ID ensures uniqueness for multi-machine setups
123
+
124
+ The machine name can be customized in your Vagrantfile:
125
+
126
+ ```ruby
127
+ Vagrant.configure("2") do |config|
128
+ config.vm.provider :orbstack do |os|
129
+ os.machine_name = "my-dev-env"
130
+ end
131
+ end
132
+ ```
133
+
134
+ With this configuration, your machine will be named `vagrant-my-dev-env-<short-id>`.
135
+
136
+ ### Halt and Resume
137
+
138
+ Stop a running machine:
139
+
140
+ ```bash
141
+ vagrant halt
142
+ ```
143
+
144
+ Resume a halted machine:
145
+
146
+ ```bash
147
+ vagrant up # Resumes existing machine
148
+ ```
149
+
150
+ Check machine status:
151
+
152
+ ```bash
153
+ vagrant status
154
+ ```
155
+
156
+ ### Multi-Machine Support
157
+
158
+ Define multiple machines in your Vagrantfile:
159
+
160
+ ```ruby
161
+ Vagrant.configure("2") do |config|
162
+ config.vm.define "web" do |web|
163
+ web.vm.provider "orbstack" do |orbstack|
164
+ orbstack.distro = "ubuntu"
165
+ orbstack.version = "noble"
166
+ end
167
+ end
168
+
169
+ config.vm.define "db" do |db|
170
+ db.vm.provider "orbstack" do |orbstack|
171
+ orbstack.distro = "debian"
172
+ end
173
+ end
174
+ end
175
+ ```
176
+
177
+ Each machine gets a unique name (e.g., `vagrant-web-a3b2c1`, `vagrant-db-d4e5f6`). You can manage them individually:
178
+
179
+ ```bash
180
+ # Create web machine
181
+ vagrant up web --provider=orbstack
182
+
183
+ # Create db machine
184
+ vagrant up db --provider=orbstack
185
+
186
+ # Check status of all machines
187
+ vagrant status
188
+
189
+ # SSH into web machine
190
+ vagrant ssh web
191
+
192
+ # Halt specific machine
193
+ vagrant halt web
194
+ ```
195
+
196
+ ### SSH Access
197
+
198
+ The OrbStack provider supports SSH connectivity through OrbStack's built-in SSH proxy architecture.
199
+
200
+ #### Basic SSH Usage
201
+
202
+ Access your machine using standard Vagrant SSH commands:
203
+
204
+ ```bash
205
+ # Interactive SSH session
206
+ vagrant ssh
207
+
208
+ # With multi-machine setup
209
+ vagrant ssh web
210
+ ```
211
+
212
+ #### Understanding OrbStack's SSH User Model
213
+
214
+ **Important**: OrbStack machines use your **macOS username** (not "vagrant") for SSH connections.
215
+
216
+ When you SSH into an OrbStack machine, you'll be logged in as your macOS user (e.g., `jburbridge`), not the traditional `vagrant` user. This is OrbStack's intentional design and is the correct behavior.
217
+
218
+ **Example**:
219
+ ```bash
220
+ vagrant ssh
221
+ # You are now: jburbridge@vagrant-default-a3b2c1
222
+
223
+ whoami
224
+ # Output: jburbridge (your macOS username)
225
+ ```
226
+
227
+ #### Why This Works
228
+
229
+ OrbStack uses an SSH proxy architecture:
230
+
231
+ 1. **SSH Proxy**: OrbStack provides an SSH proxy at `localhost:32222`
232
+ 2. **Machine ID Routing**: The proxy uses the machine ID for routing to the correct VM
233
+ 3. **Automatic Authentication**: OrbStack manages SSH keys automatically at `~/.orbstack/ssh/id_ed25519`
234
+ 4. **User Mapping**: The proxy maps connections to your macOS username inside the VM
235
+
236
+ This design provides:
237
+ - Seamless authentication (no password required)
238
+ - Automatic SSH key management
239
+ - Secure localhost-only connections
240
+ - Consistent username across macOS and Linux environments
241
+
242
+ #### User Permissions
243
+
244
+ Your macOS user inside the OrbStack VM has:
245
+ - Passwordless `sudo` access
246
+ - Membership in standard groups (`adm`, `sudo`, `video`, `staff`, `orbstack`)
247
+ - Full administrative capabilities
248
+
249
+ #### SSH Configuration
250
+
251
+ You can view the SSH configuration Vagrant generates:
252
+
253
+ ```bash
254
+ vagrant ssh-config
255
+ ```
256
+
257
+ This shows:
258
+ - Host: `127.0.0.1` (localhost)
259
+ - Port: `32222` (OrbStack SSH proxy)
260
+ - User: `<machine-id>` (used for routing by the proxy)
261
+ - IdentityFile: `~/.orbstack/ssh/id_ed25519`
262
+ - ProxyCommand: OrbStack Helper for connection proxying
263
+
264
+ #### Known Limitations
265
+
266
+ **Command Execution** (`vagrant ssh -c`): Currently not supported. Use this workaround:
267
+
268
+ ```bash
269
+ # Instead of: vagrant ssh -c "whoami"
270
+ # Use:
271
+ ssh -F <(vagrant ssh-config) default "whoami"
272
+ ```
273
+
274
+ This limitation is tracked in issue [SPI-1240](https://linear.app/spiral-house/issue/SPI-1240).
275
+
276
+ **Manual SSH**: You can also connect directly using OrbStack's SSH syntax:
277
+
278
+ ```bash
279
+ ssh <machine-name>@orb whoami
280
+ ```
281
+
282
+ For more technical details about OrbStack's SSH architecture, see [`docs/DESIGN.md`](./docs/DESIGN.md#ssh-integration).
283
+
284
+ ## Configuration
285
+
286
+ The OrbStack provider supports several configuration options to customize your development environment. All configuration is optional—the provider uses sensible defaults following Vagrant's convention-over-configuration philosophy.
287
+
288
+ ### Basic Configuration
289
+
290
+ The minimal Vagrantfile requires no provider-specific configuration:
291
+
292
+ ```ruby
293
+ Vagrant.configure("2") do |config|
294
+ config.vm.box = "ubuntu" # Currently ignored - to be implemented
295
+
296
+ config.vm.provider :orbstack do |os|
297
+ # Uses defaults: Ubuntu distribution
298
+ end
299
+ end
300
+ ```
301
+
302
+ ### Configuration Options
303
+
304
+ | Option | Type | Default | Required | Description |
305
+ |--------|------|---------|----------|-------------|
306
+ | `distro` | String | `"ubuntu"` | No | Linux distribution to use |
307
+ | `version` | String | `nil` | No | Distribution version (e.g., "22.04") |
308
+ | `machine_name` | String | `nil` (auto-generated) | No | Custom OrbStack machine name |
309
+
310
+ #### Validation Rules
311
+
312
+ - **distro**: Cannot be empty or blank. The provider validates this at runtime.
313
+ - **machine_name**: If specified, must contain only alphanumeric characters (a-z, A-Z, 0-9) and hyphens (-). Must start and end with an alphanumeric character. No consecutive hyphens allowed.
314
+ - Valid examples: `"my-dev-env"`, `"project-1"`, `"ubuntu-machine"`
315
+ - Invalid examples: `"-invalid"`, `"invalid-"`, `"invalid--name"`, `"invalid_name"`
316
+
317
+ ### Configuration Examples
318
+
319
+ #### Default Configuration
320
+
321
+ The simplest configuration uses all defaults:
322
+
323
+ ```ruby
324
+ Vagrant.configure("2") do |config|
325
+ config.vm.box = "ubuntu" # Currently ignored - to be implemented
326
+
327
+ config.vm.provider :orbstack do |os|
328
+ # All options use defaults
329
+ # distro: "ubuntu"
330
+ # version: nil
331
+ # machine_name: nil (auto-generated)
332
+ end
333
+ end
334
+ ```
335
+
336
+ #### Specify Distribution and Version
337
+
338
+ Choose a specific Linux distribution and version:
339
+
340
+ ```ruby
341
+ Vagrant.configure("2") do |config|
342
+ config.vm.box = "ubuntu" # Currently ignored - to be implemented
343
+
344
+ config.vm.provider :orbstack do |os|
345
+ os.distro = "ubuntu"
346
+ os.version = "22.04"
347
+ end
348
+ end
349
+ ```
350
+
351
+ #### Custom Machine Name
352
+
353
+ Provide a custom name for your OrbStack machine:
354
+
355
+ ```ruby
356
+ Vagrant.configure("2") do |config|
357
+ config.vm.box = "ubuntu" # Currently ignored - to be implemented
358
+
359
+ config.vm.provider :orbstack do |os|
360
+ os.distro = "ubuntu"
361
+ os.machine_name = "my-dev-machine"
362
+ end
363
+ end
364
+ ```
365
+
366
+ #### Complete Configuration
367
+
368
+ Specify all available options:
369
+
370
+ ```ruby
371
+ Vagrant.configure("2") do |config|
372
+ config.vm.box = "ubuntu" # Currently ignored - to be implemented
373
+
374
+ config.vm.provider :orbstack do |os|
375
+ os.distro = "ubuntu"
376
+ os.version = "22.04"
377
+ os.machine_name = "my-dev-environment"
378
+ end
379
+ end
380
+ ```
381
+
382
+ #### Different Distributions
383
+
384
+ Examples using various Linux distributions:
385
+
386
+ ```ruby
387
+ # Debian
388
+ Vagrant.configure("2") do |config|
389
+ config.vm.box = "debian" # Currently ignored - to be implemented
390
+
391
+ config.vm.provider :orbstack do |os|
392
+ os.distro = "debian"
393
+ os.version = "12"
394
+ os.machine_name = "debian-dev"
395
+ end
396
+ end
397
+
398
+ # Fedora
399
+ Vagrant.configure("2") do |config|
400
+ config.vm.box = "fedora" # Currently ignored - to be implemented
401
+
402
+ config.vm.provider :orbstack do |os|
403
+ os.distro = "fedora"
404
+ os.version = "39"
405
+ os.machine_name = "fedora-dev"
406
+ end
407
+ end
408
+
409
+ # Alpine Linux
410
+ Vagrant.configure("2") do |config|
411
+ config.vm.box = "alpine" # Currently ignored - to be implemented
412
+
413
+ config.vm.provider :orbstack do |os|
414
+ os.distro = "alpine"
415
+ os.version = "3.19"
416
+ os.machine_name = "alpine-dev"
417
+ end
418
+ end
419
+ ```
420
+
421
+ ### Supported Distributions
422
+
423
+ The provider supports the following Linux distributions available in OrbStack:
424
+
425
+ - **Ubuntu** (default) - Popular Debian-based distribution
426
+ - **Debian** - Stable, universal Linux distribution
427
+ - **Fedora** - Cutting-edge features and latest packages
428
+ - **Arch Linux** - Rolling release, minimalist distribution
429
+ - **Alpine Linux** - Lightweight, security-oriented distribution
430
+
431
+ **Note**: Distribution availability depends on your OrbStack installation. Refer to the [OrbStack documentation](https://docs.orbstack.dev/machines/) for the most current list of supported distributions and versions.
432
+
433
+ ## Known Limitations
434
+
435
+ The following features are not yet supported in v0.1.0:
436
+
437
+ - **Box Support**: Box format is not implemented. You must use distribution-based creation with `distro` and `version` configuration.
438
+ - **Synced Folders**: Shared folders between host and guest are not yet supported.
439
+ - **Networking**: Configuration is limited to OrbStack defaults. Custom network settings are not available.
440
+ - **Command Execution**: The `vagrant ssh -c "command"` syntax is not yet supported. Use the workaround documented in the [SSH section](#ssh-access).
441
+ - **Provisioners**: While basic provisioner support exists, not all scenarios have been tested.
442
+ - **Platform**: macOS-only due to OrbStack platform requirement.
443
+
444
+ These features are planned for future releases. See [CHANGELOG.md](./CHANGELOG.md) for version history and the [PRD](./docs/PRD.md) for the complete roadmap.
445
+
446
+ ## Project Status
447
+
448
+ ### Implemented
449
+
450
+ - **Foundation (v0.1.0)**:
451
+ - Plugin registration and gem structure (SPI-1130)
452
+ - Configuration class with `distro`, `version`, `machine_name` attributes
453
+ - Provider interface foundation
454
+ - Test infrastructure (RSpec)
455
+ - YARD documentation for public APIs
456
+ - RuboCop clean (0 offenses)
457
+
458
+ - **State Management (v0.2.0-dev)**:
459
+ - Machine state query implementation (SPI-1199)
460
+ - Provider#state method returns accurate Vagrant::MachineState
461
+ - StateCache utility with 5-second TTL for performance optimization
462
+ - State mapping: OrbStack states (running, stopped) → Vagrant states (:running, :stopped, :not_created)
463
+ - Cache invalidation support (per-key and global)
464
+ - Graceful error handling for CLI failures and timeouts
465
+
466
+ - **Machine Creation and Naming (v0.2.0-dev)**:
467
+ - Machine creation via `vagrant up --provider=orbstack` (SPI-1200)
468
+ - Automatic machine naming with format `vagrant-<name>-<short-id>`
469
+ - Idempotent operations (safe to run multiple times)
470
+ - Multi-machine support with unique name generation
471
+ - State-aware creation (checks if machine exists before creating)
472
+ - MachineNamer utility for unique name generation
473
+ - Create action middleware implementation
474
+
475
+ - **Machine Lifecycle Management (v0.2.0-dev)**:
476
+ - Machine halt via `vagrant halt` (SPI-1201)
477
+ - Machine resume via `vagrant up` on stopped machines (SPI-1201)
478
+ - Halt and Start action middleware implementations
479
+ - State cache invalidation for accurate status queries
480
+ - Idempotent halt/start operations (safe to run multiple times)
481
+ - User-friendly progress messages with machine IDs
482
+
483
+ - **OrbStack CLI Integration (partial)**:
484
+ - CLI wrapper with command execution and timeout support
485
+ - Machine listing and info retrieval (SPI-1198)
486
+ - Machine creation and lifecycle methods (SPI-1200)
487
+ - Error handling (CommandTimeoutError, CommandExecutionError, MachineNameCollisionError)
488
+ - Logging infrastructure throughout provider components
489
+
490
+ - **Test Coverage**:
491
+ - 363 passing tests with comprehensive coverage
492
+ - 99.5% test pass rate
493
+ - 100% coverage of implemented features
494
+
495
+ ### Planned (MVP - v0.2.0+)
496
+
497
+ - SSH integration for remote access
498
+ - Machine destroy operations
499
+ - OrbStack CLI wrapper completion (delete command)
500
+ - Provisioner support (Shell, Ansible, Chef, Puppet)
501
+ - Synced folder configuration
502
+ - Error handling and recovery mechanisms
503
+ - Additional Linux distribution support
504
+
505
+ For complete roadmap, see [`docs/PRD.md`](./docs/PRD.md).
506
+
507
+ ## Development
508
+
509
+ ### Setup
510
+
511
+ ```bash
512
+ # Clone and setup
513
+ git clone https://github.com/spiralhouse/vagrant-orbstack-provider.git
514
+ cd vagrant-orbstack-provider
515
+ bundle install
516
+ ```
517
+
518
+ ### Running Tests
519
+
520
+ ```bash
521
+ # Run all tests
522
+ bundle exec rspec
523
+
524
+ # Run specific test file
525
+ bundle exec rspec spec/vagrant-orbstack/provider_spec.rb
526
+
527
+ # Run with documentation format
528
+ bundle exec rspec --format documentation
529
+ ```
530
+
531
+ ### Code Quality
532
+
533
+ ```bash
534
+ # Run RuboCop (linter)
535
+ bundle exec rubocop
536
+
537
+ # Auto-fix offenses
538
+ bundle exec rubocop -A
539
+
540
+ # Generate YARD documentation
541
+ yard doc
542
+ ```
543
+
544
+ ### Local Testing
545
+
546
+ To test local changes before contributing:
547
+
548
+ ```bash
549
+ # Build and install gem locally
550
+ gem build vagrant-orbstack.gemspec
551
+ vagrant plugin install pkg/vagrant-orbstack-0.1.0.gem
552
+
553
+ # Create test environment
554
+ mkdir test-env && cd test-env
555
+ cat > Vagrantfile <<EOF
556
+ Vagrant.configure("2") do |config|
557
+ config.vm.provider :orbstack do |os|
558
+ os.distro = "ubuntu"
559
+ os.version = "22.04"
560
+ end
561
+ end
562
+ EOF
563
+
564
+ # Test your changes
565
+ vagrant up --provider=orbstack
566
+ vagrant ssh
567
+ vagrant halt
568
+ vagrant destroy
569
+ ```
570
+
571
+ ## Documentation
572
+
573
+ - **[Product Requirements (PRD)](./docs/PRD.md)**: Complete feature requirements and roadmap
574
+ - **[Technical Design (DESIGN)](./docs/DESIGN.md)**: Architecture and implementation details
575
+ - **[TDD Workflow (TDD)](./docs/TDD.md)**: Test-driven development process
576
+ - **[Development Guide (DEVELOPMENT)](./DEVELOPMENT.md)**: Contributor documentation
577
+
578
+ ## Contributing
579
+
580
+ This project follows Test-Driven Development (TDD). See [`CLAUDE.md`](./CLAUDE.md) for our development workflow and [`docs/TDD.md`](./docs/TDD.md) for TDD guidelines.
581
+
582
+ ### Development Workflow
583
+
584
+ 1. Create feature branch: `git checkout -b feat/your-feature`
585
+ 2. Write tests first (RED phase)
586
+ 3. Implement feature (GREEN phase)
587
+ 4. Refactor (REFACTOR phase)
588
+ 5. Ensure tests pass: `bundle exec rspec`
589
+ 6. Ensure RuboCop passes: `bundle exec rubocop`
590
+ 7. Commit with conventional commits: `git commit -m "feat: add feature [SPI-XXX]"`
591
+ 8. Create pull request
592
+
593
+ ### Conventions
594
+
595
+ - Follow Ruby community style guide
596
+ - Use 2-space indentation
597
+ - Write YARD documentation for public methods
598
+ - Follow conventional commits format (`feat:`, `fix:`, `docs:`, `test:`, `refactor:`, `chore:`)
599
+ - Reference Linear issues in commits: `[SPI-XXX]`
600
+
601
+ ## Support
602
+
603
+ - **Issues**: [GitHub Issues](https://github.com/spiralhouse/vagrant-orbstack-provider/issues)
604
+ - **Discussions**: [GitHub Discussions](https://github.com/spiralhouse/vagrant-orbstack-provider/discussions)
605
+
606
+ ## License
607
+
608
+ MIT License - see [LICENSE](./LICENSE) file for details.
609
+
610
+ ## Acknowledgments
611
+
612
+ - [Vagrant](https://www.vagrantup.com/) - Development environment management
613
+ - [OrbStack](https://orbstack.dev/) - High-performance macOS virtualization
614
+ - Vagrant provider implementations for architectural guidance
615
+
616
+ ## Changelog
617
+
618
+ See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
619
+
620
+ ---
621
+
622
+ **Made with ❤️ by the Vagrant OrbStack Provider community**