Tim Baek 1af3e65003 Merge pull request #2 from westbrook-ai/k8s-improvements
Make Kubernetes operator backend production-ready
2026-03-08 04:06:11 +04:00
2026-03-06 16:24:03 -06:00
2026-03-06 16:24:03 -06:00
2026-02-28 02:25:07 -06:00
2026-03-07 12:55:40 -06:00
2026-03-07 12:55:40 -06:00
2026-02-28 02:25:07 -06:00
2026-03-07 13:03:09 -06:00
2026-03-07 12:55:40 -06:00

Terminals

Alpha – APIs and configuration may change.

Multi-tenant terminal orchestrator for Open Terminal. Provisions isolated terminal instances per user with automatic lifecycle management.

Getting Started

Install & Run

pip install -e .
terminals serve

The server starts on http://0.0.0.0:3000. An API key is auto-generated and printed to the console.

Docker

docker build -t terminals .
docker run -p 3000:3000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v $(pwd)/data:/app/data \
  terminals

Development

uv sync
./dev.sh  # uvicorn with --reload

Frontend (admin dashboard):

cd terminals/frontend
npm install && npm run dev

Usage

All Open Terminal endpoints are available under /terminals/. Include X-User-Id to identify the user.

export API_KEY="<api-key>"
export HEADERS=(-H "Authorization: Bearer $API_KEY" -H "X-User-Id: user-123")

curl -X POST http://localhost:3000/terminals/execute \
  "${HEADERS[@]}" -H "Content-Type: application/json" \
  -d '{"command": "echo hello"}'

curl http://localhost:3000/terminals/files/list "${HEADERS[@]}"

curl "http://localhost:3000/terminals/files/read?path=README.md" "${HEADERS[@]}"

Interactive terminal sessions connect via WebSocket at /terminals/api/terminals/{session_id}. Admins can manage tenants via /api/v1/tenants/.

Configuration

Settings are loaded from environment variables prefixed with TERMINALS_ (or a .env file).

Variable Default Description
TERMINALS_BACKEND docker docker, kubernetes, kubernetes-operator, local, static
TERMINALS_API_KEY (auto-generated) Bearer token for API auth
TERMINALS_OPEN_WEBUI_URL Open WebUI URL for JWT auth
TERMINALS_DATABASE_URL sqlite+aiosqlite:///./data/terminals.db SQLAlchemy async URL
TERMINALS_IMAGE ghcr.io/open-webui/open-terminal:latest Docker/K8s container image
TERMINALS_IDLE_TIMEOUT_SECONDS 1800 Stop idle instances (0 = disabled)
TERMINALS_PORT 3000 Server port

See config.py for the full list including Kubernetes, static backend, and encryption settings.

Authentication

Mode Trigger How it works
Open WebUI JWT Set TERMINALS_OPEN_WEBUI_URL Validates tokens against Open WebUI
API Key Set TERMINALS_API_KEY Static bearer token
Open Neither set No auth (development only)

Backends

  • docker – One container per user via Docker socket
  • kubernetes – Pod + PVC + Service per user via K8s API
  • kubernetes-operator – Delegates to a Kopf operator watching Terminal CRDs
  • local – Spawns open-terminal as a subprocess (dev/testing)
  • static – Proxies all users to a single pre-running instance

Database

SQLite works out of the box. For PostgreSQL:

pip install asyncpg
export TERMINALS_DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/terminals

Migrations run automatically on startup. Manual management:

terminals db upgrade          # run pending migrations
terminals db current          # show revision
terminals db revision -m "msg"  # create migration

License

Open WebUI Enterprise License

S
Description
Terminals is the enterprise orchestration layer for Open Terminal. https://docs.openwebui.com/ecosystem/open-terminal
Readme
2.7 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 94.6%
Svelte 3.5%
CSS 0.6%
Dockerfile 0.4%
Mako 0.3%
Other 0.6%