| Crates.io | runtara-environment |
| lib.rs | runtara-environment |
| version | 1.4.1 |
| created_at | 2025-12-30 07:03:00.811526+00 |
| updated_at | 2026-01-10 20:16:53.938377+00 |
| description | Environment server for runtara - image registry, OCI runner, and instance management |
| homepage | |
| repository | https://github.com/runtara/runtara |
| max_upload_size | |
| id | 2012205 |
| size | 670,825 |
Instance lifecycle management for Runtara. Handles image registration, OCI container execution, and wake scheduling for durable workflows.
This crate is the control plane for the Runtara platform, providing:
┌─────────────────────────────────────────────────────────────────────────┐
│ External Clients │
│ (runtara-management-sdk, CLI) │
└─────────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ runtara-environment (This Crate) │
│ Port 8002 │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Image │ │ Instance │ │ Wake │ │ Container │ │
│ │ Registry │ │ Lifecycle │ │ Scheduler │ │ Runner │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
│ │ │
│ │ Proxy signals │ Spawn
│ ▼ ▼
│ ┌───────────────────┐ ┌─────────────────────────┐
│ │ runtara-core │◄───────│ Workflow Instances │
│ │ Port 8001 │ │ (OCI containers) │
│ └───────────────────┘ └─────────────────────────┘
│ │
▼ ▼
┌───────────────────────────────────────────────────────────────────────┐
│ PostgreSQL │
│ (Images, Instances, Checkpoints, Events) │
└───────────────────────────────────────────────────────────────────────┘
# Set required environment variables
export RUNTARA_DATABASE_URL=postgres://user:pass@localhost/runtara
# Run the server
cargo run -p runtara-environment
External clients connect via QUIC using runtara-management-sdk. The protocol supports:
| Operation | Description |
|---|---|
RegisterImage |
Register a new image (single-frame upload < 16MB) |
RegisterImageStream |
Register a large image via streaming upload |
ListImages |
List images with optional tenant filter and pagination |
GetImage |
Get image details by ID |
DeleteImage |
Delete an image |
| Operation | Description |
|---|---|
StartInstance |
Start a new instance from an image |
StopInstance |
Stop a running instance with grace period |
ResumeInstance |
Resume a suspended instance |
GetInstanceStatus |
Query instance status |
ListInstances |
List instances with filtering and pagination |
| Operation | Description |
|---|---|
SendSignal |
Send cancel/pause/resume signal to instance |
Signals are proxied to runtara-core which stores them for the instance to poll.
Environment supports multiple execution backends:
| Runner | Description |
|---|---|
| OCI (default) | Execute in OCI containers via crun |
| Mock | In-memory testing runner |
The OCI runner:
Instance I/O is exchanged via files:
{DATA_DIR}/{tenant_id}/runs/{instance_id}/input.json{DATA_DIR}/{tenant_id}/runs/{instance_id}/output.jsonThe wake scheduler handles durable sleep:
sleep_until in the pastThis enables workflows to sleep for hours/days without holding resources.
| Variable | Required | Default | Description |
|---|---|---|---|
RUNTARA_DATABASE_URL |
Yes | - | PostgreSQL connection string |
RUNTARA_ENV_QUIC_PORT |
No | 8002 |
Environment QUIC server port |
RUNTARA_CORE_ADDR |
No | 127.0.0.1:8001 |
Address of runtara-core |
DATA_DIR |
No | .data |
Data directory for images and bundles |
RUNTARA_SKIP_CERT_VERIFICATION |
No | false |
Skip TLS verification (passed to instances) |
| Variable | Required | Default | Description |
|---|---|---|---|
BUNDLES_DIR |
No | ${DATA_DIR}/bundles |
Directory for OCI bundles |
EXECUTION_TIMEOUT_SECS |
No | 300 |
Default execution timeout in seconds |
USE_SYSTEMD_CGROUP |
No | false |
Use systemd for cgroup management |
Environment shares the database with runtara-core. It manages:
instance_images: Maps instances to their source imagesMigrations are in migrations/.
Migrations run automatically on server startup. For manual migration:
sqlx migrate run --source crates/runtara-environment/migrations
# Run unit tests
cargo test -p runtara-environment
# Run with database (integration tests)
TEST_DATABASE_URL=postgres://... cargo test -p runtara-environment
| Module | Description |
|---|---|
config |
Server configuration from environment variables |
db |
PostgreSQL persistence for images and instances |
handlers |
Environment protocol request handlers |
image_registry |
Image storage and retrieval |
container_registry |
Running container tracking |
instance_output |
Reading output.json from completed instances |
runner |
Container/process execution backends |
server |
QUIC server implementation |
wake_scheduler |
Durable sleep wake scheduling |
runtara-core - Checkpoint and signal persistenceruntara-management-sdk - Client SDK for management operationsruntara-protocol - Wire protocol definitionsruntara-dsl - DSL types for agent metadataThis project is licensed under AGPL-3.0-or-later.