Generic Multi-Node Control Plane Toolkit
Project description
BazBeans - Generic Multi-Node Control Plane Toolkit
Orchestrate distributed applications with ease - A reusable toolkit for managing multi-node deployments with automatic health monitoring, load balancer integration, and centralized control.
๐ฏ What is BazBeans?
BazBeans is a generic control plane toolkit that helps you manage distributed applications across multiple servers. Think of it as the "operating system" for your cluster - it handles the hard parts of distributed coordination so you can focus on your application.
BETA : This project is new. Use at your own risk. We're developing the framework and it's early days. We're using it for our own project(s), but would not recommend using in production without testing and a fallback plan. I mean... we are using it, but don't necessarily do as we do. Or try it, you may love it. :-)
macOS : The project includes macOS support, but has not been tested.
๐ Key Capabilities
- ๐ฅ Self-Healing Nodes - Nodes monitor their own health and automatically remove themselves from the load balancer when unhealthy
- ๐๏ธ Centralized Control - Manage your entire cluster from a simple command-line interface
- โก Auto Load Balancing - Automatic Nginx upstream updates via Redis pub/sub
- ๐ Pluggable Architecture - Add custom health checks, commands, and IP resolution strategies
- ๐ Zero Project Coupling - Generic design works with any application stack
- ๐ One-Click CLI Installation - Auto-installs OS-specific CLI when you
pip install bazbeans
๐ค๏ธ Choose Your Path (30 seconds)
๐ฎ I want to manage existing nodes
Goal: Control and monitor a running cluster Start: CLI Setup Guide โ 5-minute setup
๐ค I want to deploy new agents
Goal: Add BazBeans agents to my applications Start: Agent Deployment Guide โ Production-ready setup
โก I want to try it right now
Goal: Quick test on my local machine Start: Quick Start Guide โ 5-minute working demo
๐ I want to understand how it works
Goal: Learn the architecture and concepts Start: Architecture Guide โ Deep dive
๐ Quick Start (5 minutes)
Get a working cluster in under 5 minutes:
# 1. Start Redis
redis-server
# 2. Install BazBeans
pip install bazbeans
# The CLI is automatically installed for your OS!
# You can start using 'bazbeans' commands immediately
# 3. Run a test agent
python -c "
from bazbeans import BazBeansConfig, NodeAgent
config = BazBeansConfig(redis_url='redis://localhost:6379/0', node_id='test-node')
NodeAgent(config).run()
" &
# 4. Manage your cluster
bazbeans list-nodes
bazbeans status test-node
โ ๏ธ Note: For production deployment, see the Agent Deployment Guide
๐๏ธ Architecture Overview
graph TB
subgraph "Control Plane"
CLI[CLI Interface]
Redis[(Redis Server)]
end
subgraph "Data Center 1"
N1[Node Agent 1]
N2[Node Agent 2]
end
subgraph "Data Center 2"
N3[Node Agent 3]
N4[Node Agent 4]
end
subgraph "Load Balancer"
LB[Nginx Updater]
end
CLI --> Redis
N1 --> Redis
N2 --> Redis
N3 --> Redis
N4 --> Redis
Redis --> LB
N1 -.-> |Health Check| N1
N2 -.-> |Health Check| N2
N3 -.-> |Health Check| N3
N4 -.-> |Health Check| N4
Core Components
| Component | Purpose | Key Features |
|---|---|---|
| NodeAgent | Runs on each server | Health monitoring, command handling, self-management |
| ControlCLI | Administrative interface | Cluster management, node control, file deployment |
| NginxUpdater | Load balancer integration | Automatic upstream updates, IP resolution |
| NodePool | Redis state management | Heartbeats, status tracking, command queues |
๐ฏ Use Cases
๐ Web Application Clusters
# Perfect for FastAPI, Django, Flask applications
# Automatic health checks and load balancer updates
# Rolling updates with zero downtime
๐ฆ Microservices Management
# Manage containerized services
# Docker-compose integration included
# Custom health checks per service
๐ Background Job Processing
# Monitor Celery, RQ, or custom job queues
# Auto-freeze unhealthy workers
# Centralized job queue management
๐ข Enterprise Applications
# Multi-datacenter deployments
# Custom command handlers for business logic
# Integration with existing monitoring systems
๐ ๏ธ Configuration Examples
Basic Web Server Setup
from bazbeans import BazBeansConfig, NodeAgent, DockerComposeCommands
config = BazBeansConfig(
redis_url="redis://cluster-redis:6379/0",
node_id="web-server-01",
data_center="us-east-1",
node_port=8000,
cpu_threshold=85,
memory_threshold=80
)
agent = NodeAgent(config)
agent.register_command_plugin(DockerComposeCommands(config))
# Add web-specific health check
@agent.health_check
def check_web_health():
import requests
return requests.get("http://localhost:8000/health").status_code == 200
agent.run()
Database Server Setup
config = BazBeansConfig(
redis_url="redis://cluster-redis:6379/0",
node_id="db-server-01",
data_center="us-east-1",
cpu_threshold=95, # Higher threshold for databases
memory_threshold=90
)
agent = NodeAgent(config)
# Add database-specific health checks
@agent.health_check
def check_database():
# Your database connection logic
return database.is_connected()
@agent.health_check
def check_replication():
# Check replication lag
return database.replication_lag() < 10
agent.run()
๐ฎ CLI Commands
Node Management
# List all nodes with health status
bazbeans list-nodes
# Get detailed node information
bazbeans status web-server-01
# Freeze a node (remove from load balancer)
bazbeans freeze web-server-01 --reason "maintenance"
# Unfreeze a node
bazbeans unfreeze web-server-01
Service Control
# Start services on a node
bazbeans start web-server-01
# Stop services
bazbeans stop web-server-01
# Restart services
bazbeans restart web-server-01
# Rolling update across datacenter
bazbeans update --dc us-east-1
Operations
# Execute commands on nodes
bazbeans exec web-server-01 "docker ps"
# Deploy files to nodes
bazbeans deploy-file web-server-01 ./config.yaml /opt/app/config.yaml
# Clean up dead nodes
bazbeans cleanup
๐ Extensibility
Custom Health Checks
@agent.health_check
def check_custom_service():
"""Check if your custom service is healthy."""
try:
# Your health check logic
return service.ping()
except:
return False
@agent.health_check
def check_disk_space():
"""Custom disk space check."""
import psutil
return psutil.disk_usage('/app').percent < 95
Custom Command Handlers
@agent.command_handler("backup")
def handle_backup(command):
"""Handle backup commands."""
# Your backup logic
return {"status": "backup_started", "timestamp": time.time()}
@agent.command_handler("custom_action")
def handle_custom(command):
"""Handle custom business logic."""
# Your custom logic
return {"status": "completed", "result": "success"}
IP Resolution Strategies
from bazbeans.ip_resolvers import (
RedisIPResolver, # Nodes self-register IPs
DNSIPResolver, # DNS lookup
StaticIPResolver, # Static mapping
ChainedIPResolver # Primary + fallback
)
# Choose your strategy
resolver = ChainedIPResolver(
primary=RedisIPResolver(redis_client),
fallback=StaticIPResolver({"emergency-ip": "10.0.1.100"})
)
๐ System Requirements
Minimum Requirements
- Python: 3.8 or higher
- Memory: 512MB per node
- Disk: 100MB free space
- Network: Port 6379 (Redis) accessible
Recommended for Production
- Python: 3.9+ with virtual environment
- Memory: 1GB+ per node
- Redis: Dedicated server with persistence
- Network: Private network or VPN
- Security: Redis AUTH + TLS
Platform Support
- โ Linux (Ubuntu, CentOS, Debian)
- โ macOS (development only)
- โ Windows (development only)
- โ Docker containers
- โ Kubernetes (with custom setup)
๐ Security Considerations
Redis Security
# Enable Redis authentication
requirepass your-secure-password
# Use TLS in production
tls-port 6380
tls-cert-file /path/to/redis.crt
tls-key-file /path/to/redis.key
# Network isolation
bind 10.0.1.10 127.0.0.1
Agent Security
# Run as non-root user
# Use virtual environments
# Validate file paths
# Whitelist allowed commands
config.allowed_exec_prefixes = ["docker", "systemctl", "ls"]
Network Security
- Use VPN or private networks
- Implement firewall rules
- Monitor for unauthorized access
- Regular security audits
๐ Documentation
Getting Started
- Quick Start Guide - 5-minute setup
- Auto-Installation Guide - CLI auto-install details
- CLI Setup Guide - Manual CLI installation
- Agent Deployment Guide - Production deployment
Advanced Topics
- Architecture Guide - System design and components
- Troubleshooting Guide - Common issues and solutions
- Examples - Integration patterns and samples
Reference
- Configuration Reference - All configuration options
- CLI Command Reference - Complete command list
- API Documentation - Programmatic usage
๐ Getting Help
Self-Service
- Troubleshooting Guide - Step-by-step problem solving
- FAQ - Common questions
- Examples - Working code samples
Community
- GitHub Issues - Bug reports and feature requests
- Discussions - Questions and best practices
- Wiki - Community-contributed content
Enterprise Support
- Priority support channels
- Custom integration assistance
- Architecture consulting
- Training sessions
๐ค Contributing
We welcome contributions! See our Contributing Guide for details.
Quick Contribution Steps
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ License
This toolkit is designed to be generic and reusable across projects. Please adapt and extend as needed for your specific use case.
๐ Release Notes
v0.1.1 - Auto-Installation Feature
๐ New: One-Click CLI Installation
- Automatic CLI Installation: When you run
pip install bazbeans, the OS-specific CLI is now automatically installed - Cross-Platform Support: Works seamlessly on Linux, macOS, and Windows
- Smart OS Detection: Automatically chooses the right installer for your platform
- Error Handling: Graceful fallbacks if installation fails - Python package still works
- Skip Options: Multiple ways to skip auto-installation if needed
๐ ๏ธ Improvements
- Enhanced setup experience with automatic PATH configuration
- Clear installation progress messages
- Comprehensive troubleshooting documentation
- Manual installation options still available
๐ Documentation
- New Auto-Installation Guide with detailed information
- Updated CLI Setup Guide with auto-installation notes
- Improved README with auto-installation highlights
๐ง Technical Details
- Custom setuptools commands for integration
- Post-installation hooks for seamless installation
- Environment variable controls for customization
- Non-blocking installation that doesn't affect Python package functionality
What's Next
- Enhanced cross-platform compatibility testing
- Additional CLI command improvements
- More integration examples and patterns
๐ฏ Next Steps
- New Users: Start with Quick Start Guide
- Production Setup: Read Agent Deployment Guide
- Custom Integration: See Examples folder
- Deep Understanding: Review Architecture Guide
โฑ๏ธ Time to First Value: 5 minutes with Quick Start
๐ฏ Primary Goal: Simplify distributed application management
๐ง Approach: Generic, pluggable, production-ready toolkit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bazbeans-0.1.4.tar.gz.
File metadata
- Download URL: bazbeans-0.1.4.tar.gz
- Upload date:
- Size: 68.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f2b4fe247e898951fb15d8fffb5c6794a79a33ba576ae40d064b1e620216525
|
|
| MD5 |
93d4f6fb843e75e86cdadc8d97b15bcb
|
|
| BLAKE2b-256 |
8ee122ea6a29acd3ee9f5aea7ddb7860e50bf8e6142f27b7a1dba3ffab99029a
|
File details
Details for the file bazbeans-0.1.4-py3-none-any.whl.
File metadata
- Download URL: bazbeans-0.1.4-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
671240b54c2f465d0cfe5ba670cc219f16ae12666bea91c0891dde6a9649b523
|
|
| MD5 |
5889f7a056cf4810a1203806f1a72523
|
|
| BLAKE2b-256 |
2db4a663a2a3d5d0a1ee0776d37d943d10b2562ed7dadf63436cce88fe805596
|