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

๐Ÿ“Š For Maintainers (CLI Operations)

Note: CLI is mainly for debugging or developing Showtime itself. Primary interface is GitHub labels above.

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 start 1234 --dry-run-aws      # Test without AWS costs
showtime test-lifecycle 1234           # Full workflow simulation

Dependency: This CLI coordinates with Superset's existing GitHub Actions build infrastructure. It orchestrates environments but relies on Superset's build workflows for container creation.

๐ŸŽช 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

Showtime is designed to be called by Superset's GitHub Actions workflows:

# .github/workflows/showtime.yml - Integrates with Superset's existing build workflows
on:
  pull_request_target:
    types: [labeled, unlabeled, synchronize]

jobs:
  showtime-handler:
    if: contains(github.event.label.name, '๐ŸŽช')
    steps:
      - name: Install Showtime from PyPI
        run: pip install superset-showtime

      - name: Process circus triggers
        run: python -m showtime handle-trigger ${{ github.event.pull_request.number }}

Integration approach:

  • Coordinates with Superset builds - Uses existing container build workflows
  • Runs trusted code (from PyPI, not PR code)
  • Simple orchestration logic (install CLI and run commands)
  • Leverages existing infrastructure - Same AWS resources and permissions

๐Ÿ› ๏ธ Installation & Setup

For Contributors (GitHub Labels Only)

No installation needed! Just use GitHub labels to trigger environments.

For Maintainers (Manual CLI Operations)

Install CLI for debugging/testing:

pip install superset-showtime
export GITHUB_TOKEN=your_personal_access_token

Manual operations:

showtime list                    # Monitor all active environments
showtime status 1234            # Debug specific environment
showtime labels                 # Reference complete label system

For Repository Integration (GitHub Actions)

1. Install GitHub workflows: Copy workflows-reference/showtime-trigger.yml and workflows-reference/showtime-cleanup.yml to Superset's .github/workflows/.

2. Configure secrets (already exist in Superset):

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • GITHUB_TOKEN

3. Dependencies: Showtime coordinates with Superset's existing build infrastructure - no additional setup needed.

๐Ÿ“Š CLI Reference (For Development/Debugging)

Primary Interface: Use GitHub labels in PR interface. CLI is mainly for maintainers debugging or developing Showtime itself.

Debugging Commands

showtime list                         # Monitor all environments
showtime status 1234                  # Debug specific environment
showtime labels                       # Complete label reference
showtime test-lifecycle 1234          # Full workflow simulation

Manual Operations (Advanced)

showtime start 1234                    # Manually create environment
showtime start 1234 --sha abc123f     # Create environment (specific SHA)
showtime stop 1234                    # Manually delete environment
showtime sync 1234                    # Force sync to desired state
showtime cleanup --respect-ttl        # Manual cleanup

GitHub Actions Commands

showtime handle-trigger 1234          # Process trigger labels (called by GHA)
showtime cleanup --older-than 48h     # Scheduled cleanup (called by GHA)

๐ŸŽช Benefits for Superset

For Contributors

  • ๐ŸŽฏ Simple workflow - Just add/remove GitHub labels
  • ๐Ÿ‘€ Visual feedback - See environment status in PR labels
  • โšก Automatic updates - New commits update environments automatically
  • ๐Ÿ”ง Configuration testing - Test config changes through code commits

For Maintainers

  • ๐Ÿ“Š Complete visibility - showtime list shows all environments
  • ๐Ÿงน Easy cleanup - Automatic expired environment cleanup
  • ๐Ÿ” Better debugging - Clear state in labels, comprehensive CLI
  • ๐Ÿ’ฐ Cost savings - No duplicate environments, proper cleanup

For Operations

  • ๐Ÿ“ Simpler workflows - Replace complex GHA scripts with simple CLI calls
  • ๐Ÿ”’ Same security model - No new permissions needed
  • ๐ŸŽฏ Deterministic - Predictable AWS resource naming
  • ๐Ÿšจ Monitoring ready - 48h maximum lifetime, scheduled cleanup

๐Ÿ—๏ธ Architecture

State Management

All state lives in GitHub labels - no external databases needed:

  • Trigger labels (๐ŸŽช trigger-*) - Commands that get processed and removed
  • State labels (๐ŸŽช ๐Ÿšฆ *) - Current environment status, managed by CLI

AWS Resources

Deterministic naming enables reliable cleanup:

  • ECS Service: pr-{pr_number}-{sha} (e.g., pr-1234-abc123f)
  • ECR Image: pr-{pr_number}-{sha}-ci (e.g., pr-1234-abc123f-ci)

Rolling Updates

Zero-downtime updates by running multiple environments:

  1. Keep old environment serving traffic
  2. Build new environment in parallel
  3. Switch traffic when new environment is healthy
  4. Clean up old environment

๐Ÿค Contributing

Testing Your Changes

Test with real PRs safely:

# Test label management without AWS costs:
showtime start YOUR_PR_NUMBER --dry-run-aws --aws-sleep 10

# Test full lifecycle:
showtime test-lifecycle YOUR_PR_NUMBER --real-github

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.2.2.tar.gz (40.6 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.2.2-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: superset_showtime-0.2.2.tar.gz
  • Upload date:
  • Size: 40.6 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.2.2.tar.gz
Algorithm Hash digest
SHA256 ad900a5ab1d1894413ae29a8117a0c5586ef8a089142ba06448ad525201b02df
MD5 485f2453f94a319c5bc433939adc5a11
BLAKE2b-256 c7e20a7b6e9e1ceb234b67becd1325342557c9265c11b098206dfaad051ed3fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for superset_showtime-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b1433a5da23c799f3b21e72cbe5f3c811884ea074ef1c02ab596a9c62d2da59
MD5 460deca4beaf74cd4e1af15ded052c77
BLAKE2b-256 fec72de9a1325717fb362f768143463b916da530c6d42f0fe8711c34909469fa

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