CLI client for managing Drupal sites across multiple operation channels
Project description
Smooth Operator
A CLI client for managing Drupal sites across multiple operation channels (Pantheon, Lando).
Description
Smooth Operator is a powerful CLI tool designed to simplify the management of Drupal sites hosted on Pantheon. It provides a unified interface for working with multiple operational channels (Lando, Drush, Terminus, GitLab) and supports both individual and bulk site operations.
The tool is built with modern Python (3.8+) and leverages asynchronous programming for efficient operation, especially when managing multiple sites simultaneously.
Key Features
- Site Management: Clone, list, and manage Pantheon sites
- Extension Inventory: Analyze and catalog site extensions
- Upstream Updates: Apply complex, manifest-driven update workflows to multiple sites
- Batch Processing: Efficiently process large numbers of sites with configurable batching
- Parallel Execution: Run operations concurrently for improved performance
- Structured Logging: Comprehensive logging with structured data for better troubleshooting
- Rich Terminal Output: Human-friendly terminal output with color and formatting
Architecture
Smooth Operator is built around several core components:
- Channels: Abstractions for interacting with external systems (Terminus, Lando)
- Commands: CLI commands organized by domain (site, extension, upstream)
- Operations: Core business logic components for specific operational tasks
- Executor: Task execution engine with dependency management
- Utilities: Shared functionality for logging, filtering, async operations, etc.
The system uses a task-based approach for complex operations, with tasks organized in a dependency graph for proper execution order.
Technologies Used
- Click/Typer: Modern Python CLI framework with strong typing support
- Rich: Terminal formatting library for creating beautiful CLI output
- StructLog: Structured logging library for comprehensive, machine-parseable logs
- Pydantic: Data validation and settings management using Python type annotations
- Asyncio: Python's built-in asynchronous I/O framework for concurrent operations
- HTTPX: Modern, async-capable HTTP client for API interactions
- JSONPickle: Advanced JSON serialization for complex Python objects
- PyYAML: YAML parser for configuration files
Installation Options
PyPI Installation (Recommended)
The simplest way to install Smooth Operator:
# Install from PyPI
pip install smooth-operator
# Verify installation
smooth-operator --version
Docker Installation
If you prefer using Docker:
# Pull the Docker image
docker pull yourusername/smooth-operator:latest
# Run Smooth Operator commands
docker run -it yourusername/smooth-operator:latest [command]
# Using with local files (mount volumes)
docker run -it -v $(pwd):/workspace -w /workspace yourusername/smooth-operator:latest [command]
Development Installation
For contributors or local development:
# Clone the repository
git clone https://github.com/yourusername/smooth-operator.git
cd smooth-operator
# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
Standalone Executable (Linux)
For users who prefer a standalone executable without Python dependencies:
# Download the executable
wget https://github.com/yourusername/smooth-operator/releases/latest/download/smooth-operator-linux
# Make it executable
chmod +x smooth-operator-linux
# Move to a directory in your PATH (optional)
sudo mv smooth-operator-linux /usr/local/bin/smooth-operator
Terminus Configuration
Smooth Operator can work with Terminus in two ways:
Option 1: Using Lando (Default)
# Start Lando
lando start
# Authenticate with Terminus
lando terminus auth:login --machine-token=YOUR_PANTHEON_MACHINE_TOKEN
Option 2: Using External Terminus
If you have Terminus installed directly on your system:
- Create a configuration file at
~/.smooth_operator/config.yml:
terminus:
terminus_path: "/path/to/your/terminus"
use_lando: false
logging:
level: INFO
file: smooth_operator.log
parallel:
default: false
max_workers: 5
Configuration
Create a .smooth_operator.yml file in your home directory or project directory:
terminus:
binary: terminus
lando:
sites_path: ~/pantheon
gitlab:
api_url: https://gitlab.example.com/api/v4
token: YOUR_GITLAB_TOKEN
logging:
level: INFO
file: smooth_operator.log
parallel:
default: false
max_workers: 5
Usage
Basic Commands
# List all sites
smooth-operator site list
# Clone a site
smooth-operator site clone source-site target-site --source-env=live --target-env=dev
# Get extension inventory
smooth-operator extension inventory --site=example-site
Upstream Updates
The upstream updater is a powerful feature that allows you to define and execute complex update processes across multiple sites using JSON manifests:
# Run upstream updates on specific sites
smooth-operator upstream update manifest.json --site=example-site
# Run updates with batching for many sites
smooth-operator upstream update manifest.json --batch --batch-size=5 --wait=60
# Run updates in parallel for faster processing
smooth-operator upstream update manifest.json --parallel --max-workers=3
# Filter sites by tag
smooth-operator upstream update manifest.json --tag=client-a --tag=production
See the Upstream Updater documentation for detailed information on creating manifests and available options.
License
Proprietary
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 smooth_operator-0.1.0.tar.gz.
File metadata
- Download URL: smooth_operator-0.1.0.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef7a7212030c6e700fd485f8ae87dcc5f2110b2a7b1aa486906f3eedeb30114
|
|
| MD5 |
65b25b176e999fbc3df5cef260eaf717
|
|
| BLAKE2b-256 |
d3c6b75ed4a5ff4df71f2633b2fd95bfca209a611e20c8d876a62c0f513131b1
|
File details
Details for the file smooth_operator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smooth_operator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3014a8b533640bd38dafd4aa1395737143f0f4cb66eae08ba28361874c1a339b
|
|
| MD5 |
55c44d7530ac7edf60e3320ebdea1aec
|
|
| BLAKE2b-256 |
e737e1fef16d88023be958ead172026fd5466152653e310a03814648b721fa33
|