kamal-dev 0.3.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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +508 -0
- data/LICENSE.txt +21 -0
- data/README.md +899 -0
- data/Rakefile +10 -0
- data/exe/kamal-dev +10 -0
- data/exe/plugin-kamal-dev +283 -0
- data/lib/kamal/cli/dev.rb +1192 -0
- data/lib/kamal/dev/builder.rb +332 -0
- data/lib/kamal/dev/compose_parser.rb +255 -0
- data/lib/kamal/dev/config.rb +359 -0
- data/lib/kamal/dev/devcontainer.rb +122 -0
- data/lib/kamal/dev/devcontainer_parser.rb +204 -0
- data/lib/kamal/dev/registry.rb +149 -0
- data/lib/kamal/dev/secrets_loader.rb +93 -0
- data/lib/kamal/dev/state_manager.rb +271 -0
- data/lib/kamal/dev/templates/dev-entrypoint.sh +44 -0
- data/lib/kamal/dev/templates/dev.yml +93 -0
- data/lib/kamal/dev/version.rb +7 -0
- data/lib/kamal/dev.rb +33 -0
- data/lib/kamal/providers/base.rb +121 -0
- data/lib/kamal/providers/upcloud.rb +299 -0
- data/lib/kamal-dev.rb +5 -0
- data/sig/kamal/dev.rbs +6 -0
- data/test_installer.sh +73 -0
- metadata +141 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5597c6611bf25dfc988b1fffb6b1d5aa193515beabbd87520db49dc2de88a5f6
|
|
4
|
+
data.tar.gz: 69483a477c6ce7c25f63a0a22908fc1ffa5a450e189d2357d3440daf3e052b78
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dd44674d6fa0b1ae062896ad8dc4237512dfe79b0bf10544f02c1dba797204dcb46ec34956c0c1da7cb2d1a19219b198dfc074031f97d6abc1c21bddf0ca84d0
|
|
7
|
+
data.tar.gz: 76ca8c08eaca219390f902c288b60c5e393c1ac5644c31895eff5eab5391a292b135ae30c5afd99ce8b8fdf68e1db1bc4963596012b114970d31dee3944c7d36
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.3.0] - 2025-11-22
|
|
4
|
+
|
|
5
|
+
### Added - DevPod-Style Remote Development with Git Clone
|
|
6
|
+
|
|
7
|
+
#### Remote Code Sync Feature
|
|
8
|
+
- **Git Clone Integration** for DevPod-style remote development
|
|
9
|
+
- Code is cloned from git repository into containers (instead of mounted from local machine)
|
|
10
|
+
- Supports private repositories via GitHub Personal Access Token (PAT)
|
|
11
|
+
- Automatic credential caching for git operations (pull/push)
|
|
12
|
+
- Works seamlessly alongside local VS Code devcontainer workflow (auto-detects deployment vs local)
|
|
13
|
+
- Pure cloud deployment capability - no local file mounting required
|
|
14
|
+
|
|
15
|
+
- **Configuration Options** (`config/dev.yml`)
|
|
16
|
+
```yaml
|
|
17
|
+
git:
|
|
18
|
+
repository: https://github.com/user/repo.git # Git repository URL (HTTPS format)
|
|
19
|
+
branch: main # Branch to checkout (default: main)
|
|
20
|
+
workspace_folder: /workspaces/myapp # Where to clone code
|
|
21
|
+
token: GITHUB_TOKEN # Environment variable name for PAT
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- **Entrypoint Script Injection** (`dev-entrypoint.sh`)
|
|
25
|
+
- Automatically injected into Docker images during build when git clone is configured
|
|
26
|
+
- Clones repository on first container startup
|
|
27
|
+
- Handles authentication via token injection into HTTPS URL
|
|
28
|
+
- Configures git credential helper for persistent authentication
|
|
29
|
+
- Skips clone operation for local VS Code devcontainers (uses mounted code)
|
|
30
|
+
- Creates `/workspaces` directory with proper ownership for non-root users
|
|
31
|
+
|
|
32
|
+
- **Token-Based Authentication**
|
|
33
|
+
- HTTPS git cloning with GitHub Personal Access Token
|
|
34
|
+
- Simpler and more robust than SSH key-based authentication
|
|
35
|
+
- Single-line environment variable (no multi-line key handling issues)
|
|
36
|
+
- Token loaded from `.kamal/secrets` via environment variable
|
|
37
|
+
- Automatic validation before deployment with helpful error messages
|
|
38
|
+
|
|
39
|
+
- **Deployment Validation**
|
|
40
|
+
- Pre-deployment git configuration validation
|
|
41
|
+
- Errors if token ENV var configured but not set (prevents silent failures)
|
|
42
|
+
- Warns when using public repository without token
|
|
43
|
+
- Provides actionable error messages with setup instructions
|
|
44
|
+
- Skips validation for SSH URLs (git@github.com:...)
|
|
45
|
+
|
|
46
|
+
- **Compose File Transformation**
|
|
47
|
+
- Automatic injection of git environment variables into compose services
|
|
48
|
+
- Environment variables set for remote deployments:
|
|
49
|
+
- `KAMAL_DEV_GIT_REPO` - Repository URL
|
|
50
|
+
- `KAMAL_DEV_GIT_BRANCH` - Branch name
|
|
51
|
+
- `KAMAL_DEV_WORKSPACE_FOLDER` - Workspace path
|
|
52
|
+
- `KAMAL_DEV_GIT_TOKEN` - Authentication token (if configured)
|
|
53
|
+
- Preserves existing environment variables
|
|
54
|
+
- Only injects variables when git clone is enabled
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- **Image Build Process**
|
|
58
|
+
- Wrapper Dockerfile generation when git clone is enabled
|
|
59
|
+
- Entrypoint script copied with execute permissions (755)
|
|
60
|
+
- `/workspaces` directory created with proper ownership (vscode:vscode)
|
|
61
|
+
- Original Dockerfile extended with git clone functionality
|
|
62
|
+
- Build artifacts automatically cleaned up after build
|
|
63
|
+
|
|
64
|
+
- **ComposeParser** (`lib/kamal/dev/compose_parser.rb`)
|
|
65
|
+
- Enhanced `transform_for_deployment` to accept optional config parameter
|
|
66
|
+
- Git environment variables injected when config provided
|
|
67
|
+
- Context paths now resolved relative to compose file location (fixes relative path issues)
|
|
68
|
+
|
|
69
|
+
### Documentation
|
|
70
|
+
- **README.md** - Comprehensive "Remote Code Sync (DevPod-Style)" section:
|
|
71
|
+
- How it works (build → startup → clone workflow)
|
|
72
|
+
- Step-by-step GitHub PAT setup instructions
|
|
73
|
+
- Configuration examples
|
|
74
|
+
- Verification commands
|
|
75
|
+
- Troubleshooting guide with common issues
|
|
76
|
+
- Important notes about HTTPS URLs, token security, and local development
|
|
77
|
+
|
|
78
|
+
### Testing
|
|
79
|
+
- **30 New Tests** (336 total examples, 0 failures)
|
|
80
|
+
- **ComposeParser Tests** (5 tests): Git environment variable injection
|
|
81
|
+
- Validates injection when git clone enabled
|
|
82
|
+
- Verifies environment variable preservation
|
|
83
|
+
- Tests no injection when disabled
|
|
84
|
+
- Handles missing token gracefully
|
|
85
|
+
- Creates environment section when missing
|
|
86
|
+
- **Config Tests** (16 tests): Git configuration methods
|
|
87
|
+
- `git_repository`, `git_branch`, `git_workspace_folder`
|
|
88
|
+
- `git_token_env`, `git_token` (with ENV loading)
|
|
89
|
+
- `git_clone_enabled?` validation logic
|
|
90
|
+
- Default values and edge cases
|
|
91
|
+
- **CLI Validation Tests** (9 tests): Token validation before deployment
|
|
92
|
+
- Successful validation with token
|
|
93
|
+
- Error on missing ENV var
|
|
94
|
+
- Warning for public repos
|
|
95
|
+
- SSH URL handling
|
|
96
|
+
- Edge cases (nil, empty string)
|
|
97
|
+
|
|
98
|
+
### Technical Details
|
|
99
|
+
- **Authentication Method**: GitHub Personal Access Token (PAT) via HTTPS
|
|
100
|
+
- Replaces earlier SSH key approach (simpler, more robust)
|
|
101
|
+
- No multi-line environment variable handling issues
|
|
102
|
+
- Works consistently across all shells and environments
|
|
103
|
+
- **Token Scopes Required**: `repo` scope for private repositories
|
|
104
|
+
- **Supported Git Hosts**: Any HTTPS-based git hosting (GitHub, GitLab, Bitbucket, etc.)
|
|
105
|
+
- **Supported URL Formats**: HTTPS only (`https://github.com/user/repo.git`)
|
|
106
|
+
- **Local Development**: Git clone automatically skipped when environment variables not present
|
|
107
|
+
|
|
108
|
+
### Examples
|
|
109
|
+
|
|
110
|
+
#### Private Repository Configuration
|
|
111
|
+
```yaml
|
|
112
|
+
# config/dev.yml
|
|
113
|
+
git:
|
|
114
|
+
repository: https://github.com/myorg/private-repo.git
|
|
115
|
+
branch: main
|
|
116
|
+
workspace_folder: /workspaces/myapp
|
|
117
|
+
token: GITHUB_TOKEN
|
|
118
|
+
|
|
119
|
+
# .kamal/secrets
|
|
120
|
+
export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxx"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Deploy and Verify
|
|
124
|
+
```bash
|
|
125
|
+
kamal dev deploy --count 2
|
|
126
|
+
|
|
127
|
+
# Verify git clone succeeded
|
|
128
|
+
ssh root@<vm-ip>
|
|
129
|
+
docker logs myapp-dev-1-app
|
|
130
|
+
|
|
131
|
+
# Output:
|
|
132
|
+
# [kamal-dev] Remote deployment detected
|
|
133
|
+
# [kamal-dev] Cloning https://github.com/myorg/private-repo.git (branch: main)
|
|
134
|
+
# [kamal-dev] Clone complete: /workspaces/myapp
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Migration Notes
|
|
138
|
+
- Existing deployments without git configuration continue to work unchanged
|
|
139
|
+
- Git clone is opt-in via `git:` section in `config/dev.yml`
|
|
140
|
+
- No breaking changes to existing functionality
|
|
141
|
+
|
|
142
|
+
## [0.2.0] - 2025-11-18
|
|
143
|
+
|
|
144
|
+
### Added - Epic 2: Docker Compose & Build Support
|
|
145
|
+
|
|
146
|
+
#### Story 2.1: Registry Configuration & Image Builder Integration
|
|
147
|
+
- **Registry Integration** (`Kamal::Dev::Registry`)
|
|
148
|
+
- Container registry configuration (GHCR, Docker Hub, custom registries)
|
|
149
|
+
- Credential loading from environment variables via `.kamal/secrets`
|
|
150
|
+
- Docker login command generation
|
|
151
|
+
- Image naming conventions: `{server}/{username}/{service}-dev:{tag}`
|
|
152
|
+
- Tag generation strategies:
|
|
153
|
+
- Timestamp tags (Unix timestamp)
|
|
154
|
+
- Git SHA tags (7-character short hash)
|
|
155
|
+
- Credential validation and error handling
|
|
156
|
+
- Multi-registry support (ghcr.io, docker.io, custom)
|
|
157
|
+
|
|
158
|
+
- **Image Builder** (`Kamal::Dev::Builder`)
|
|
159
|
+
- Docker image building from Dockerfiles
|
|
160
|
+
- Build progress display and streaming output
|
|
161
|
+
- Build arguments support
|
|
162
|
+
- Tag management (timestamp, git SHA, custom)
|
|
163
|
+
- Image pushing to container registries
|
|
164
|
+
- Registry authentication (docker login)
|
|
165
|
+
- Docker availability checks
|
|
166
|
+
- Image existence verification
|
|
167
|
+
- Comprehensive error handling:
|
|
168
|
+
- Build failures with detailed output
|
|
169
|
+
- Push failures (authentication, network)
|
|
170
|
+
- Docker daemon availability
|
|
171
|
+
|
|
172
|
+
- **CLI Commands**
|
|
173
|
+
- `kamal dev build` - Build image from Dockerfile
|
|
174
|
+
- Auto-generates timestamp tag if not provided
|
|
175
|
+
- Supports custom Dockerfile paths
|
|
176
|
+
- Build arguments via `--build-arg`
|
|
177
|
+
- Display build progress in real-time
|
|
178
|
+
- `kamal dev push` - Push image to registry
|
|
179
|
+
- Automatic registry authentication
|
|
180
|
+
- Push progress display
|
|
181
|
+
- Verification of successful push
|
|
182
|
+
|
|
183
|
+
#### Story 2.2: Compose Parser & Stack Deployment
|
|
184
|
+
- **Docker Compose Parser** (`Kamal::Dev::ComposeParser`)
|
|
185
|
+
- Docker Compose YAML parsing and validation
|
|
186
|
+
- Service extraction and analysis
|
|
187
|
+
- Main service identification (first with `build:` section)
|
|
188
|
+
- Build context and Dockerfile path extraction
|
|
189
|
+
- Dependent service detection (services without `build:`)
|
|
190
|
+
- Compose file transformation for deployment:
|
|
191
|
+
- Replace `build:` sections with `image:` references
|
|
192
|
+
- Preserve dependent services (postgres, redis, etc.)
|
|
193
|
+
- Preserve volumes, networks, environment variables
|
|
194
|
+
- Preserve service dependencies (`depends_on`)
|
|
195
|
+
- Support for shorthand and expanded build syntax
|
|
196
|
+
- Comprehensive error handling and validation
|
|
197
|
+
|
|
198
|
+
- **Devcontainer Compose Integration**
|
|
199
|
+
- `dockerComposeFile` property support in devcontainer.json
|
|
200
|
+
- Automatic compose file detection and loading
|
|
201
|
+
- Seamless integration with existing devcontainer workflow
|
|
202
|
+
|
|
203
|
+
- **Multi-Service Stack Deployment**
|
|
204
|
+
- Full compose stack deployment to each VM
|
|
205
|
+
- Isolated stacks per workspace (each gets own database/cache)
|
|
206
|
+
- Docker Compose v2 installation on VMs during bootstrap
|
|
207
|
+
- Transformed compose.yaml deployment via `docker-compose up -d`
|
|
208
|
+
- Container tracking for all services in stack
|
|
209
|
+
- Support for complex stacks (app + database + cache + worker)
|
|
210
|
+
|
|
211
|
+
- **Enhanced CLI Commands**
|
|
212
|
+
- `kamal dev deploy` - Enhanced with compose support
|
|
213
|
+
- `--skip-build` flag - Use existing local image
|
|
214
|
+
- `--skip-push` flag - Use local image, don't push to registry
|
|
215
|
+
- Automatic build → push → deploy workflow
|
|
216
|
+
- Multi-service deployment tracking
|
|
217
|
+
- `kamal dev list` - Shows all containers in compose stacks
|
|
218
|
+
- Displays app containers and dependent services
|
|
219
|
+
- Status for each service in the stack
|
|
220
|
+
|
|
221
|
+
#### Story 2.3: Testing & Documentation
|
|
222
|
+
- **Test Coverage**
|
|
223
|
+
- 252 total test examples (110 new for Epic 2)
|
|
224
|
+
- Registry: 20 comprehensive unit tests
|
|
225
|
+
- Builder: 15 comprehensive unit tests
|
|
226
|
+
- ComposeParser: 47 comprehensive unit tests
|
|
227
|
+
- 100% test pass rate
|
|
228
|
+
- Code quality: Standard Ruby linter clean (0 violations)
|
|
229
|
+
|
|
230
|
+
- **Documentation**
|
|
231
|
+
- **README.md** - Comprehensive Docker Compose support section:
|
|
232
|
+
- Registry configuration guide
|
|
233
|
+
- Building and pushing images
|
|
234
|
+
- Multi-service deployment examples
|
|
235
|
+
- Compose file requirements and limitations
|
|
236
|
+
- Troubleshooting compose deployments
|
|
237
|
+
- **docs/compose-workflow.md** - Complete workflow guide:
|
|
238
|
+
- Step-by-step deployment process
|
|
239
|
+
- Workflow diagram with visual representation
|
|
240
|
+
- Compose file transformation explained
|
|
241
|
+
- Service detection logic
|
|
242
|
+
- Multi-VM deployment architecture
|
|
243
|
+
- Examples: Rails + Postgres, Node + Mongo + Redis, Python + Celery
|
|
244
|
+
- Best practices and troubleshooting
|
|
245
|
+
- **docs/registry-setup.md** - Registry configuration guide:
|
|
246
|
+
- GitHub Container Registry (GHCR) setup
|
|
247
|
+
- Docker Hub setup
|
|
248
|
+
- Custom/private registry configuration
|
|
249
|
+
- AWS ECR, GCR, ACR integration
|
|
250
|
+
- Authentication testing procedures
|
|
251
|
+
- Security best practices
|
|
252
|
+
- Cost considerations and comparisons
|
|
253
|
+
|
|
254
|
+
### Changed - Epic 2
|
|
255
|
+
- Enhanced `kamal dev deploy` to support full build → push → deploy workflow
|
|
256
|
+
- Updated state tracking to handle multi-service compose stacks
|
|
257
|
+
- Improved error messages for registry and build failures
|
|
258
|
+
|
|
259
|
+
### Technical Details - Epic 2
|
|
260
|
+
- **New Dependencies**: None (uses stdlib YAML and Open3)
|
|
261
|
+
- **Supported Registries**: GHCR, Docker Hub, custom Docker-compatible registries
|
|
262
|
+
- **Supported Compose Features**:
|
|
263
|
+
- Services with `build:` sections
|
|
264
|
+
- Services with `image:` references
|
|
265
|
+
- Build context (string or object format)
|
|
266
|
+
- Dockerfile path specification
|
|
267
|
+
- Environment variables, volumes, ports
|
|
268
|
+
- Service dependencies (`depends_on`)
|
|
269
|
+
- Named volumes
|
|
270
|
+
- **Limitations**: Single architecture builds (amd64), no shared databases across VMs
|
|
271
|
+
|
|
272
|
+
### Examples - Epic 2
|
|
273
|
+
|
|
274
|
+
#### Rails Application with PostgreSQL
|
|
275
|
+
```yaml
|
|
276
|
+
services:
|
|
277
|
+
app:
|
|
278
|
+
build:
|
|
279
|
+
context: ..
|
|
280
|
+
dockerfile: .devcontainer/Dockerfile
|
|
281
|
+
environment:
|
|
282
|
+
DATABASE_URL: postgres://postgres:postgres@postgres:5432/myapp_dev
|
|
283
|
+
ports:
|
|
284
|
+
- "3000:3000"
|
|
285
|
+
postgres:
|
|
286
|
+
image: postgres:16
|
|
287
|
+
volumes:
|
|
288
|
+
- postgres_data:/var/lib/postgresql/data
|
|
289
|
+
volumes:
|
|
290
|
+
postgres_data:
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Deploy: `kamal dev deploy --count 3` creates 3 isolated stacks
|
|
294
|
+
|
|
295
|
+
## [0.1.4] - 2025-11-16
|
|
296
|
+
|
|
297
|
+
### Added
|
|
298
|
+
- **`kamal dev init` command**: Generate `config/dev.yml` template
|
|
299
|
+
- Creates comprehensive configuration template with inline documentation
|
|
300
|
+
- Prompts before overwriting existing configuration
|
|
301
|
+
- Automatically creates `config/` directory if needed
|
|
302
|
+
- Displays helpful next steps after generation
|
|
303
|
+
- Template includes all configuration options with examples and comments
|
|
304
|
+
|
|
305
|
+
### Changed
|
|
306
|
+
- **Quick Start documentation**: Updated to use `kamal dev init` instead of manual config creation
|
|
307
|
+
- **Commands Reference**: Added full documentation for `init` command
|
|
308
|
+
|
|
309
|
+
## [0.1.3] - 2025-11-16
|
|
310
|
+
|
|
311
|
+
### Added
|
|
312
|
+
- **Interactive Installation Mode Selection**: `plugin-kamal-dev` now prompts user to choose installation method
|
|
313
|
+
- Option 1: Patch gem-installed kamal executable (global, works with `kamal dev` and `bundle exec kamal dev`)
|
|
314
|
+
- Option 2: Create project binstub `bin/kamal` (local, use `bin/kamal dev`)
|
|
315
|
+
- Default: Option 1 (gem executable patching)
|
|
316
|
+
- **Automatic Backup**: Creates `.backup` file before patching gem executable
|
|
317
|
+
- **Smart Executable Discovery**: Finds kamal executable via `bundle exec which`, `which`, or gem environment
|
|
318
|
+
|
|
319
|
+
### Changed
|
|
320
|
+
- Installer now defaults to patching gem executable instead of creating binstub
|
|
321
|
+
- Success messages updated based on chosen installation mode
|
|
322
|
+
- Better user guidance on how to use kamal dev after installation
|
|
323
|
+
|
|
324
|
+
## [0.1.2] - 2025-11-16
|
|
325
|
+
|
|
326
|
+
### Added
|
|
327
|
+
- **Automatic Plugin Installer** (`plugin-kamal-dev` executable)
|
|
328
|
+
- One-command setup: `bundle exec plugin-kamal-dev`
|
|
329
|
+
- Automatically generates `bin/kamal` binstub if missing
|
|
330
|
+
- Intelligently patches binstub to load kamal-dev extension
|
|
331
|
+
- Idempotent - safe to run multiple times
|
|
332
|
+
- Three insertion strategies for maximum compatibility
|
|
333
|
+
- Clear success/error messages with usage instructions
|
|
334
|
+
- Comprehensive test suite (`test_installer.sh`)
|
|
335
|
+
- **Reference Implementation**: `bin/kamal-template` binstub example
|
|
336
|
+
|
|
337
|
+
### Changed
|
|
338
|
+
- **Simplified Installation Flow**: Plugin installer is now the primary installation method
|
|
339
|
+
- Primary: `bundle exec plugin-kamal-dev` (one command, fully automated)
|
|
340
|
+
- Alternative options available for users who prefer manual setup
|
|
341
|
+
- Updated Quick Start examples to use `bin/kamal dev` commands
|
|
342
|
+
- Updated Commands Reference with simpler usage patterns
|
|
343
|
+
|
|
344
|
+
### Documentation
|
|
345
|
+
- Restructured README with automatic installer as recommended approach
|
|
346
|
+
- Clear step-by-step installation instructions
|
|
347
|
+
- Alternative setup methods in collapsible section
|
|
348
|
+
- Examples updated to match installer output
|
|
349
|
+
|
|
350
|
+
## [0.1.1] - 2025-11-16
|
|
351
|
+
|
|
352
|
+
### Fixed
|
|
353
|
+
- **Namespace Conflict Resolution**: Refactored `Kamal::Configuration::*` to `Kamal::Dev::*` to avoid conflicts with base Kamal's Configuration class
|
|
354
|
+
- Moved `lib/kamal/configuration/dev_config.rb` → `lib/kamal/dev/config.rb`
|
|
355
|
+
- Renamed `DevConfig` → `Config` for cleaner namespace
|
|
356
|
+
- Updated all requires and class references across codebase
|
|
357
|
+
- Moved spec files to match new structure
|
|
358
|
+
|
|
359
|
+
### Added
|
|
360
|
+
- **CLI Integration Hook**: Integration with Kamal executable via class_eval
|
|
361
|
+
- Added `lib/kamal-dev.rb` stub for bundler auto-require
|
|
362
|
+
- Hook into `Kamal::Cli::Main` to register `dev` subcommand via `class_eval`
|
|
363
|
+
- Extends existing kamal command rather than creating separate executable
|
|
364
|
+
- **Note**: Kamal has no plugin system, so gem must be explicitly required
|
|
365
|
+
- **Automatic Installer** (`plugin-kamal-dev` executable)
|
|
366
|
+
- One-command setup: `bundle exec plugin-kamal-dev`
|
|
367
|
+
- Automatically generates `bin/kamal` binstub if missing
|
|
368
|
+
- Intelligently patches binstub to load kamal-dev extension
|
|
369
|
+
- Idempotent - safe to run multiple times
|
|
370
|
+
- Three insertion strategies for maximum compatibility
|
|
371
|
+
- Clear success/error messages with usage instructions
|
|
372
|
+
- Tested with comprehensive integration test suite
|
|
373
|
+
- **Reference Implementation**: `bin/kamal-template` binstub example
|
|
374
|
+
- **Development Binstub**: Created `exe/kamal-dev` for local development testing
|
|
375
|
+
|
|
376
|
+
### Changed
|
|
377
|
+
- **Simplified Installation Flow**: README now features automatic installer as primary method
|
|
378
|
+
- Primary: `bundle exec plugin-kamal-dev` (one command, fully automated)
|
|
379
|
+
- Alternative options available for users who prefer manual setup
|
|
380
|
+
- Updated Quick Start examples to use `bin/kamal dev` commands
|
|
381
|
+
- Updated Commands Reference with simpler usage patterns
|
|
382
|
+
- All 142 tests passing with new namespace structure
|
|
383
|
+
|
|
384
|
+
### Documentation
|
|
385
|
+
- **Installation Guide**: Restructured with automatic installer as recommended approach
|
|
386
|
+
- Clear step-by-step installation instructions
|
|
387
|
+
- Alternative setup methods in collapsible section
|
|
388
|
+
- Examples updated to match installer output
|
|
389
|
+
- **Installer Testing**: Added `test_installer.sh` for automated testing
|
|
390
|
+
- Tests binstub generation and patching
|
|
391
|
+
- Verifies idempotency
|
|
392
|
+
- Validates file content and permissions
|
|
393
|
+
- Clarified that kamal-dev requires explicit loading due to lack of Kamal plugin system
|
|
394
|
+
- Provided multiple integration paths for different use cases and project setups
|
|
395
|
+
|
|
396
|
+
## [0.1.0] - 2025-11-15
|
|
397
|
+
|
|
398
|
+
### Architecture
|
|
399
|
+
|
|
400
|
+
#### Architectural Decision: Hybrid Kamal Integration (2025-11-16)
|
|
401
|
+
- **Decision**: Use à la carte component reuse instead of full `Kamal::Cli::Base` inheritance
|
|
402
|
+
- **Rationale**: kamal-dev provisions VMs dynamically; Kamal assumes static hosts in `config/deploy.yml`
|
|
403
|
+
- **What we reuse**: `.kamal/secrets` via `Kamal::Utils::Secrets`, SSHKit for SSH execution
|
|
404
|
+
- **What we don't use**: `Kamal::Cli::Base` inheritance, `config/deploy.yml`
|
|
405
|
+
- **Benefits**: Natural fit for dynamic infrastructure, loose coupling, maintainability
|
|
406
|
+
- **See**: `docs/adr/001-hybrid-kamal-integration.md` for full decision record
|
|
407
|
+
|
|
408
|
+
### Added
|
|
409
|
+
|
|
410
|
+
#### Story 1.3: Devcontainer Parser & Deployment
|
|
411
|
+
- **Devcontainer.json Parser** (`Kamal::Configuration::DevcontainerParser`)
|
|
412
|
+
- VS Code devcontainer.json specification parsing
|
|
413
|
+
- JSON comment stripping (single-line `//` and multi-line `/* */`)
|
|
414
|
+
- Property extraction: image, forwardPorts, mounts, containerEnv, runArgs, remoteUser, workspaceFolder
|
|
415
|
+
- Validation for required properties (image or dockerfile)
|
|
416
|
+
- Comprehensive error messages with context
|
|
417
|
+
|
|
418
|
+
- **Devcontainer Configuration** (`Kamal::Configuration::Devcontainer`)
|
|
419
|
+
- Immutable configuration object for parsed devcontainer specs
|
|
420
|
+
- Docker run command generation from devcontainer properties
|
|
421
|
+
- Port mapping conversion (`forwardPorts` → `-p HOST:CONTAINER`)
|
|
422
|
+
- Volume mount conversion (`mounts` → `-v SOURCE:TARGET`)
|
|
423
|
+
- Environment variable injection (`containerEnv` → `-e KEY=VALUE`)
|
|
424
|
+
- Resource limit support via `runArgs` (--cpus, --memory, etc.)
|
|
425
|
+
- Remote user and workspace folder configuration
|
|
426
|
+
|
|
427
|
+
- **State Management** (`Kamal::Dev::StateManager`)
|
|
428
|
+
- File-based YAML state tracking (`.kamal/dev_state.yml`)
|
|
429
|
+
- Thread-safe operations with file locking (File::LOCK_SH for reads, File::LOCK_EX for writes)
|
|
430
|
+
- Atomic writes via temp file + rename pattern
|
|
431
|
+
- Lock timeout (10s) with `LockTimeoutError`
|
|
432
|
+
- Deployment CRUD operations: add, update status, remove, list
|
|
433
|
+
- Automatic state file deletion when last deployment removed
|
|
434
|
+
|
|
435
|
+
- **CLI Commands**
|
|
436
|
+
- `kamal dev deploy [NAME]` - Deploy devcontainer workspace(s)
|
|
437
|
+
- VM provisioning via cloud provider
|
|
438
|
+
- Devcontainer configuration loading
|
|
439
|
+
- Cost estimation with user confirmation
|
|
440
|
+
- State tracking and container naming
|
|
441
|
+
- Options: `--count`, `--from`, `--skip-cost-check`
|
|
442
|
+
- `kamal dev list` - List deployed devcontainers
|
|
443
|
+
- Table, JSON, and YAML output formats
|
|
444
|
+
- VM IP, status, and deployment timestamp display
|
|
445
|
+
- `kamal dev stop [NAME]` - Stop devcontainer(s)
|
|
446
|
+
- Single container or `--all` flag
|
|
447
|
+
- Status update to "stopped" in state file
|
|
448
|
+
- `kamal dev remove [NAME]` - Remove devcontainer(s) and destroy VMs
|
|
449
|
+
- Single container or `--all` flag
|
|
450
|
+
- Force flag (`--force`) for confirmation bypass
|
|
451
|
+
- State cleanup and VM destruction
|
|
452
|
+
|
|
453
|
+
- **DevConfig Integration**
|
|
454
|
+
- `#devcontainer` accessor for seamless devcontainer loading
|
|
455
|
+
- `#devcontainer_json?` predicate for image type detection
|
|
456
|
+
- Support for both devcontainer.json paths and direct image references
|
|
457
|
+
- Automatic parser instantiation and caching
|
|
458
|
+
|
|
459
|
+
- **Integration Tests**
|
|
460
|
+
- ENV-gated integration test suite (`INTEGRATION_TESTS=1` to enable)
|
|
461
|
+
- Full lifecycle testing: deploy → list → stop → remove
|
|
462
|
+
- VM provisioning verification with config validation
|
|
463
|
+
- State file structure and integrity testing
|
|
464
|
+
- Automatic cleanup hooks for VM destruction
|
|
465
|
+
- Cost safety (~$0.01 per test run with minimal VMs)
|
|
466
|
+
- Comprehensive README with setup, debugging, and CI/CD integration
|
|
467
|
+
|
|
468
|
+
#### Story 1.2: Provider Architecture
|
|
469
|
+
- Provider adapter architecture with pluggable cloud provider support
|
|
470
|
+
- `Kamal::Providers::Base` abstract interface defining provider contract
|
|
471
|
+
- `Kamal::Providers::Upcloud` implementation for UpCloud API v1.3
|
|
472
|
+
- Factory pattern `Kamal::Providers.for(config)` for provider instantiation
|
|
473
|
+
- Custom exception hierarchy: `ProvisioningError`, `TimeoutError`, `QuotaExceededError`, `AuthenticationError`, `RateLimitError`
|
|
474
|
+
- Faraday HTTP client with retry middleware for transient failures
|
|
475
|
+
- VM provisioning with status polling (120s timeout, 5s interval)
|
|
476
|
+
- VM cleanup with storage deletion support
|
|
477
|
+
- Cost estimation with pricing guidance
|
|
478
|
+
|
|
479
|
+
### Changed
|
|
480
|
+
- Updated `Kamal::Configuration::DevConfig` to integrate devcontainer loading
|
|
481
|
+
- Enhanced CLI error handling for missing credentials and SSH keys
|
|
482
|
+
|
|
483
|
+
### Technical Details
|
|
484
|
+
- **Test Coverage**: 129 specs passing (100% success rate)
|
|
485
|
+
- 13 specs for DevcontainerParser
|
|
486
|
+
- 16 specs for Devcontainer configuration
|
|
487
|
+
- 17 specs for StateManager
|
|
488
|
+
- 18 specs for CLI commands
|
|
489
|
+
- 65 specs for configuration and providers
|
|
490
|
+
- 4 integration test scenarios (ENV-gated)
|
|
491
|
+
- **Code Quality**: Standard Ruby linter clean (0 violations)
|
|
492
|
+
- **Documentation**: Comprehensive YARD comments on all public methods
|
|
493
|
+
|
|
494
|
+
### Dependencies
|
|
495
|
+
- Added `faraday ~> 2.0` for HTTP client
|
|
496
|
+
- Added `faraday-retry ~> 2.0` for retry logic with exponential backoff
|
|
497
|
+
- Added `webmock ~> 3.18` (development) for HTTP request stubbing
|
|
498
|
+
- Added `active_support` for Hash#deep_symbolize_keys
|
|
499
|
+
|
|
500
|
+
### Known Limitations
|
|
501
|
+
- Docker bootstrap and SSH container deployment deferred to integration phase
|
|
502
|
+
- VM batching for count > 5 not yet implemented (sequential provisioning only)
|
|
503
|
+
- SSH key path currently hardcoded to `~/.ssh/id_rsa.pub` (TODO: make configurable)
|
|
504
|
+
- Provider support limited to UpCloud (multi-provider factory pattern planned)
|
|
505
|
+
|
|
506
|
+
## [0.1.0] - 2025-11-15
|
|
507
|
+
|
|
508
|
+
- Initial release
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TODO: Write your name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|