You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/07/29 18:20:27 UTC
(superset) 01/23: feat: Add GitHub Codespaces support with docker-compose-light
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch codespaces
in repository https://gitbox.apache.org/repos/asf/superset.git
commit fd51cc65a2a44636177f9482ee8c99d6ae45a4e2
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Jul 28 15:07:32 2025 -0700
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 <no...@anthropic.com>
---
.devcontainer/README.md | 110 ++++++++++++++++++++++++++++++++++++++++
.devcontainer/devcontainer.json | 94 ++++++++++++++++++++++++++++++++++
.devcontainer/start-superset.sh | 41 +++++++++++++++
3 files changed, 245 insertions(+)
diff --git a/.devcontainer/README.md b/.devcontainer/README.md
new file mode 100644
index 0000000000..79c1efa68a
--- /dev/null
+++ b/.devcontainer/README.md
@@ -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
+```
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000000..36cb7076d8
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,94 @@
+{
+ "name": "Apache Superset Development",
+ "dockerComposeFile": [
+ "../docker-compose-light.yml"
+ ],
+ "service": "superset-node-light",
+ "workspaceFolder": "/app",
+
+ // Use the light config for faster startup and lower resource usage
+ "shutdownAction": "stopCompose",
+
+ // Forward ports for development
+ "forwardPorts": [9001, 8088],
+ "portsAttributes": {
+ "9001": {
+ "label": "Superset Frontend",
+ "onAutoForward": "notify"
+ },
+ "8088": {
+ "label": "Superset Backend API",
+ "onAutoForward": "silent"
+ }
+ },
+
+ // VS Code extensions for Superset development
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-python.python",
+ "ms-python.vscode-pylance",
+ "ms-python.black-formatter",
+ "charliermarsh.ruff",
+ "dbaeumer.vscode-eslint",
+ "esbenp.prettier-vscode",
+ "ms-vscode.vscode-typescript-tslint-plugin",
+ "eamodio.gitlens",
+ "github.copilot",
+ "ms-azuretools.vscode-docker"
+ ],
+ "settings": {
+ "python.defaultInterpreterPath": "/usr/local/bin/python",
+ "python.linting.enabled": true,
+ "python.linting.pylintEnabled": false,
+ "python.formatting.provider": "black",
+ "editor.formatOnSave": true,
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": true
+ },
+ "[python]": {
+ "editor.defaultFormatter": "ms-python.black-formatter"
+ },
+ "[typescript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[typescriptreact]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ }
+ }
+ }
+ },
+
+ // Environment variables for development
+ "remoteEnv": {
+ "FLASK_ENV": "development",
+ "SUPERSET_ENV": "development",
+ "CYPRESS_CACHE_FOLDER": "/tmp/cypress_cache",
+ // Enable hot reloading
+ "FLASK_DEBUG": "1",
+ // For multiple instances, use different project names
+ "COMPOSE_PROJECT_NAME": "${localEnv:CODESPACE_NAME}"
+ },
+
+ // Run commands after container is created
+ "postCreateCommand": "chmod +x /app/.devcontainer/start-superset.sh && echo '๐ Superset Codespace ready! Run: .devcontainer/start-superset.sh to start'",
+
+ // Auto-start Superset on Codespace resume
+ "postStartCommand": "cd /app && .devcontainer/start-superset.sh",
+
+ // Features to add to the dev container
+ "features": {
+ "ghcr.io/devcontainers/features/docker-in-docker:2": {},
+ "ghcr.io/devcontainers/features/github-cli:1": {},
+ "ghcr.io/devcontainers/features/node:1": {
+ "version": "18"
+ }
+ },
+
+ // Memory and CPU (Codespaces will provision accordingly)
+ "hostRequirements": {
+ "cpus": 4,
+ "memory": "8gb",
+ "storage": "32gb"
+ }
+}
diff --git a/.devcontainer/start-superset.sh b/.devcontainer/start-superset.sh
new file mode 100755
index 0000000000..3fe5735313
--- /dev/null
+++ b/.devcontainer/start-superset.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# Startup script for Superset in Codespaces
+
+set -e
+
+echo "๐ Starting Superset in Codespaces..."
+echo "๐ฆ Using project name: ${CODESPACE_NAME}"
+echo "๐ Frontend will be available at port 9001"
+
+# Ensure we're in the right directory
+cd /workspaces/superset-2 || cd /app
+
+# Check if docker is running
+if ! docker info > /dev/null 2>&1; then
+ echo "โณ Waiting for Docker to start..."
+ sleep 5
+fi
+
+# Clean up any existing containers from this project
+echo "๐งน Cleaning up existing containers..."
+docker-compose -p "${CODESPACE_NAME}" -f docker-compose-light.yml down
+
+# Start services
+echo "๐๏ธ Building and starting services..."
+docker-compose -p "${CODESPACE_NAME}" -f docker-compose-light.yml up -d
+
+# Wait for services to be healthy
+echo "โณ Waiting for services to be ready..."
+sleep 10
+
+# Show status
+echo "โ
Services started! Status:"
+docker-compose -p "${CODESPACE_NAME}" -f docker-compose-light.yml ps
+
+echo ""
+echo "๐ Default credentials:"
+echo " Username: admin"
+echo " Password: admin"
+echo ""
+echo "๐ Access Superset at the forwarded port 9001"
+echo "๐ก To view logs: docker-compose -p ${CODESPACE_NAME} -f docker-compose-light.yml logs -f"