Satellite Communication
The DeployStack backend implements satellite management APIs that handle registration, command orchestration, and configuration distribution. The system supports both global satellites (serving all teams) and team satellites (serving specific teams) through a polling-based communication architecture.Implementation Status
Current Status: Fully implemented and operational The satellite communication system includes:- Satellite Registration: Working registration endpoint with API key generation
- Command Orchestration: Complete command polling and result reporting endpoints
- Configuration Management: Team-aware MCP server configuration distribution
- Status Monitoring: Heartbeat collection with automatic satellite activation
- Authentication: Argon2-based API key validation middleware
MCP Server Distribution Architecture
Global Satellite Model: Currently implemented approach where global satellites serve all teams with process isolation. Team-Aware Configuration Distribution:- Global satellites receive ALL team MCP server installations
- Each team installation becomes a separate process with unique identifier
- Process ID format:
{server_slug}-{team_slug}-{installation_id}
- Team-specific configurations (args, environment, headers) merged per installation
- Template-level configuration (from MCP server definition)
- Team-level configuration (from team installation)
- User-level configuration (from user preferences)
- Final merged configuration sent to satellite
stdio
transport: Command and arguments for subprocess executionhttp
transport: URL and headers for HTTP proxysse
transport: URL and headers for Server-Sent Events
Satellite Lifecycle Management
Registration Process:- Satellites register with backend and receive API keys
- Initial status set to ‘inactive’ for security
- API keys stored as Argon2 hashes in database
- Satellites send heartbeat after registration
- Backend automatically sets status to ‘active’ on first heartbeat
- Active satellites begin receiving actual commands
- Inactive satellites receive empty command arrays (no 403 errors)
- Active satellites receive pending commands based on priority
- Command results reported back to backend for status tracking
Architecture Pattern
Polling-Based Communication
Satellites use outbound-only HTTPS polling to communicate with the backend, making them compatible with restrictive corporate firewalls:Communication Channels
The system uses three distinct communication patterns: Command Polling (Backend → Satellite):- Backend creates commands, satellites poll and execute
- Adaptive intervals: 2-60 seconds based on priority
- Used for: MCP server configuration, process management
- Satellites report status every 30 seconds
- Contains: System metrics, process counts, resource usage
- Used for: Health monitoring, capacity planning
- Satellites emit events when actions occur, batched every 3 seconds
- Contains: Point-in-time occurrences with precise timestamps
- Used for: Real-time UI updates, audit trails, user notifications
- See Satellite Events for detailed implementation
Dual Deployment Models
Global Satellites: Cloud-hosted by DeployStack team- Serve all teams with resource isolation
- Managed through global satellite management endpoints
- Serve specific teams exclusively
- Managed through team-scoped satellite management endpoints
Satellite Pairing Process
Security Architecture
The satellite pairing process implements a secure two-phase JWT-based authentication system that prevents unauthorized satellite connections. For complete implementation details, see API Security - Registration Token Authentication. Phase 1: Token Generation- Administrators generate temporary registration tokens through admin APIs
- Scope-specific tokens (global vs team) with cryptographic signatures
- Token management endpoints for generation, listing, and revocation
- Satellites authenticate using
Authorization: Bearer deploystack_satellite_*
headers - Backend validates JWT tokens with single-use consumption
- Permanent API keys issued after successful token validation
- Token consumed to prevent replay attacks
Registration Middleware
The secure registration process is implemented through specialized middleware. For technical implementation details, seeservices/backend/src/middleware/registrationTokenMiddleware.ts
.
Key Security Features:
- JWT signature verification with HMAC-SHA256
- Scope validation (global vs team tokens)
- Security event logging for failed attempts
- Structured error responses with actionable instructions
Command Orchestration
Command Queue Architecture
The backend maintains a priority-based command queue system: Command Types:spawn
: Start new MCP server processkill
: Terminate MCP server processrestart
: Restart existing MCP serverconfigure
: Update MCP server configurationhealth_check
: Request process health status
immediate
: High-priority commands requiring instant executionhigh
: Important commands processed within minutesnormal
: Standard commands processed during regular pollinglow
: Background maintenance commands
Adaptive Polling Strategy
Satellites adjust polling behavior based on backend signals: Polling Modes:- Immediate Mode: 2-second intervals for urgent commands
- Normal Mode: 30-second intervals for standard operations
- Backoff Mode: Exponential backoff during errors or low activity
- Conditional polling based on last poll timestamp
- Command batching to reduce API calls
- Cache headers for efficient bandwidth usage
- Circuit breaker patterns for error recovery
Command Lifecycle
Command Flow:- User action triggers command creation in backend
- Command added to priority queue with team context
- Satellite polls and retrieves pending commands
- Satellite executes command with team isolation
- Satellite reports execution results back to backend
- Backend updates command status and notifies user interface
- All commands include team scope information
- Team satellites only receive commands for their team
- Global satellites process commands with team isolation
- Audit trail with team attribution
Status Monitoring
Heartbeat System
Satellites report health and performance metrics: System Metrics:- CPU usage percentage and memory consumption
- Disk usage and network connectivity status
- Process count and resource utilization
- Uptime and stability indicators
- Individual MCP server process status
- Health indicators (healthy/unhealthy/unknown)
- Performance metrics (request count, response times)
- Resource consumption per process
Real-Time Status Tracking
The backend provides real-time satellite status information: Satellite Health Monitoring:- Connection status and last heartbeat timestamps
- System resource usage trends
- Process health aggregation
- Alert generation for issues
- Historical performance data collection
- Usage pattern analysis for capacity planning
- Team-specific metrics and reporting
- Audit trail generation
Configuration Management
Dynamic Configuration Updates
Satellites retrieve configuration updates without requiring restarts: Configuration Categories:- Polling Settings: Interval configuration and optimization parameters
- Resource Limits: CPU, memory, and process count restrictions
- Team Settings: Team-specific policies and allowed MCP servers
- Security Policies: Access control and compliance requirements
- Push-based updates through command queue
- Pull-based configuration refresh during polling
- Version-controlled configuration management
- Rollback capabilities for configuration errors
Team-Aware Configuration
Configuration respects team boundaries and isolation: Global Satellite Configuration:- Platform-wide settings and resource allocation
- Multi-tenant isolation policies
- Global resource limits and quotas
- Cross-team security boundaries
- Team-specific MCP server configurations
- Custom resource limits per team
- Team-defined security policies
- Internal resource access settings
Database Schema Integration
Core Table Structure
The satellite system integrates with existing DeployStack schema through 5 specialized tables. For detailed schema definitions, seeservices/backend/src/db/schema.sqlite.ts
.
Satellite Registry (satellites
):
- Central registration of all satellites
- Type classification (global/team) and ownership
- Capability tracking and status monitoring
- API key management and authentication
satelliteCommands
):
- Priority-based command orchestration
- Team context and correlation tracking
- Expiration and retry management
- Command lifecycle tracking
satelliteProcesses
):
- Real-time MCP server process monitoring
- Health status and performance metrics
- Team isolation and resource usage
- Integration with existing MCP configuration system
satelliteUsageLogs
):
- Audit trail for compliance
- User attribution and team tracking
- Performance analytics and billing data
- Device tracking for enterprise security
satelliteHeartbeats
):
- System metrics and resource monitoring
- Process health aggregation
- Alert generation and notification triggers
- Historical health trend analysis
Team Isolation in Data Model
All satellite data respects team boundaries: Team-Scoped Data:- Team satellites linked to specific teams
- Process isolation per team context
- Usage logs with team attribution
- Configuration scoped to team access
- Global satellites serve all teams with isolation
- Cross-team usage tracking and analytics
- Team-aware resource allocation
- Compliance reporting per team
Authentication & Security
Multi-Layer Security Model
Registration Security:- Temporary JWT tokens for initial pairing
- Scope validation preventing privilege escalation
- Single-use tokens with automatic expiration
- Audit trail for security compliance
- Permanent API keys for ongoing communication
- Request authentication and authorization
- Rate limiting and abuse prevention
- IP whitelisting support for team satellites
- Team boundary enforcement
- Resource isolation and access control
- Cross-team data leakage prevention
- Compliance with enterprise security policies
Role-Based Access Control Integration
The satellite system integrates with DeployStack’s existing role framework: global_admin:- Satellite system oversight
- Global satellite registration and management
- Cross-team analytics and monitoring
- System-wide configuration control
- Team satellite registration and management
- Team-scoped MCP server installation
- Team resource monitoring and configuration
- Team member access control
- Satellite-hosted MCP server usage
- Team satellite status visibility
- Personal usage analytics access
- Team satellite registration within memberships
- Cross-team satellite usage through teams
- Limited administrative capabilities
Integration Points
Existing DeployStack Systems
User Management Integration:- Leverages existing authentication and session management
- Integrates with current permission and role systems
- Uses established user and team membership APIs
- Maintains consistency with platform security model
- Builds on existing MCP server installation system
- Extends current team-based configuration management
- Integrates with established credential management
- Maintains compatibility with existing MCP workflows
- Uses existing structured logging infrastructure
- Integrates with current metrics collection system
- Leverages established alerting and notification systems
- Maintains consistency with platform observability
Development Implementation
Route Structure
Satellite communication endpoints are organized inservices/backend/src/routes/satellites/
:
Authentication Middleware
Satellite authentication uses dedicated middleware inservices/backend/src/middleware/satelliteAuthMiddleware.ts
:
Key Features:
- Argon2 hash verification for API key validation
- Satellite context injection for route handlers
- Dual authentication support (user cookies + satellite API keys)
- Comprehensive error handling and logging
Database Integration
The satellite system extends the existing database schema with 5 specialized tables: Schema Location:services/backend/src/db/schema.sqlite.ts
Table Relationships:
satellites
table links to existingteams
andauthUser
tablessatelliteProcesses
table referencesmcpServerInstallations
for team contextsatelliteCommands
table includes team context for command execution- All tables use existing foreign key relationships for data integrity
Configuration Query Implementation
The configuration endpoint implements complex queries to merge team-specific MCP server configurations: Query Strategy:- Join
mcpServerInstallations
,mcpServers
, andteams
tables - Global satellites: Query ALL team installations
- Team satellites: Query only specific team installations
- JSON field parsing with comprehensive error handling
Error Handling Patterns
Graceful Degradation:- Inactive satellites receive empty command arrays instead of 403 errors
- Invalid JSON configurations are skipped with warning logs
- Failed satellite authentication returns 401 with structured error messages
- Structured logging with operation identifiers
- Error context preservation for debugging
- Performance metrics collection (response times, success rates)
Development Workflow
Local Development Setup:- Start backend server
- Start satellite (automatically registers)
- Monitor logs for successful polling and configuration retrieval
- Use database tools to inspect satellite tables and command queue
API Documentation
For detailed API endpoints, request/response formats, and authentication patterns, see the API Specification generated from the backend OpenAPI schema.Related Documentation
For detailed satellite architecture and implementation:- Satellite Events - Real-time event processing system
- API Security - Security patterns and authorization
- Database Management - Schema and data management
- OAuth2 Server - OAuth2 implementation details