Skip to main content

๐ŸŽช Apache Superset ephemeral environment management with circus tent emoji state tracking

Project description

๐ŸŽช Superset Showtime

Modern ephemeral environment management for Apache Superset using circus tent emoji labels

PyPI version Python 3.8+

๐ŸŽฏ What is Showtime?

Superset Showtime is a CLI tool designed primarily for GitHub Actions to manage Apache Superset ephemeral environments. It uses circus tent emoji labels as a visual state management system and depends on Superset's existing build infrastructure.

๐Ÿš€ Quick Start for Superset Contributors

Create an ephemeral environment:

  1. Go to your PR in GitHub
  2. Add label: ๐ŸŽช โšก showtime-trigger-start
  3. Watch the magic happen - labels will update automatically
  4. When you see ๐ŸŽช ๐Ÿšฆ {sha} running, your environment is ready!
  5. Get URL from ๐ŸŽช ๐ŸŒ {sha} {ip} โ†’ http://{ip}:8080
  6. Every new commit automatically deploys a fresh environment (zero-downtime)

To test a specific commit without auto-updates:

  • Add label: ๐ŸŽช ๐ŸงŠ showtime-freeze (prevents auto-sync on new commits)

Clean up when done:

# Add this label:
๐ŸŽช ๐Ÿ›‘ showtime-trigger-stop
# All circus labels disappear, AWS resources cleaned up

๐ŸŽช How It Works

๐ŸŽช GitHub labels become a visual state machine:

# User adds trigger label in GitHub UI:
๐ŸŽช โšก showtime-trigger-start

# System responds with state labels:
๐ŸŽช abc123f ๐Ÿšฆ building      # Environment abc123f is building
๐ŸŽช ๐ŸŽฏ abc123f               # abc123f is the active environment
๐ŸŽช abc123f ๐Ÿ“… 2024-01-15T14-30  # Created timestamp
๐ŸŽช abc123f โŒ› 24h           # Time-to-live policy
๐ŸŽช abc123f ๐Ÿคก maxime        # Requested by maxime (clown emoji!)

# When ready:
๐ŸŽช abc123f ๐Ÿšฆ running       # Environment is now running
๐ŸŽช abc123f ๐ŸŒ 52-1-2-3      # Available at http://52.1.2.3:8080

๐Ÿ”„ Showtime Workflow

flowchart TD
    A[User adds ๐ŸŽช โšก trigger-start] --> B[GitHub Actions: sync]
    B --> C{Current state?}

    C -->|No environment| D[๐Ÿ”’ Claim: Remove trigger + Set building]
    C -->|Running + new SHA| E[๐Ÿ”’ Claim: Remove trigger + Set building]
    C -->|Already building| F[โŒ Exit: Another job active]
    C -->|No triggers| G[โŒ Exit: Nothing to do]

    D --> H[๐Ÿ“‹ State: building]
    E --> H
    H --> I[๐Ÿณ Docker build]
    I -->|Success| J[๐Ÿ“‹ State: built]
    I -->|Fail| K[๐Ÿ“‹ State: failed]

    J --> L[๐Ÿ“‹ State: deploying]
    L --> M[โ˜๏ธ AWS Deploy]
    M -->|Success| N[๐Ÿ“‹ State: running]
    M -->|Fail| O[๐Ÿ“‹ State: failed]

    N --> P[๐ŸŽช Environment ready!]

    Q[User adds ๐ŸŽช ๐Ÿ›‘ trigger-stop] --> R[๐Ÿงน Cleanup AWS + Remove labels]

Install CLI for debugging:

pip install superset-showtime
export GITHUB_TOKEN=your_token

Monitor and debug:

showtime list                    # See all active environments
showtime status 1234            # Debug specific environment
showtime labels                 # Complete label reference

Testing/development:

showtime sync 1234 --dry-run-aws --dry-run-docker  # Test without costs
showtime cleanup --dry-run --older-than 1h         # Test cleanup logic

Architecture: This CLI implements ACID-style atomic transactions with direct Docker integration. It handles complete environment lifecycle from Docker build to AWS deployment with race condition prevention.

๐ŸŽช Complete Label Reference

๐ŸŽฏ Trigger Labels (Add These to Your PR)

Label Action Result
๐ŸŽช โšก showtime-trigger-start Create environment Builds and deploys ephemeral environment with blue-green deployment
๐ŸŽช ๐Ÿ›‘ showtime-trigger-stop Destroy environment Cleans up AWS resources and removes all labels
๐ŸŽช ๐ŸงŠ showtime-freeze Freeze environment Prevents auto-sync on new commits (for testing specific SHAs)

๐Ÿ“Š State Labels (Automatically Managed)

Label Pattern Meaning Example
๐ŸŽช {sha} ๐Ÿšฆ {status} Environment status ๐ŸŽช abc123f ๐Ÿšฆ running
๐ŸŽช ๐ŸŽฏ {sha} Active environment pointer ๐ŸŽช ๐ŸŽฏ abc123f
๐ŸŽช ๐Ÿ—๏ธ {sha} Building environment pointer ๐ŸŽช ๐Ÿ—๏ธ def456a
๐ŸŽช {sha} ๐Ÿ“… {timestamp} Creation time ๐ŸŽช abc123f ๐Ÿ“… 2024-01-15T14-30
๐ŸŽช {sha} ๐ŸŒ {ip:port} Environment URL ๐ŸŽช abc123f ๐ŸŒ 52.1.2.3:8080
๐ŸŽช {sha} โŒ› {ttl} Time-to-live policy ๐ŸŽช abc123f โŒ› 24h
๐ŸŽช {sha} ๐Ÿคก {username} Who requested ๐ŸŽช abc123f ๐Ÿคก maxime

๐Ÿ”ง Testing Configuration Changes

Approach: Modify configuration directly in your PR code, then trigger environment.

Workflow:

  1. Modify superset_config.py with your changes
  2. Push commit โ†’ Creates new SHA (e.g., def456a)
  3. Add ๐ŸŽช โšก showtime-trigger-start โ†’ Deploys with your config
  4. Test environment reflects your exact code changes

This approach creates traceable, reviewable changes that are part of your git history.

๐Ÿ”„ Complete Workflows

Creating Your First Environment

  1. Add trigger label in GitHub UI: ๐ŸŽช โšก showtime-trigger-start
  2. Watch state labels appear:
    ๐ŸŽช abc123f ๐Ÿšฆ building      โ† Environment is building
    ๐ŸŽช ๐ŸŽฏ abc123f               โ† This is the active environment
    ๐ŸŽช abc123f ๐Ÿ“… 2024-01-15T14-30  โ† Started building at this time
    
  3. Wait for completion:
    ๐ŸŽช abc123f ๐Ÿšฆ running       โ† Now ready!
    ๐ŸŽช abc123f ๐ŸŒ 52.1.2.3:8080  โ† Visit http://52.1.2.3:8080
    

Testing Specific Commits

  1. Add freeze label: ๐ŸŽช ๐ŸงŠ showtime-freeze
  2. Result: Environment won't auto-update on new commits
  3. Use case: Test specific SHA while continuing development
  4. Override: Add ๐ŸŽช โšก showtime-trigger-start to force update despite freeze

Rolling Updates (Automatic!)

When you push new commits, Showtime automatically:

  1. Detects new commit via GitHub webhook
  2. Builds new environment alongside old one
  3. Switches traffic when new environment is ready
  4. Cleans up old environment

You'll see:

# During update:
๐ŸŽช abc123f ๐Ÿšฆ running       # Old environment still serving
๐ŸŽช def456a ๐Ÿšฆ building      # New environment building
๐ŸŽช ๐ŸŽฏ abc123f               # Traffic still on old
๐ŸŽช ๐Ÿ—๏ธ def456a               # New one being prepared

# After update:
๐ŸŽช def456a ๐Ÿšฆ running       # New environment live
๐ŸŽช ๐ŸŽฏ def456a               # Traffic switched
๐ŸŽช def456a ๐ŸŒ 52-4-5-6      # New IP address
# All abc123f labels removed automatically

๐Ÿ”’ Security & Permissions

Who Can Use This?

  • โœ… Superset maintainers (with write access) can add trigger labels
  • โŒ External contributors cannot trigger environments (no write access to add labels)
  • ๐Ÿ”’ Secure by design - only trusted users can create expensive AWS resources

GitHub Actions Integration

๐ŸŽฏ Live Workflow: showtime-trigger.yml

How it works:

  • Triggers on PR label changes, commits, and closures
  • Installs superset-showtime from PyPI (trusted code, not PR code)
  • Runs showtime sync to handle trigger processing and deployments
  • Supports manual testing via workflow_dispatch with specific SHA override

Commands used:

showtime sync PR_NUMBER --check-only    # Determine build_needed + target_sha
showtime sync PR_NUMBER --sha SHA       # Execute atomic claim + build + deploy

๐Ÿ› ๏ธ CLI Usage

The CLI is primarily used by GitHub Actions, but available for debugging and advanced users:

pip install superset-showtime
export GITHUB_TOKEN=your_token

# Core commands:
showtime sync PR_NUMBER              # Sync to desired state (main command)
showtime start PR_NUMBER             # Create new environment
showtime stop PR_NUMBER              # Delete environment
showtime status PR_NUMBER            # Show current state
showtime list                        # List all environments
showtime cleanup --older-than 48h    # Clean up expired environments

๐Ÿค Contributing

Testing Your Changes

Test with real PRs safely:

# Test full workflow without costs:
showtime sync YOUR_PR_NUMBER --dry-run-aws --dry-run-docker

# Test cleanup logic:
showtime cleanup --dry-run --older-than 24h

Development Setup

git clone https://github.com/mistercrunch/superset-showtime
cd superset-showtime

# Using uv (recommended):
uv pip install -e ".[dev]"
make pre-commit
make test

# Traditional pip:
pip install -e ".[dev]"
pre-commit install
pytest

๐Ÿ“„ License

Apache License 2.0 - same as Apache Superset.


๐ŸŽช "Ladies and gentlemen, welcome to Superset Showtime - where ephemeral environments are always under the big top!" ๐ŸŽช๐Ÿคกโœจ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superset_showtime-0.5.7.tar.gz (49.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superset_showtime-0.5.7-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file superset_showtime-0.5.7.tar.gz.

File metadata

  • Download URL: superset_showtime-0.5.7.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for superset_showtime-0.5.7.tar.gz
Algorithm Hash digest
SHA256 d0c440a632b19849afa4bb567d4ea4dd5d3b86cd8937ca6dee7bfe07d4979238
MD5 c1e25701ed8fc6690cf5c978b90e325d
BLAKE2b-256 62a13cfc1a875edb9da7169e968eeb3685f72c9e8185d48e64699d8e9c492c88

See more details on using hashes here.

File details

Details for the file superset_showtime-0.5.7-py3-none-any.whl.

File metadata

File hashes

Hashes for superset_showtime-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7a410f08396d16d166fca2146e0eda15dbcbc2c20810abdad2e68dfcb3b425
MD5 0f486030ef54af52f93eb80a5a57546d
BLAKE2b-256 cd4c4707f6246c9ae232132d537f30fa4de39eb588f0b6afd88e7e1ffaaf7171

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page