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

Uploaded Python 3

File details

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

File metadata

  • Download URL: superset_showtime-0.2.7.tar.gz
  • Upload date:
  • Size: 42.5 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.7.tar.gz
Algorithm Hash digest
SHA256 11789d5480bf56908fd422b198e4007f934ef7f17b38c3f94332abf739f8bc9e
MD5 2d798c0e4964f98e02042866457fe92a
BLAKE2b-256 47d6923208834d8ee125ea27071735af751ed855f00bfa89b5ce3283c2d70ea9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for superset_showtime-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 68f2d4c6f3602626a59847087df5027481604d06d80425185b0901c90b7295eb
MD5 58d3508f32884629df9e5dc5e1f64348
BLAKE2b-256 58fecf73489b012a4c90ec53f6683d5d68e11383afab9e580e25b1e460ac0091

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