Skip to content

feat: Add VS Code Dev Container support for streamlined development setup#6

Open
atm-snag2 wants to merge 3 commits into
developfrom
001-devcontainer
Open

feat: Add VS Code Dev Container support for streamlined development setup#6
atm-snag2 wants to merge 3 commits into
developfrom
001-devcontainer

Conversation

@atm-snag2

@atm-snag2 atm-snag2 commented Nov 12, 2025

Copy link
Copy Markdown
Owner

Summary

Implements VS Code Dev Container support to reduce contributor onboarding time from 30+ minutes to under 5 minutes while maintaining 100% test compatibility with MySQL 5.6/5.7.

Changes

Dev Container Infrastructure

  • ✅ Add .devcontainer/devcontainer.json with docker-in-docker feature, Ruby LSP extensions
  • ✅ Add .devcontainer/docker-compose.yml with services: devcontainer, mysql56 (port 14406), mysql57 (port 14407)
  • ✅ Add .devcontainer/README.md quickstart and troubleshooting guide
  • ✅ Implement persistent gem cache via named volume (gratan-gems)
  • ✅ Configure MySQL health checks with retry logic
  • ✅ Add SSH host key persistence script (.devcontainer/scripts/ensure_ssh_config.sh)
    • Automatically configures StrictHostKeyChecking=accept-new for github.com
    • Eliminates repeated known_hosts verification issues
    • Runs on container creation via postCreateCommand

CI/CD

  • ✅ Add GitHub Actions workflow: CI (Ruby 2.4–2.7 matrix with MySQL 5.6/5.7 services)
  • ✅ Add GitHub Actions workflow: Dev Container CI (validates container build and runs tests inside devcontainer)
  • ✅ Remove legacy .travis.yml (superseded by GitHub Actions)

Documentation

  • ✅ Update README.md with Dev Container usage section and separate local development instructions
  • ✅ Add CONTRIBUTING.md with recommended Dev Container path and updated MySQL startup commands
  • ✅ Add comprehensive feature specification in specs/001-devcontainer/ (plan, spec, tasks, quickstart, research, checklists)

Test Infrastructure

  • ✅ Update spec/spec_helper.rb to dynamically select MySQL host/port based on environment variables
    • Supports both container environment (mysql56:3306, mysql57:3306) and local (127.0.0.1:14406/14407)
  • ✅ All 72 examples pass on both MySQL versions

Cleanup

  • ✅ Remove root docker-compose.yml (replaced by scoped .devcontainer/docker-compose.yml)
  • ✅ Remove .travis.yml (replaced by GitHub Actions)

Testing

Local Dev Container:

  • ✓ 72/72 RSpec examples pass (MySQL 5.6: 4.59s)
  • ✓ 72/72 RSpec examples pass (MySQL 5.7: 4.91s)
  • ✓ Gem persistence verified across container rebuilds
  • ✓ Incremental rebuild time: ~1.5 minutes with cached gems

GitHub Actions CI:

  • ✓ All checks passing on latest commits
  • ✓ Ruby matrix (2.4–2.7) tested against MySQL 5.6/5.7
  • ✓ Dev Container build and test execution validated

Success Criteria (All Met)

ID Criteria Status Evidence
SC-001 Dev environment setup <5 min ✅ Met ~3 minutes measured (container pull + build + bundle install)
SC-002 100% test compatibility (MySQL 5.6 & 5.7) ✅ Met 72/72 examples pass on both versions
SC-003 Cross-platform support documented ✅ Met README + CONTRIBUTING.md cover Windows/Mac/Linux
SC-004 Edit workflow without rebuild ✅ Met Source changes hot-reload, no rebuild needed
SC-005 Incremental rebuild <2 min ✅ Met ~1.5 min with cached gems/layers
SC-006 Onboarding <10 min with docs ✅ Met Quickstart guide + CONTRIBUTING.md enable <5 min onboarding

Migration Impact

For new contributors:

  • Clone repo → Open in VS Code → Click "Reopen in Container" → Start coding (3-5 min total)

For existing local developers:

  • Can continue using local setup with updated MySQL commands:
    docker compose -f .devcontainer/docker-compose.yml up -d mysql56 mysql57
    bundle exec rspec

No breaking changes to existing workflows or APIs.

Implementation Details

Feature specification: specs/001-devcontainer/
Commits:

  1. 838e5cc - feat: Add VS Code Dev Container support with speckit integration
  2. 6baec3f - chore: Remove obsolete CI config and update docs for dev container
  3. 50a92cf - chore(devcontainer): Add persistent GitHub SSH host key handling

Diff stats: +5452 -47 across 39 files

Rationale

Reduces onboarding friction and ensures repeatable, isolated test environments aligned with modern contributor workflow expectations. The persistent SSH configuration eliminates a frequent reliability pain point during git operations.

Implements architectural decisions documented in specs/001-devcontainer/research.md following the speckit methodology.


Ready for review. Feedback welcome!

k

## Summary
Implements VS Code Dev Container to reduce contributor onboarding from 30+ min to <5 min
while maintaining 100% MySQL 5.6/5.7 test compatibility.

## Dev Container Infrastructure
- .devcontainer/devcontainer.json with docker-in-docker, Ruby LSP extensions
- .devcontainer/docker-compose.yml (devcontainer, mysql56:14406, mysql57:14407)
- .devcontainer/README.md with quickstart and troubleshooting
- Persistent gem cache via gratan-gems volume
- MySQL health checks with retry logic

## CI/CD
- GitHub Actions CI workflow (Ruby 2.4-2.7 matrix, MySQL 5.6/5.7)
- Dev Container CI workflow (validates build + runs tests in container)

## Documentation
- CONTRIBUTING.md with Dev Container recommended path
- README.md updated with Dev Container section
- specs/001-devcontainer/ comprehensive feature specification

## Test Infrastructure
- spec/spec_helper.rb supports both container (mysql56:3306) and local (127.0.0.1:14406)
- Environment variable based MySQL host/port selection

## Success Criteria (All Met)
- SC-001: Setup time <5 min ✓
- SC-002: 100% test compatibility ✓
- SC-003: Cross-platform support documented ✓
- SC-004: Edit workflow without rebuild ✓
- SC-005: Incremental rebuild <2 min ✓
- SC-006: <10 min onboarding ✓
- Remove .travis.yml (replaced by GitHub Actions)
- Remove root docker-compose.yml (replaced by .devcontainer/docker-compose.yml)
- Update README.md with dev container test instructions
- Update CONTRIBUTING.md to reference new docker-compose location
- Add .devcontainer/scripts/ensure_ssh_config.sh with StrictHostKeyChecking=accept-new
- Update postCreateCommand to run SSH config before bundle install
- Update .devcontainer/README.md with SSH setup documentation
- Update specs/001-devcontainer/quickstart.md with SSH setup in build process
- Eliminates repeated known_hosts verification issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant