OpenStrate Mission Architecture
This document outlines the architecture and lifecycle of distributed missions in the OpenStrate ecosystem.
Overview
OpenStrate missions are the fundamental unit of work execution. A mission consists of code (mission.py), configuration (workflow.yaml), and dependencies (artifacts). The provisioning system ensures these components are securely packaged, distributed, and executed across a decentralized network of Satellites.
Architecture Components
The mission ecosystem relies on four key components:
1. OpenStrate CLI (ostr)
The Command Line Interface is the primary entry point for users. It handles:
- Initialization: Generating boilerplate mission files.
- Packaging: Uploading code and artifacts to the Relay.
- Orchestration: Sending deployment commands to Satellites via ZMQ.
- Monitoring: Querying Constellation for job status and retrieving results.
2. OpenStrate Relay (openstrate-relay)
The central artifact repository for the local environment.
- Artifacts API: Provides HTTP endpoints (
/api/artifacts) for storing and retrieving mission files. - Namespacing: Artifacts are scoped by
mission_idto prevent conflicts and ensure version consistency.
3. OpenStrate Constellation (openstrate-constellation)
The state management and discovery layer.
- Job Tracking: Maintains a centralized record of all jobs (
jobstable) and satellite assignments. - Service Discovery: Tracks active Satellites and their capabilities.
- Status Reporting: Receives updates from Satellites and serves them to the CLI.
4. OpenStrate Satellite (openstrate-satellite)
The compute node responsible for execution.
- Jail: Creates an isolated sandbox for each mission.
- Execution: Fetches artifacts from Relay, runs the mission code, and captures stdout/stderr.
- Result Handling: Scans the workspace for outputs and uploads them back to Relay.
Mission Lifecycle
The lifecycle of a mission follows a linear flow:
1. Provisioning
- User runs
ostr mission initto createmission.pyandworkflow.yaml. - User runs
ostr mission push. The CLI reads themission_idfromworkflow.yamland uploads files to Relay:OST_RELAY_URL/api/artifacts/missions/{mission_id}/mission.py
2. Deployment
- User runs
ostr mission deploy. - CLI queries Constellation for an available Satellite.
- CLI sends a ZMQ
deploycommand to the target Satellite, including themission_idand artifact URLs. - Satellite acknowledges and registers the job with Constellation as
pending.
3. Execution
- Satellite creates a "jail" (isolated directory).
- Satellite downloads the mission artifacts from Relay.
- Satellite updates job status to
running. - Satellite executes the entry point command (e.g.,
python mission.py).
4. Collection
- Upon completion, Satellite scans the workspace for generated files.
- Satellite uploads these outputs to Relay under the job namespace:
OST_RELAY_URL/api/artifacts/jobs/{job_id}/results.txt
- Satellite updates job status to
completedin Constellation, listing the output artifacts. - Satellite cleans up the jail.
5. Retrieval
- User runs
ostr mission results <job_id>. - CLI queries Constellation for the list of output artifacts.
- CLI downloads the files from Relay to the user's local machine.