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/28 22:36:53 UTC

(superset) branch codespaces updated: fix: Refactor devcontainer to use base Ubuntu with Docker-in-Docker

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


The following commit(s) were added to refs/heads/codespaces by this push:
     new 1922866536 fix: Refactor devcontainer to use base Ubuntu with Docker-in-Docker
1922866536 is described below

commit 1922866536da47ba5bd58503b8e904c9e4f5146e
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Jul 28 15:36:39 2025 -0700

    fix: Refactor devcontainer to use base Ubuntu with Docker-in-Docker
    
    - Switch from docker-compose service to base Ubuntu container
    - Add Docker-in-Docker to run docker-compose inside Codespace
    - This provides git access and full dev environment
    - Superset services run via docker-compose from within the container
---
 .devcontainer/README.md         |  2 +-
 .devcontainer/devcontainer.json | 24 +++++++++++-------------
 .devcontainer/setup-dev.sh      | 25 +++++++++++++++++++++++++
 .devcontainer/start-superset.sh | 11 ++++++-----
 4 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/.devcontainer/README.md b/.devcontainer/README.md
index 79c1efa68a..93deb0bc2d 100644
--- a/.devcontainer/README.md
+++ b/.devcontainer/README.md
@@ -1,6 +1,6 @@
 # Superset GitHub Codespaces Development
 
-This configuration uses `docker-compose-light.yml` for lightweight, multi-instance development in GitHub Codespaces.
+This configuration provides a full development environment with Docker-in-Docker support, allowing you to run `docker-compose-light.yml` inside your Codespace for lightweight, multi-instance development.
 
 ## Quick Start
 
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 6b15d5ab57..d94b3e9390 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,14 +1,8 @@
 {
   "name": "Apache Superset Development",
-  "dockerComposeFile": [
-    "../docker-compose-light.yml"
-  ],
-  "service": "superset-node-light",
+  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
   "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
 
-  // Use the light config for faster startup and lower resource usage
-  "shutdownAction": "stopCompose",
-
   // Forward ports for development
   "forwardPorts": [9001, 8088],
   "portsAttributes": {
@@ -64,22 +58,26 @@
     "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}"
+    "FLASK_DEBUG": "1"
   },
 
   // Run commands after container is created
-  "postCreateCommand": "chmod +x .devcontainer/start-superset.sh && echo '๐Ÿš€ Superset Codespace ready! Run: .devcontainer/start-superset.sh to start'",
+  "postCreateCommand": "chmod +x .devcontainer/setup-dev.sh && .devcontainer/setup-dev.sh",
 
   // Auto-start Superset on Codespace resume
   "postStartCommand": ".devcontainer/start-superset.sh",
 
   // Features to add to the dev container
   "features": {
-    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
+    "ghcr.io/devcontainers/features/docker-in-docker:2": {
+      "moby": true,
+      "installDockerBuildx": true,
+      "dockerDashComposeVersion": "v2"
+    },
     "ghcr.io/devcontainers/features/github-cli:1": {},
+    "ghcr.io/devcontainers/features/python:1": {
+      "version": "3.10"
+    },
     "ghcr.io/devcontainers/features/node:1": {
       "version": "18"
     },
diff --git a/.devcontainer/setup-dev.sh b/.devcontainer/setup-dev.sh
new file mode 100755
index 0000000000..7fab8aefd5
--- /dev/null
+++ b/.devcontainer/setup-dev.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Setup script for Superset Codespaces development environment
+
+set -e
+
+echo "๐Ÿ”ง Setting up Superset development environment..."
+
+# Install additional system dependencies
+echo "๐Ÿ“ฆ Installing system dependencies..."
+sudo apt-get update
+sudo apt-get install -y \
+    build-essential \
+    libssl-dev \
+    libffi-dev \
+    libsasl2-dev \
+    libldap2-dev \
+    libpq-dev \
+    python3-pip \
+    python3-venv
+
+# 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
index 14930ae3bb..d0eddc5d91 100755
--- a/.devcontainer/start-superset.sh
+++ b/.devcontainer/start-superset.sh
@@ -4,7 +4,8 @@
 set -e
 
 echo "๐Ÿš€ Starting Superset in Codespaces..."
-echo "๐Ÿ“ฆ Using project name: ${CODESPACE_NAME}"
+PROJECT_NAME="${CODESPACE_NAME:-superset-dev}"
+echo "๐Ÿ“ฆ Using project name: ${PROJECT_NAME}"
 echo "๐ŸŒ Frontend will be available at port 9001"
 
 # Ensure we're in the right directory
@@ -18,11 +19,11 @@ 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
+docker-compose -p "${PROJECT_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
+docker-compose -p "${PROJECT_NAME}" -f docker-compose-light.yml up -d
 
 # Wait for services to be healthy
 echo "โณ Waiting for services to be ready..."
@@ -30,7 +31,7 @@ sleep 10
 
 # Show status
 echo "โœ… Services started! Status:"
-docker-compose -p "${CODESPACE_NAME}" -f docker-compose-light.yml ps
+docker-compose -p "${PROJECT_NAME}" -f docker-compose-light.yml ps
 
 echo ""
 echo "๐Ÿ“ Default credentials:"
@@ -38,4 +39,4 @@ 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"
+echo "๐Ÿ’ก To view logs: docker-compose -p ${PROJECT_NAME} -f docker-compose-light.yml logs -f"