feat: Add GitHub Codespaces support with docker-compose-light

## Summary

Adds full GitHub Codespaces development environment configuration leveraging the new `docker-compose-light.yml` for efficient cloud development.

## Key Features

- **Lightweight Setup**: Uses `docker-compose-light.yml` which removes Redis/nginx for faster startup and lower resource usage
- **Multi-Instance Support**: Each Codespace gets isolated database volumes, perfect for testing multiple branches
- **Auto-Configuration**: Includes VS Code extensions, Python/TypeScript settings, and auto-start script
- **Developer Friendly**: Comprehensive README with SSH, VS Code, and browser connection instructions

## Implementation Details

### Files Added
- `.devcontainer/devcontainer.json` - Main configuration with:
  - Docker-in-Docker support for compose
  - Optimized VS Code extensions for Superset development
  - Smart port forwarding (9001 for frontend, 8088 for API)
  - 4-core/8GB recommended resources

- `.devcontainer/start-superset.sh` - Auto-start script that:
  - Uses unique project names per Codespace
  - Handles Docker daemon startup
  - Shows clear status and credentials

- `.devcontainer/README.md` - Developer guide covering:
  - Multiple connection methods (SSH, VS Code, browser)
  - Port forwarding instructions
  - Cost optimization tips
  - Integration with `claude --yes` workflows

## Benefits

1. **Isolated Development**: No risk to local machine when using `claude --yes`
2. **Resource Efficiency**: Laptop stays cool, Codespaces handles the load
3. **Parallel Testing**: Spin up multiple instances for different features
4. **Quick Pause/Resume**: Auto-stops when idle, resumes in ~30 seconds

## Testing

Push to fork and create a Codespace to test. The environment auto-starts Superset and forwards port 9001 with HTTPS.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2025-07-28 15:07:32 -07:00
parent 16db999067
commit fd51cc65a2
3 changed files with 245 additions and 0 deletions

110
.devcontainer/README.md Normal file
View File

@@ -0,0 +1,110 @@
# Superset GitHub Codespaces Development
This configuration uses `docker-compose-light.yml` for lightweight, multi-instance development in GitHub Codespaces.
## Quick Start
1. **Create a Codespace** from this repo (click "Code" → "Codespaces" → "Create codespace")
2. **Wait for setup** (~3-5 minutes first time)
3. **Start Superset**:
```bash
docker-compose -p ${CODESPACE_NAME} -f docker-compose-light.yml up
```
4. **Access Superset** at the forwarded port 9001 URL (auto-opens)
## Connecting to Your Codespace
### VS Code Desktop
1. Install [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces)
2. Open Command Palette (`Cmd/Ctrl+Shift+P`)
3. Run "Codespaces: Connect to Codespace"
4. Select your Codespace
### SSH Access
```bash
# Install GitHub CLI if needed
brew install gh # macOS
# or visit: https://cli.github.com/
# Login to GitHub
gh auth login
# List your Codespaces
gh cs list
# SSH into a Codespace
gh cs ssh -c <codespace-name>
# Or use the interactive selector
gh cs ssh
```
### Web Browser
- Go to https://github.com/codespaces
- Click on your Codespace to open in browser
## Running Multiple Instances
Perfect for testing different branches/features simultaneously:
```bash
# Instance 1 (in Codespace 1)
docker-compose -p feature1 -f docker-compose-light.yml up
# Instance 2 (in Codespace 2)
NODE_PORT=9002 docker-compose -p feature2 -f docker-compose-light.yml up
```
## Why docker-compose-light.yml?
- **Faster startup**: No Redis, nginx, or unnecessary services
- **Lower resources**: Important for Codespaces quotas
- **Isolated databases**: Each instance gets its own `superset_light` database
- **Simple access**: Single port (9001) with frontend proxy to backend
## Port Forwarding & URLs
When Superset starts, Codespaces automatically forwards port 9001:
- **Public URL**: `https://<codespace-name>-9001.app.github.dev`
- **Visibility**: Private by default (requires GitHub auth)
- **Make public**: Click port in "Ports" tab → Change visibility
To forward additional ports:
```bash
# From outside the Codespace
gh cs ports forward 5432:5432 -c <codespace-name> # PostgreSQL
gh cs ports forward 8088:8088 -c <codespace-name> # Backend API
```
## Tips for Claude Code Usage
When using `claude --yes` in Codespaces:
- All changes are isolated to your Codespace
- Database/volumes are separate from your local machine
- Can safely run destructive commands
- Easy to delete and recreate if needed
## Credentials
Default login (same as docker setup):
- Username: `admin`
- Password: `admin`
## Resource Usage
The light compose typically uses:
- ~2GB RAM (vs ~4GB for full stack)
- Minimal CPU when idle
- ~2GB disk for database + dependencies
## Troubleshooting
If services fail to start:
```bash
# Check logs
docker-compose -f docker-compose-light.yml logs
# Restart fresh
docker-compose -f docker-compose-light.yml down -v
docker-compose -f docker-compose-light.yml up
```