Environment Isolation and Orchestration for Microservices
Project description
Servos - Service Environment Isolation & Orchestration System
A lightweight Python library for environment isolation, Docker orchestration, and multi-platform service deployment. Extracted from the ProServe framework to provide focused environment isolation capabilities.
๐ Part of the modular ecosystem: ProServe (core framework) โข Servos (isolation) โข EDPMT (hardware) โข wmlog (logging)
๐ฏ Overview
Servos provides robust environment isolation and orchestration for running services across multiple platforms including Arduino, MicroPython, ARM64, and x86_64 architectures. It offers containerized execution environments with automatic platform detection and deployment.
๐๏ธ Architecture
Servos Ecosystem Integration
graph TB
subgraph "Modular Ecosystem"
ProServe[ProServe Framework<br/>Core Microservices]
Servos[Servos<br/>Environment Isolation]
EDPMT[EDPMT Framework<br/>Hardware Control]
wmlog[wmlog<br/>Centralized Logging]
end
ProServe --> Servos
EDPMT --> Servos
Servos --> wmlog
subgraph "Servos Core Architecture"
IsolationManager[IsolationManager<br/>Process/Container Management]
PlatformDetector[PlatformDetector<br/>Auto-Detection]
EnvironmentConfig[EnvironmentConfig<br/>Resource Limits]
ContainerOrchestrator[Container Orchestrator<br/>Docker Management]
end
Servos --> IsolationManager
Servos --> PlatformDetector
Servos --> EnvironmentConfig
Servos --> ContainerOrchestrator
subgraph "Platform Support"
Arduino[Arduino<br/>AVR/ESP32/STM32]
MicroPython[MicroPython<br/>ESP32/CircuitPython]
ARM64[ARM64<br/>Raspberry Pi/M1]
x86_64[x86_64<br/>Standard PC/Server]
end
PlatformDetector --> Arduino
PlatformDetector --> MicroPython
PlatformDetector --> ARM64
PlatformDetector --> x86_64
subgraph "Isolation Modes"
ProcessIsolation[Process Isolation<br/>Native Execution]
DockerIsolation[Docker Containers<br/>Full Isolation]
ResourceLimits[Resource Limits<br/>CPU/Memory/Time]
NetworkIsolation[Network Isolation<br/>Controlled Access]
end
IsolationManager --> ProcessIsolation
IsolationManager --> DockerIsolation
IsolationManager --> ResourceLimits
IsolationManager --> NetworkIsolation
subgraph "Docker Environments"
ArduinoContainer[Arduino Container<br/>PlatformIO/Toolchain]
MicroPyContainer[MicroPython Container<br/>Firmware/Tools]
ARM64Container[ARM64 Container<br/>Cross-compilation]
x86Container[x86_64 Container<br/>Standard Runtime]
end
DockerIsolation --> ArduinoContainer
DockerIsolation --> MicroPyContainer
DockerIsolation --> ARM64Container
DockerIsolation --> x86Container
Detailed Servos Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Servos Architecture โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ CLI Interface โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ servos โ โ servos โ โ servos โ โ servos โ โ โ
โ โ โ detect โ โlist-platformsโ โ version โ โ <command> โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โโข Auto-detectโ โโข Show all โ โโข Version โ โโข Custom โ โ โ
โ โ โ current โ โ supported โ โ info โ โ isolation โ โ โ
โ โ โ platform โ โ platforms โ โโข Build โ โ commands โ โ โ
โ โ โโข Hardware โ โโข Docker โ โ metadata โ โโข Interactive โ โ โ
โ โ โ details โ โ images โ โโข CLI help โ โ shell โ โ โ
โ โ โโข System โ โโข Capabilitiesโ โ โ โ โ โ โ
โ โ โ info โ โ โ โ โ โ โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Core Isolation Engine โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ Isolation โ โ Platform โ โEnvironment โ โ Container โ โ โ
โ โ โ Manager โ โ Detector โ โ Config โ โ Orchestrator โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โโข Process โ โโข Hardware โ โโข Resource โ โโข Docker API โ โ โ
โ โ โ Spawn โ โ Detection โ โ Limits โ โโข Image Build โ โ โ
โ โ โโข Container โ โโข Arch Query โ โโข CPU/Memory โ โโข Container โ โ โ
โ โ โ Create โ โโข OS Info โ โโข Network โ โ Lifecycle โ โ โ
โ โ โโข Security โ โโข Feature โ โ Rules โ โโข Volume Mount โ โ โ
โ โ โ Sandbox โ โ Support โ โโข Time Limitsโ โโข Health Check โ โ โ
โ โ โโข Resource โ โโข Embedded โ โโข User/Group โ โโข Log Stream โ โ โ
โ โ โ Monitor โ โ Board ID โ โ Mapping โ โโข Network Setup โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Platform-Specific Environments โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ Arduino โ โMicroPython โ โ ARM64 โ โ x86_64 โ โ โ
โ โ โEnvironment โ โ Environment โ โEnvironment โ โ Environment โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โโข PlatformIO โ โโข MicroPythonโ โโข Cross- โ โโข Standard โ โ โ
โ โ โ Toolchain โ โ Runtime โ โ compilationโ โ Runtime โ โ โ
โ โ โโข AVR-GCC โ โโข CircuitPy โ โโข QEMU โ โโข Python 3.8+ โ โ โ
โ โ โโข ESP-IDF โ โ Support โ โ Emulation โ โโข Build Tools โ โ โ
โ โ โโข STM32Cube โ โโข Firmware โ โโข RPi Tools โ โโข Dev Libraries โ โ โ
โ โ โโข Board โ โ Upload โ โโข Native โ โโข Testing โ โ โ
โ โ โ Configs โ โโข Serial โ โ Execution โ โ Framework โ โ โ
โ โ โโข Flash โ โโข Debug โ โโข Profiling โ โโข Debug Tools โ โ โ
โ โ โ Tools โ โโข Serial โ โ Tools โ โโข Performance โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Docker Integration โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ Arduino โ โ MicroPython โ โ ARM64 โ โ x86_64 โ โ โ
โ โ โ Container โ โ Container โ โ Container โ โ Container โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โโข Ubuntu โ โโข Python 3.x โ โโข Multi-arch โ โโข Ubuntu/Alpine โ โ โ
โ โ โ Base โ โ Base โ โ Support โ โ Base โ โ โ
โ โ โโข PlatformIO โ โโข MicroPythonโ โโข Cross-comp โ โโข Python 3.8+ โ โ โ
โ โ โ Install โ โ Tools โ โ Toolchain โ โโข Development โ โ โ
โ โ โโข Serial โ โโข esptool โ โโข QEMU User โ โ Environment โ โ โ
โ โ โ Support โ โโข ampy โ โ Mode โ โโข Build Utils โ โ โ
โ โ โโข USB/GPIO โ โโข rshell โ โโข Native โ โโข Package โ โ โ
โ โ โ Access โ โโข mpremote โ โ Runtime โ โ Managers โ โ โ
โ โ โโข Firmware โ โโข Firmware โ โโข Debug โ โโข Testing โ โ โ
โ โ โ Flash โ โ Management โ โ Support โ โ Frameworks โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Integration Layer โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ wmlog โ โ ProServe โ โ EDPMT โ โ Docker โ โ โ
โ โ โ Logging โ โ Framework โ โ Hardware โ โ Engine โ โ โ
โ โ โ โ โ โ โ Management โ โ โ โ โ
โ โ โโข Structured โ โโข Service โ โโข Device โ โโข Container โ โ โ
โ โ โ Logging โ โ Framework โ โ Control โ โ Runtime โ โ โ
โ โ โโข Real-time โ โโข Manifest โ โโข GPIO/I2C โ โโข Image โ โ โ
โ โ โ Stream โ โ Driven โ โโข Sensor โ โ Management โ โ โ
โ โ โโข Context โ โโข Multi-env โ โ Reading โ โโข Volume โ โ โ
โ โ โ Enrichment โ โ Deploy โ โโข Hardware โ โ Management โ โ โ
โ โ โโข WebSocket โ โโข Discovery โ โ Testing โ โโข Network โ โ โ
โ โ โโข MQTT โ โโข Migration โ โโข Firmware โ โ Management โ โ โ
โ โ โโข Console โ โโข Auto Scale โ โ Upload โ โโข Resource โ โ โ
โ โ โ Output โ โโข Load Bal. โ โโข Monitor โ โ Monitoring โ โ โ
โ โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โจ Features
๐ง Component Layers
graph TB
CLI[CLI Interface] --> Core[Core Isolation]
CLI --> Platform[Platform Detection]
Core --> Docker[Docker Manager]
Platform --> Docker
Docker --> Arduino[Arduino Container]
Docker --> MicroPython[MicroPython Container]
Docker --> ARM64[ARM64 Container]
Docker --> x86[x86_64 Container]
Arduino --> Hardware1[Arduino Hardware]
MicroPython --> Hardware2[ESP32/CircuitPython]
ARM64 --> Hardware3[Raspberry Pi/Apple M1]
x86 --> Hardware4[Standard PC/Server]
๐ Quick Start
Installation
# Basic installation
pip install servos
# With all optional dependencies
pip install servos[all]
# With Docker support
pip install servos[docker]
# For MicroPython development
pip install servos[micropython]
# For Arduino development
pip install servos[arduino]
Basic Usage
from servos import IsolationManager, PlatformDetector
# Detect current platform
detector = PlatformDetector()
platform = detector.detect_platform()
print(f"Detected platform: {platform}")
# Create isolated environment
manager = IsolationManager(platform=platform)
result = manager.execute_isolated("my_script.py")
CLI Usage
# Detect current platform
servos detect
# Run script in isolated environment
servos isolate my_script.py
# List supported platforms
servos list-platforms
# Show version information
servos version
๐ Supported Platforms
| Platform | Description | Container | Use Cases |
|---|---|---|---|
arduino |
Arduino & compatible MCUs | โ | IoT, embedded systems |
micropython |
MicroPython environments | โ | ESP32, CircuitPython |
arm64 |
ARM64 processors | โ | Raspberry Pi, Apple M1 |
x86_64 |
Standard x86_64 | โ | PCs, servers |
rpi-arm |
Raspberry Pi ARM | โ | Pi-specific projects |
๐ฆ Package Structure
servos/
โโโ servos/
โ โโโ __init__.py # Main package interface
โ โโโ cli.py # Command-line interface
โ โโโ core/
โ โ โโโ __init__.py
โ โ โโโ isolation.py # Core isolation management
โ โโโ isolation/
โ โโโ __init__.py
โ โโโ extended_environments.py # Extended isolation
โ โโโ platforms/ # Platform-specific code
โโโ docker/ # Container definitions
โ โโโ arduino/ # Arduino container
โ โโโ micropython/ # MicroPython container
โ โโโ arm64/ # ARM64 container
โ โโโ x86_64/ # x86_64 container
โโโ tests/ # Test suite
โโโ setup.py # Package configuration
โโโ requirements.txt # Dependencies
โโโ Makefile # Build automation
โโโ README.md # This file
๐จ Development
Local Development
# Clone and setup
git clone https://github.com/servos/servos.git
cd servos
# Install in development mode
make install
# Run tests
make test
# Build package
make build
# Format code
make format
Building Containers
The Docker environments are automatically built when needed, but you can also build them manually:
# Build specific platform container
docker build -f docker/arduino/Dockerfile -t servos:arduino .
docker build -f docker/micropython/Dockerfile -t servos:micropython .
docker build -f docker/arm64/Dockerfile -t servos:arm64 .
docker build -f docker/x86_64/Dockerfile -t servos:x86_64 .
๐งช Testing
# Run all tests
make test
# Run specific test
python -m pytest tests/test_isolation.py
# Run with coverage
python -m pytest --cov=servos tests/
๐ API Reference
IsolationManager
Main class for managing environment isolation:
from servos import IsolationManager, EnvironmentConfig
config = EnvironmentConfig()
manager = IsolationManager(platform="arduino", config=config)
result = manager.execute_isolated("blink_led.py")
PlatformDetector
Automatic platform detection:
from servos.isolation.platforms import PlatformDetector
detector = PlatformDetector()
platform = detector.detect_platform()
architecture = detector.get_architecture()
๐ Integration with ProServe
Servos is designed to work seamlessly with the ProServe framework:
# In your ProServe service manifest
dependencies:
- servos>=1.0.0
# Use in ProServe services
from servos import IsolationManager
from proserve import Service
class MyService(Service):
def __init__(self):
self.isolation = IsolationManager()
async def handle_request(self, request):
result = self.isolation.execute_isolated("user_script.py")
return {"status": "success", "result": result}
๐ค Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ License
This project is licensed under the Apache Software License 2.0 - see the LICENSE file for details.
๐จโ๐ป Author
Tom Sapletta
- Email: info@softreck.dev
- GitHub: @tom-sapletta-com
- Website: softreck.dev
๐ Acknowledgments
- Extracted from the ProServe framework
- Built for the EDPMT (Electronic Device Programming & Management Tool) ecosystem
- Inspired by modern containerization and microservices architectures
Servos - Making environment isolation simple and powerful! ๐
Documentation
- API Documentation - Detailed reference for Servos APIs
- Quick Start - Getting started with environment isolation
Python Packages
Explore the ecosystem of Python packages related to Servos:
- ProServe - Core microservices framework
- Servos - Environment isolation and orchestration
- wmlog - Centralized structured logging
- SELLM - AI-powered manifest generator
- EDPMT - Hardware control framework for IoT
Why Servos?
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 servos-1.0.5.tar.gz.
File metadata
- Download URL: servos-1.0.5.tar.gz
- Upload date:
- Size: 50.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7445b23f6f7faa177d41b82f8dff1c3205c423c234e37b1855f097190fb7d9cc
|
|
| MD5 |
a140120afe419e78a70f374af7ce32eb
|
|
| BLAKE2b-256 |
8e97eb013d3d8ea8849bc6840b47410393329d6414e2562432779f2233c0b5fc
|
File details
Details for the file servos-1.0.5-py3-none-any.whl.
File metadata
- Download URL: servos-1.0.5-py3-none-any.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
640baae22c28de19d287e78619bd98b300e87ad721de70bade3f783d064bb8db
|
|
| MD5 |
74388c9ffd6cad1bbca0ef48c18ff96a
|
|
| BLAKE2b-256 |
32c47d58a5baa87917f41d97e9ce34ad805a7a467f1f8efd6625a1e7b636481e
|