Resource leasing platform

Atropos

Lease GPUs, licenses and test environments without double-booking.

A strictly consistent resource leasing and capacity orchestration platform. Teams allocate, reserve and govern scarce shared resources with linearizable guarantees: a request either gets everything it asked for, or waits without holding anything.

  • Rust
  • tokio
  • PostgreSQL
  • sqlx
  • Axum (REST)
  • tonic (gRPC)
  • Docker
License: MIT
POST /leases
{
  "pool_type": "A100-Cluster",
  "owner_id": "team-alpha",
  "tenant_id": "project-omega",
  "ttl_seconds": 3600,
  "priority": 100,
  "waitlist": true,
  "idempotency_key": "retry-safe-key"
}

What it does

01

Atomic workload bundles

Lease a machine, devices and license tokens together. The request gets every resource in one transaction or waits without holding capacity.

02

Zero double-bookings

Allocation runs on PostgreSQL SELECT FOR UPDATE SKIP LOCKED, so concurrent requests never receive the same resource.

03

Fair sharing

Weighted tenant quotas with hard and soft limits, pool capacity caps, and opt-in priority preemption.

04

Waitlists and reservations

Full pools queue requests with priority aging against starvation; future reservations turn into real leases when due.

05

Retry-safe API

Requests carrying the same idempotency key return the original lease instead of creating a duplicate.

06

Reliable events

A transactional outbox with retries and dead-lettering delivers HMAC-signed webhooks for every grant and revocation.

How it's built

Domain-Driven Design with a hexagonal (ports and adapters) structure:

  1. Domain

    Pools, resources and leases with pure business rules and repository traits; no framework dependencies.

  2. Application

    Allocation and platform services, plus background reaper, maintenance, outbox and reservation services.

  3. Infrastructure

    PostgreSQL implementations of the repository traits, where the atomic concurrency logic lives.

  4. API

    REST (Axum) and gRPC (tonic) entry points with optional bearer-token authentication.

Engineering highlights

  • Decisions are recorded as Architecture Decision Records, from "why Postgres SKIP LOCKED" to the background reaper.
  • Lease heartbeats detect zombie leases; degraded hardware is drained automatically.
  • Utilization snapshots and cost reports per tenant or cost center.
  • Ships with a disaster recovery runbook and a deployment and scaling guide.

Quick start

Terminal
git clone https://github.com/esgaltur/atropos.git
cd atropos
docker-compose -f infra/docker-compose.yml up -d
cp .env.example .env
sqlx migrate run --source infra/migrations
cargo run

The full documentation is in the repository on GitHub.

More projects