Skip to content

Quick Start

  • Linux - tenement uses Linux-specific features (namespaces, cgroups)
  • Rust toolchain - for installation via cargo
  • Your app - must listen on the PORT environment variable
Terminal window
cargo install tenement-cli

Verify installation:

Terminal window
ten --version

Let’s run a Python app with tenement. This example uses FastAPI but any HTTP server works.

Create app.py:

import os
from fastapi import FastAPI
import uvicorn
app = FastAPI()
@app.get("/")
def root():
return {"message": "Hello from tenement!"}
@app.get("/health")
def health():
return {"status": "ok"}
if __name__ == "__main__":
port = int(os.getenv("PORT", "8000"))
uvicorn.run(app, host="127.0.0.1", port=port)

Create tenement.toml:

[service.api]
command = "uv run python app.py"
health = "/health"

That’s it! Tenement auto-allocates a port and sets the PORT environment variable.

Terminal window
ten serve --port 8080 --domain localhost

In another terminal:

Terminal window
ten spawn api --id prod
Terminal window
# Direct access via subdomain
curl http://prod.api.localhost:8080/
# {"message": "Hello from tenement!"}
# Health check
curl http://prod.api.localhost:8080/health
# {"status": "ok"}
# List instances
ten ps
# INSTANCE SOCKET UPTIME HEALTH WEIGHT
# api:prod /tmp/tenement/api-prod.sock 2m healthy 100
Terminal window
ten stop api:prod
  • Service: A template defining how to run your app ([service.api])
  • Instance: A running copy of a service with an ID (api:prod, api:staging)
  • PORT: Auto-set environment variable your app should listen on
  • Health check: HTTP endpoint tenement polls to verify your app is running
  1. Listen on PORT: Read PORT from environment, don’t hardcode
  2. Health endpoint: Return HTTP 200 at /health (or your configured path)
  3. Bind to 127.0.0.1: Not 0.0.0.0 (tenement handles external access)