Skip to content

poucet/supervisor

Repository files navigation

Supervisor

Test Supervisor Platform Support Shell

A unified process supervisor script for managing applications across macOS and Linux platforms.

Features

  • Cross-platform compatibility: Works seamlessly on macOS and Linux
  • Process management: Start, stop, restart, and monitor applications
  • Port conflict resolution: Automatically handles port conflicts
  • Code change watching: Optional automatic restart on file changes
  • Logging: Comprehensive logging with timestamps
  • Signal handling: Graceful shutdown and restart via signals
  • Multiple instance prevention: Ensures only one supervisor per application

Quick Start

  1. Copy .supervisor.example to .supervisor in your project directory
  2. Configure your application settings:
    APP_NAME="MyApp"
    COMMAND="python -m myapp"
    PORT=8000
  3. Start your application:
    ./supervisor.sh start

Commands

./supervisor.sh start                    # Start the supervisor and application
./supervisor.sh stop                     # Stop both supervisor and application
./supervisor.sh restart                  # Restart the application via signal
./supervisor.sh status                   # Check status of supervisor and app
./supervisor.sh logs                     # Tail the supervisor logs
./supervisor.sh reboot                   # Stop all supervisor instances

Configuration

The supervisor uses a .supervisor configuration file. See .supervisor.example for all available options.

Required Settings

  • APP_NAME: Name of your application
  • COMMAND: Command to start your application

Optional Settings

  • PORT: Port to monitor (default: 4998)
  • WATCH_CODE_CHANGES: Enable/disable file watching (default: true)
  • WATCH_PATTERN: File pattern to watch (default: *.py)
  • RESTART_EXIT_CODE: Exit code that triggers restart (default: 42)

Testing

Run the comprehensive test suite to verify cross-platform functionality:

# Run all tests
make test

# Run tests with verbose output
make test-verbose

# Clean up test artifacts
make clean

The test suite covers:

  • Platform compatibility (macOS/Linux)
  • Basic functionality (start/stop/restart)
  • Port conflict handling
  • Configuration loading
  • Log management
  • Code change detection

CI/CD

This project uses GitHub Actions for continuous integration:

  • Multi-platform testing: Tests run on both Ubuntu and macOS
  • Shell linting: Static analysis with shellcheck
  • Security scanning: Automated security checks
  • Artifact collection: Test logs preserved on failure

See TESTING.md for detailed testing information.

Platform Support

Platform Status Notes
macOS ✅ Full support BSD-style commands
Linux ✅ Full support GNU-style commands
Windows ❌ Not supported Use WSL

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass: make test
  5. Submit a pull request

License

This project is part of the Simply project suite.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors