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 20:10:23 UTC
(superset) branch master updated: feat: Add GitHub Codespaces support with docker-compose-light (#34376)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 14e90a0f52 feat: Add GitHub Codespaces support with docker-compose-light (#34376)
14e90a0f52 is described below
commit 14e90a0f528d3e46997c2dd5327517d397490cda
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Tue Jul 29 13:10:17 2025 -0700
feat: Add GitHub Codespaces support with docker-compose-light (#34376)
Co-authored-by: Claude <no...@anthropic.com>
---
.devcontainer/README.md | 5 +++
.devcontainer/devcontainer.json | 52 ++++++++++++++++++++++++
.devcontainer/setup-dev.sh | 32 +++++++++++++++
.devcontainer/start-superset.sh | 59 ++++++++++++++++++++++++++++
docs/docs/contributing/development.mdx | 72 ++++++++++++++++++++++++++++++++++
5 files changed, 220 insertions(+)
diff --git a/.devcontainer/README.md b/.devcontainer/README.md
new file mode 100644
index 0000000000..6b24183edc
--- /dev/null
+++ b/.devcontainer/README.md
@@ -0,0 +1,5 @@
+# Superset Development with GitHub Codespaces
+
+For complete documentation on using GitHub Codespaces with Apache Superset, please see:
+
+**[Setting up a Development Environment - GitHub Codespaces](https://superset.apache.org/docs/contributing/development#github-codespaces-cloud-development)**
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000000..c73a69e6c4
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,52 @@
+{
+ "name": "Apache Superset Development",
+ // Keep this in sync with the base image in Dockerfile (ARG PY_VER)
+ // Using the same base as Dockerfile, but non-slim for dev tools
+ "image": "python:3.11.13-bookworm",
+
+ "features": {
+ "ghcr.io/devcontainers/features/docker-in-docker:2": {
+ "moby": true,
+ "dockerDashComposeVersion": "v2"
+ },
+ "ghcr.io/devcontainers/features/node:1": {
+ "version": "20"
+ },
+ "ghcr.io/devcontainers/features/git:1": {},
+ "ghcr.io/devcontainers/features/common-utils:2": {
+ "configureZshAsDefaultShell": true
+ },
+ "ghcr.io/devcontainers/features/sshd:1": {
+ "version": "latest"
+ }
+ },
+
+ // Forward ports for development
+ "forwardPorts": [9001],
+ "portsAttributes": {
+ "9001": {
+ "label": "Superset (via Webpack Dev Server)",
+ "onAutoForward": "notify",
+ "visibility": "public"
+ }
+ },
+
+ // Run commands after container is created
+ "postCreateCommand": "chmod +x .devcontainer/setup-dev.sh && .devcontainer/setup-dev.sh",
+
+ // Auto-start Superset on Codespace resume
+ "postStartCommand": ".devcontainer/start-superset.sh",
+
+ // VS Code customizations
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-python.python",
+ "ms-python.vscode-pylance",
+ "charliermarsh.ruff",
+ "dbaeumer.vscode-eslint",
+ "esbenp.prettier-vscode"
+ ]
+ }
+ }
+}
diff --git a/.devcontainer/setup-dev.sh b/.devcontainer/setup-dev.sh
new file mode 100755
index 0000000000..f852118900
--- /dev/null
+++ b/.devcontainer/setup-dev.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Setup script for Superset Codespaces development environment
+
+echo "๐ง Setting up Superset development environment..."
+
+# The universal image has most tools, just need Superset-specific libs
+echo "๐ฆ Installing Superset-specific dependencies..."
+sudo apt-get update
+sudo apt-get install -y \
+ libsasl2-dev \
+ libldap2-dev \
+ libpq-dev \
+ tmux \
+ gh
+
+# Install uv for fast Python package management
+echo "๐ฆ Installing uv..."
+curl -LsSf https://astral.sh/uv/install.sh | sh
+
+# Add cargo/bin to PATH for uv
+echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
+echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
+
+# Install Claude Code CLI via npm
+echo "๐ค Installing Claude Code..."
+npm install -g @anthropic-ai/claude-code
+
+# Make the start script executable
+chmod +x .devcontainer/start-superset.sh
+
+echo "โ
Development environment setup complete!"
+echo "๐ Run '.devcontainer/start-superset.sh' to start Superset"
diff --git a/.devcontainer/start-superset.sh b/.devcontainer/start-superset.sh
new file mode 100755
index 0000000000..db41aceecf
--- /dev/null
+++ b/.devcontainer/start-superset.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# Startup script for Superset in Codespaces
+
+echo "๐ Starting Superset in Codespaces..."
+echo "๐ Frontend will be available at port 9001"
+
+# Find the workspace directory (Codespaces clones as 'superset', not 'superset-2')
+WORKSPACE_DIR=$(find /workspaces -maxdepth 1 -name "superset*" -type d | head -1)
+if [ -n "$WORKSPACE_DIR" ]; then
+ cd "$WORKSPACE_DIR"
+ echo "๐ Working in: $WORKSPACE_DIR"
+else
+ echo "๐ Using current directory: $(pwd)"
+fi
+
+# 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
+echo "๐งน Cleaning up existing containers..."
+docker-compose -f docker-compose-light.yml down
+
+# Start services
+echo "๐๏ธ Building and starting services..."
+echo ""
+echo "๐ Once started, login with:"
+echo " Username: admin"
+echo " Password: admin"
+echo ""
+echo "๐ Running in foreground with live logs (Ctrl+C to stop)..."
+
+# Run docker-compose and capture exit code
+docker-compose -f docker-compose-light.yml up
+EXIT_CODE=$?
+
+# If it failed, provide helpful instructions
+if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 130 ]; then # 130 is Ctrl+C
+ echo ""
+ echo "โ Superset startup failed (exit code: $EXIT_CODE)"
+ echo ""
+ echo "๐ To restart Superset, run:"
+ echo " .devcontainer/start-superset.sh"
+ echo ""
+ echo "๐ง For troubleshooting:"
+ echo " # View logs:"
+ echo " docker-compose -f docker-compose-light.yml logs"
+ echo ""
+ echo " # Clean restart (removes volumes):"
+ echo " docker-compose -f docker-compose-light.yml down -v"
+ echo " .devcontainer/start-superset.sh"
+ echo ""
+ echo " # Common issues:"
+ echo " - Network timeouts: Just retry, often transient"
+ echo " - Port conflicts: Check 'docker ps'"
+ echo " - Database issues: Try clean restart with -v"
+fi
diff --git a/docs/docs/contributing/development.mdx b/docs/docs/contributing/development.mdx
index ff0b6633fb..fe8995d28a 100644
--- a/docs/docs/contributing/development.mdx
+++ b/docs/docs/contributing/development.mdx
@@ -120,6 +120,78 @@ docker volume rm superset_db_home
docker-compose up
```
+## GitHub Codespaces (Cloud Development)
+
+GitHub Codespaces provides a complete, pre-configured development environment in the cloud. This is ideal for:
+- Quick contributions without local setup
+- Consistent development environments across team members
+- Working from devices that can't run Docker locally
+- Safe experimentation in isolated environments
+
+:::info
+We're grateful to GitHub for providing this excellent cloud development service that makes
+contributing to Apache Superset more accessible to developers worldwide.
+:::
+
+### Getting Started with Codespaces
+
+1. **Create a Codespace**: Use this pre-configured link that sets up everything you need:
+
+ [**Launch Superset Codespace โ**](https://github.com/codespaces/new?skip_quickstart=true&machine=standardLinux32gb&repo=39464018&ref=codespaces&geo=UsWest&devcontainer_path=.devcontainer%2Fdevcontainer.json)
+
+ :::caution
+ **Important**: You must select at least the **4 CPU / 16GB RAM** machine type (pre-selected in the link above).
+ Smaller instances will not have sufficient resources to run Superset effectively.
+ :::
+
+2. **Wait for Setup**: The initial setup takes several minutes. The Codespace will:
+ - Build the development container
+ - Install all dependencies
+ - Start all required services (PostgreSQL, Redis, etc.)
+ - Initialize the database with example data
+
+3. **Access Superset**: Once ready, check the **PORTS** tab in VS Code for port `9001`.
+ Click the globe icon to open Superset in your browser.
+ - Default credentials: `admin` / `admin`
+
+### Key Features
+
+- **Auto-reload**: Both Python and TypeScript files auto-refresh on save
+- **Pre-installed Extensions**: VS Code extensions for Python, TypeScript, and database tools
+- **Multiple Instances**: Run multiple Codespaces for different branches/features
+- **SSH Access**: Connect via terminal using `gh cs ssh` or through the GitHub web UI
+- **VS Code Integration**: Works seamlessly with VS Code desktop app
+
+### Managing Codespaces
+
+- **List active Codespaces**: `gh cs list`
+- **SSH into a Codespace**: `gh cs ssh`
+- **Stop a Codespace**: Via GitHub UI or `gh cs stop`
+- **Delete a Codespace**: Via GitHub UI or `gh cs delete`
+
+### Debugging and Logs
+
+Since Codespaces uses `docker-compose-light.yml`, you can monitor all services:
+
+```bash
+# Stream logs from all services
+docker compose -f docker-compose-light.yml logs -f
+
+# Stream logs from a specific service
+docker compose -f docker-compose-light.yml logs -f superset
+
+# View last 100 lines and follow
+docker compose -f docker-compose-light.yml logs --tail=100 -f
+
+# List all running services
+docker compose -f docker-compose-light.yml ps
+```
+
+:::tip
+Codespaces automatically stop after 30 minutes of inactivity to save resources.
+Your work is preserved and you can restart anytime.
+:::
+
## Installing Development Tools
:::note