π Architecture
Revolutionary Dual-Mode Architecture
Servin Container Runtime features a revolutionary dual-mode architecture that provides both native Linux containerization and universal VM-based containerization across all platforms.
π― Containerization Modes
- Native Mode (Linux): Direct kernel integration for maximum performance
- VM Mode (Universal): Linux VM providing true containerization on any platform
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Servin Container Runtime β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Dual-Mode Engine β
β βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ
β β Native Mode β β VM Mode ββ
β β (Linux Only) β β (Windows/macOS/Linux) ββ
β β β β ββ
β β βββββββββββββββββββ β β βββββββββββββββββββββββββββββββ ββ
β β β Direct Kernel β β β β Linux VM Container β ββ
β β β Namespaces β β β β Engine β ββ
β β β + cgroups β β β β β ββ
β β βββββββββββββββββββ β β β βββββββββββββββββββββββββββ β ββ
β βββββββββββββββββββββββ β β β KVM/Hyper-V/VMware β β ββ
β β β β Virtualization.frameworkβ β ββ
β β β βββββββββββββββββββββββββββ β ββ
β β βββββββββββββββββββββββββββββββ ββ
β ββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β User Interfaces (Common Across Both Modes) β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
β β CLI β β TUI β β Desktop GUI ββ
β β Command β β Terminal β β Flask + pywebview ββ
β β Line β β Interface β β Binary Distribution ββ
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Core Runtime Services β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
β β Container β β Image β β Volume ββ
β β Management β β Management β β Management ββ
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β API Layer β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
β β CRI Server β β HTTP API β β gRPC Services ββ
β β (gRPC) β β (REST) β β (Internal Comms) ββ
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Platform Integration Layer β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
β β Linux β β Windows β β macOS ββ
β β Native β β VM Mode β β VM Mode ββ
β β + VM β β (Hyper-V) β β (Virtualization.fwk) ββ
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Platform-Specific Implementation
π§ Linux: Native + VM Modes
- Native Mode (Default): Direct kernel namespaces, cgroups, capabilities
- VM Mode (Optional): KVM/QEMU-based Linux VM for enhanced isolation
- Automatic Selection: Native preferred, VM available for security
πͺ Windows: VM Mode Only
- VM Engine: Hyper-V or WSL2-based Linux VM
- Automatic: VM mode initializes seamlessly on first run
- Integration: Native Windows GUI with Linux container engine
π macOS: VM Mode Only
- VM Engine: Virtualization.framework-based Linux VM
- Universal: Intel and Apple Silicon support
- Seamless: Native macOS experience with Linux containers
Component Architecture
π― Dual-Mode Runtime Engine
Native Mode Engine (Linux)
- Direct Kernel Access: Linux namespaces (PID, Network, Mount, UTS, IPC, User)
- Resource Control: cgroups v1/v2 for CPU, memory, I/O limits
- Security: Capabilities, SELinux/AppArmor integration
- Performance: Zero virtualization overhead
- Compatibility: Full Docker and OCI compatibility
VM Mode Engine (Universal)
- Linux VM: Lightweight Linux VM for universal containerization
- VM Backends:
- Windows: Hyper-V, WSL2
- macOS: Virtualization.framework, QEMU
- Linux: KVM/QEMU (optional for enhanced isolation)
- VM Management: Automatic VM lifecycle, state persistence
- Bridge Integration: Seamless host-VM communication
- Resource Efficiency: Optimized VM with minimal overhead
π§ Container Management Core
Container Lifecycle Management
- Create, Start, Stop, Delete: Full container lifecycle control across both modes
- Process Management: Handle container processes and signal forwarding
- Resource Management: CPU, memory, and I/O resource allocation
- State Persistence: Container state maintained across VM restarts
- Security: Mode-appropriate isolation (namespaces or VM boundaries)
Image Manager
- OCI Image Support: Full OCI image specification compliance
- Layer Management: Efficient layer storage and deduplication
- Cross-Mode Sharing: Images work identically in native and VM modes
- Multi-architecture: Support for ARM64 and AMD64 architectures
- Registry Integration: Pull/push from any OCI-compatible registry
Volume Manager
- Universal Volumes: Consistent volume behavior across modes
- Bind Mounts: Host directory mounting with proper permissions
- Named Volumes: Persistent volume creation and management
- VM Volume Bridge: Seamless host-VM volume sharing in VM mode
- Storage Drivers: Pluggable storage backend support
Network Manager
- Mode-Adaptive Networking:
- Native Mode: Direct Linux bridge networks, namespaces
- VM Mode: VM-bridged networking with host integration
- Port Management: Port forwarding and publishing across VM boundaries
- DNS Resolution: Container name resolution in both modes
- Network Isolation: Security through network segmentation
Registry Client
- Authentication: Registry login and credential management
- Push/Pull Operations: Efficient image transfer
- Manifest Handling: Image manifest processing
- Mirror Support: Registry mirror configuration
π Universal Interface Layer
CLI Interface (Identical Across Modes)
# These commands work identically in native and VM modes:
servin run alpine:latest
servin ps
servin images
servin networks ls
servin vm status # VM mode specific
servin vm start # VM mode specific
Terminal UI (TUI)
- Mode-Aware Interface: Shows current mode (Native/VM)
- Real-time Monitoring: Container status regardless of mode
- VM Management: VM-specific controls when in VM mode
- Cross-platform: Identical experience on all platforms
Desktop GUI
- Universal Web Interface: Flask backend + pywebview frontend
- Mode Indicator: Clear indication of current containerization mode
- VM Controls: VM start/stop/status when in VM mode
- Cross-platform Binary: PyInstaller distribution for all platforms
π API Layer
CRI Server (gRPC)
- Full Kubernetes CRI v1alpha2 implementation
- Pod sandbox management
- Container lifecycle operations
- Image service operations
HTTP API (REST)
- Docker-compatible REST API
- Authentication and authorization
- Rate limiting and throttling
- OpenAPI documentation
Internal gRPC Services
- Inter-component communication
- Service discovery and health checks
- Distributed operations coordination
- Event streaming and notifications
πΎ Storage Layer
Container Storage
- Container filesystem layers
- Read-write layer management
- Snapshot support
- Copy-on-write optimization
Image Store
- OCI image storage
- Layer deduplication
- Garbage collection
- Metadata indexing
Configuration & Metadata
- YAML/JSON configuration files
- Container metadata database
- Network configuration
- Volume metadata
Data Flow
Container Creation Flow
- Request Received: CLI/API receives container creation request
- Image Resolution: Image manager resolves and pulls required image
- Network Setup: Network manager creates container networking
- Volume Preparation: Volume manager prepares storage mounts
- Container Creation: Runtime engine creates container with specified configuration
- Process Start: Container process is started with proper isolation
- Status Update: Container status is updated and stored
Image Pull Flow
- Registry Authentication: Authenticate with target registry
- Manifest Download: Download image manifest and layer information
- Layer Download: Download missing layers with deduplication
- Layer Extraction: Extract and store layers in storage backend
- Image Indexing: Update image metadata and make available
- Cleanup: Remove temporary files and update cache
Security Architecture
Container Isolation
- Namespaces: PID, network, mount, user, UTS, IPC isolation
- Cgroups: Resource limitation and accounting
- Capabilities: Fine-grained privilege control
- Seccomp: System call filtering
Network Security
- Network Isolation: Separate network namespaces per container
- Firewall Integration: iptables/netfilter rule management
- TLS Encryption: Secure registry communication
- Certificate Management: PKI infrastructure support
Storage Security
- Filesystem Permissions: Proper file ownership and permissions
- Encryption Support: At-rest and in-transit encryption
- Integrity Checking: Image and layer verification
- Access Control: Role-based access to storage resources
Performance Considerations
Optimization Strategies
- Layer Caching: Intelligent layer caching and reuse
- Parallel Operations: Concurrent image pulls and container operations
- Memory Management: Efficient memory usage and garbage collection
- I/O Optimization: Optimized filesystem operations
Scalability Features
- Horizontal Scaling: Multiple daemon instances
- Load Balancing: Request distribution across instances
- Resource Pooling: Shared resource management
- Async Operations: Non-blocking operation handling
Binary Distribution Architecture
PyInstaller Integration
- Single-File Executables: Complete Python runtime embedded in 13MB binary
- Cross-Platform Support: Native binaries for Windows, Linux, and macOS
- No Dependencies: Self-contained executables require no Python installation
- Optimized Performance: Faster startup times compared to Python source execution
Build System
# Cross-platform build orchestration
./build-all.sh
# Platform-specific outputs:
# βββ dist/windows/servin-gui.exe # Windows executable
# βββ dist/linux/servin-gui # Linux binary
# βββ dist/mac/servin-gui # macOS universal binary
Professional Distribution
- macOS .dmg Creation: Professional disk image with app bundle structure
- Windows NSIS Installer: Complete installation wizard with system integration
- Linux Package Distribution: Tar.gz archives with installation scripts
- GitHub Releases Integration: Automated release creation and artifact upload
Installation Wizards
- Cross-Platform Installers: Python/Tkinter-based wizards for all platforms
- Privilege Escalation: Proper sudo/administrator privilege handling
- Timeout Protection: Robust subprocess management with comprehensive timeouts
- User Consent Flows: Interactive privilege escalation with clear explanations
- Error Recovery: Graceful handling of installation failures and cancellations
Directory Structure
servin/
βββ cmd/ # Application entry points
β βββ servin-desktop/ # Terminal UI application
β βββ servin-gui/ # GUI command integration
β βββ gui.go # GUI launcher implementation
βββ webview_gui/ # Desktop GUI application
β βββ main.py # PyInstaller entry point
β βββ app.py # Flask backend API
β βββ servin_client.py # Servin runtime interface
β βββ servin-gui.spec # PyInstaller build specification
β βββ requirements.txt # Python dependencies (Flask, pywebview, etc)
β βββ templates/ # HTML templates for web interface
β βββ static/ # CSS, JavaScript, and assets
βββ pkg/ # Core packages
β βββ cri/ # Container Runtime Interface
β β βββ server/ # CRI gRPC server
β β βββ sandbox/ # Pod sandbox management
β β βββ image/ # CRI image service
β βββ container/ # Container management
β β βββ runtime/ # Container runtime operations
β β βββ lifecycle/ # Lifecycle management
β β βββ exec/ # Container exec operations
β βββ image/ # Image management
β β βββ store/ # Image storage backend
β β βββ registry/ # Registry operations
β β βββ builder/ # Image building
β βββ volume/ # Volume management
β β βββ drivers/ # Storage drivers
β β βββ manager/ # Volume lifecycle
β βββ network/ # Network management
β β βββ bridge/ # Bridge driver
β β βββ dns/ # DNS resolution
β β βββ firewall/ # Firewall integration
β βββ registry/ # Registry operations
β βββ client/ # Registry client
β βββ auth/ # Authentication
β βββ mirror/ # Registry mirrors
βββ internal/ # Internal packages
β βββ config/ # Configuration management
β βββ metrics/ # Metrics collection
β βββ logging/ # Logging infrastructure
β βββ storage/ # Storage backends
βββ api/ # API definitions
β βββ http/ # REST API handlers
β βββ grpc/ # gRPC service definitions
β βββ swagger/ # API documentation
βββ installers/ # Installation wizards
β βββ windows/ # NSIS-based Windows installer + Python wizard
β βββ linux/ # Python/Tkinter Linux installer wizard
β βββ macos/ # Python/Tkinter macOS installer wizard
βββ build/ # Build artifacts and platform binaries
βββ dist/ # PyInstaller distribution packages
β βββ windows/ # Windows servin-gui.exe
β βββ linux/ # Linux servin-gui binary
β βββ mac/ # macOS servin-gui universal binary
βββ docs/ # Documentation
Next Steps
- Features Overview - Detailed feature descriptions
- Installation Guide - Get Servin running
- Configuration - Configure Servin for your environment