Skip to content

Deployment

Sergey Gerasimov edited this page Oct 23, 2026 · 6 revisions

Deployment

Deployment topology

flowchart TB
    DEV[Pull request] --> RULES[Protect Main ruleset]
    RULES --> CI[CI + CodeQL + Docs]
    CI --> MAIN[Merge to main]
    MAIN --> IMG[GHCR multi-arch image]
    MAIN --> CLOUD[Streamlit Community Cloud]
    IMG --> LOCAL[docker run]
    LOCAL --> APP[Streamlit app]
    CLOUD --> APP
    APP --> SEED[Bundled seed]
    APP --> LM[Deterministic local models]
    APP -. optional .-> LLM[OpenAI / Anthropic]
Loading

In plain English: every route ends at the same app; the only difference is how it is hosted. The app always has a local path and an optional model path.

One-command GHCR image

docker run --rm -p 8501:8501 ghcr.io/sergeyger/derivlab:latest

The Publish image workflow builds linux/amd64 and linux/arm64, tags latest, the release version, and sha-<short>, and pushes to GHCR. View the GHCR package. The image contains the seed and local AI models; no API key is required.

Streamlit Community Cloud

Live demo: https://derivlab-pavyratzrx7won9iv4zmcg.streamlit.app/

The README's Try the offline demo button prefills the official deploy page with this repository, main, and app.py. The owner authorizes the first deploy; the app then runs without keys because the AI Arena falls back locally.


Docker Compose

docker compose up -d --build

Services:

Service Purpose
derivlab-app Streamlit app on port 8501; restart: "no"
derivlab-seed Optional profile seed; refreshes the cache; restart: "no"

The app uses the bundled seed and a named cache volume. It does not start automatically when the server reboots.


Configuration

Copy .env.example to .env for local overrides. Compose reads .env for substitution. Recreate after changes:

docker compose up -d --force-recreate

Do not commit .env or .git-token. See Security.


Health and logs

curl -fsS http://127.0.0.1:8501/_stcore/health
docker inspect derivlab-app --format '{{.State.Health.Status}}'
docker compose logs -f derivlab-app

Data refresh

docker compose run --rm derivlab-seed

Or use Data Vault → Refresh all (5Y).


Ports and bind address

DERIVLAB_PORT=8502 docker compose up -d
DERIVLAB_BIND_ADDR=0.0.0.0 docker compose up -d

For LAN access, place the app behind a reverse proxy with authentication. The default bind is loopback.


Dev Containers

Open the repository in VS Code and choose Dev Containers: Reopen in Container. The container uses Python 3.11, forwards 8501, installs dependencies, and stops when the window closes.


Production notes

  • Use Docker secrets or a runtime secret manager for the LLM key; environment variables are visible to docker inspect.
  • Put the app behind TLS and authentication for shared deployments.
  • Pin the image tag (derivlab:1.2.0) rather than relying on a floating tag.
  • Keep restart: "no" unless your platform explicitly requires a supervised restart policy.
  • Monitor outbound calls to the LLM provider for cost and latency.

Reset

docker compose down -v   # removes the named cache volume
docker compose up -d --build

Clone this wiki locally