Skip to content

Installation and Deployment

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

Installation & Deployment

Ways to run

Mode Best for Command
Hosted demo looking at the UI without installing anything duedil-agent.streamlit.app
Published image running the current release without building docker run --rm -p 8501:8501 ghcr.io/sergeyger/duedil-agent:latest
Docker Compose a demo in one command from a clone docker compose up --build
Docker, offline demo seeing the pipeline with no keys and no cost docker run --rm -p 8501:8501 -e DUEDIL_MODE=demo-ui ghcr.io/sergeyger/duedil-agent:latest
Local virtualenv development, running the tests python -m venv .venv && pip install -r requirements.txt
Package install using duedil as a CLI tool pip install -e ".[dev]"

Tags published for each release

.github/workflows/docker.yml builds linux/amd64 and linux/arm64 and pushes a multi-arch manifest on every v*.*.* tag:

Tag Meaning
0.2.0 exact release
0.2 latest patch of that minor line
0, latest latest stable release
edge head of a branch, published only by a manual workflow_dispatch run

The same workflow smoke-tests the image it just published: it starts it and waits for Docker's HEALTHCHECK (Streamlit's /_stcore/health) to report healthy, so a broken image fails the release instead of reaching users. GitHub Packages storage and Actions minutes are free for public repositories, and the build cache is reused between runs.

Several developers on one server

One checkout cannot serve two people: the compose project name, the host port and the working tree would all be shared. Each developer therefore gets their own clone, plus their own instance settings:

./scripts/project.sh instance auto        # -> duedil-agent-<user>, first free port
./start.sh                                # prints the address, e.g. http://localhost:8502

instance auto writes COMPOSE_PROJECT_NAME and DUEDIL_PORT into .env, which namespaces the containers, the network and the data volume, and picks a free host port. Explicit names are always prefixed with duedil-agent-, so they cannot collide with an unrelated compose project on the same Docker host. container_name is deliberately absent from docker-compose.yml for the same reason.

The published port binds to 127.0.0.1 by default (DUEDIL_BIND). Remote access goes through an SSH tunnel or VS Code's port forwarding; DUEDIL_BIND=0.0.0.0 exposes it deliberately.

The files git does not carry

.env (API keys) and Run_Stop_Project.docx (the personal guide) are gitignored on purpose, so git pull never moves them. scripts/personal-sync.sh covers that gap with plain scp, which exists on Linux, macOS and Windows 10+:

./scripts/personal-sync.sh status    # what differs, copies nothing
./scripts/personal-sync.sh pull      # server -> this checkout
./scripts/personal-sync.sh push      # this checkout -> server

Target overrides: DUEDIL_SERVER, DUEDIL_USER, DUEDIL_REMOTE_DIR. pull backs up an existing .env before overwriting it, and both commands leave .env at mode 600.

Starting and stopping the local stack

Nothing in this project starts by itself. Both compose services declare restart: "no", so after a server reboot — or a Docker daemon restart — the containers stay down until someone asks for them. That is deliberate: a development stack should not hold port 8501 (or memory) while another project is being worked on.

Platform Start Stop Status
Linux / macOS / WSL ./start.sh ./stop.sh ./scripts/project.sh status
Windows PowerShell .\start.cmd .\stop.cmd .\scripts\project.ps1 status

scripts/project.sh and scripts/project.ps1 expose the same commands (start, stop, restart, status, logs, build, rebuild, shell, cli, clean, autostart), and the one-line wrappers in the repository root simply forward to them, so nobody has to type a path twice. Compose runs under the fixed project name duedil-agent, which keeps this stack's containers, network and volumes separate from every other project on the machine.

Verified behaviour (worth knowing before trusting it): restarting the Docker daemon with the stack up leaves the container Exited (0) and it does not come back. Stopping frees the port, and the generated memos survive in the duedil-agent_duedil-data volume.

./scripts/project.sh autostart off additionally disables the Docker daemon itself at boot, for a machine where Docker should only run on demand. The trade-off is that sudo systemctl start docker becomes a manual step after every reboot.

VS Code dev container

.devcontainer/devcontainer.json points at the compose service ui, so Dev Containers: Reopen in Container builds and starts exactly what the rest of the project deploys: the same image, the same pinned dependencies, the same non-root user duedil, with the repository bind-mounted at /app. Nothing needs to be installed on the host beyond Docker and the extension.

  • overrideCommand: false — the service keeps its own command, so the app is served on http://localhost:8501 while the container is open.
  • shutdownAction: stopCompose — closing the window stops the containers, which is what you want when switching to another project.
  • postCreateCommand creates /app/.venv with --system-site-packages and installs only ruff: pytest and pytest-cov already come from requirements.txt inside the image, so those pins stay the single source of truth. The venv lives in the workspace and is gitignored.
  • Port 8501 is forwarded automatically. It is the same port the scripts publish, so the two ways of running the project must not be used at the same time.

Stopping the stack while attached to the container. The dev container is the ui service, so it cannot remove itself: the Docker CLI is not installed inside it and the socket is not mounted. Three ways work, in order of convenience:

  1. Command Palette → Dev Containers: Reopen Folder Locally — VS Code stops the compose project as it detaches, and you are back on the host;
  2. run ./stop.sh (or .\stop.cmd) from a terminal on the host, not from the container;
  3. close the VS Code window — shutdownAction: stopCompose stops the project.

Mounting /var/run/docker.sock would make docker compose down work from inside, at the cost of giving the container control over every container on the machine — and it would still terminate the session issuing the command, which is why it is not configured.

The hosted demo

Streamlit Community Cloud deploys straight from main with app/ui.py as the entry point. It has no secrets configured on purpose: without keys, PDF parsing falls back to the local pypdf extractor, the agents run against a deterministic snapshot, and the pipeline still produces a memo — so anyone can click it and it costs nothing. Apps without traffic for 12 hours hibernate and wake on the next visit; the resource limits (~2 cores, 2.7 GB) leave comfortable headroom.

Because no keys are configured, the app runs its rule-based offline agents rather than calling a model it cannot reach — see What the app does when there are no API keys in Interfaces — so each example deck still gets its own analysis, and every artefact says that no model ran.

A visitor rarely has a pitch deck to hand, so the sidebar's 📂 Browse examples/ button opens a dialog listing the five bundled decks (examples/*.pdf): the demo runs in three clicks, and picking a deck fills in the matching website URL. Those decks are reconstructions from public reporting — the dialog says so and each deck prints its sources on its last page, which matters when the demo is the first thing a stranger sees.

Prerequisites

Requirement Notes
Python 3.11+ (3.12 recommended) CI covers 3.11, 3.12 and 3.13
Docker 24+ only for the container paths
OPENAI_API_KEY or ANTHROPIC_API_KEY without one the pipeline runs but produces the deterministic fallback memo
LLAMA_CLOUD_API_KEY optional; PDF parsing falls back to local pypdf
TAVILY_API_KEY optional; without it no external verification happens

Windows note: if the install path is long, enable Long Paths (LongPathsEnabled=1), otherwise packages such as llama-index-core fail to install.

Docker

Image design

Aspect Decision
Base python:3.12-slim, two stages
Stage 1 builds wheels for the pinned requirements.txt — keeps the compiler toolchain out of the final image
Stage 2 installs those wheels only, then copies app/, scripts/, examples/, .streamlit/
User non-root duedil (UID 10001); HOME=/app
Writable path /app/data, owned by that user
Healthcheck stdlib urllib against http://127.0.0.1:8501/_stcore/health, --start-period=20s
Entry point app/streamlit_app.py — real UI by default, offline demo when DUEDIL_MODE=demo-ui
Secrets .dockerignore excludes .env and .git-token, so they can never land in a layer

Resulting image: 1.5 GB, healthy in ≈10 s, hadolint clean.

Compose services

services:
  ui:                     # port 8501, named volume duedil-data → /app/data
    env_file: [{ path: .env, required: false }]
  cli:                    # profile "cli", entrypoint: python -m app.cli
    profiles: ["cli"]

required: false is intentional: the stack must boot without a .env, because "no keys" is a supported mode (graceful degradation), not an error.

docker compose up --build                 # UI on http://localhost:8501
docker compose run --rm cli examples/sample_deck.pdf https://nimbusai.example

Volumes and permissions

The container runs as UID 10001, so a root-owned bind mount is not writable. Two supported options:

# a) named volume (default in compose) — the container owns /app/data
docker compose up

# b) bind mount — run as your own UID so files are not left root-owned
mkdir -p data
docker run --rm -u "$(id -u):$(id -g)" --env-file .env \
    -v "$PWD/data:/app/data" -v "$PWD/examples:/app/examples:ro" \
    duedil-agent:latest python -m app.cli examples/sample_deck.pdf https://nimbusai.example

Local installation

git clone https://github.com/SergeyGer/duedil-agent.git
cd duedil-agent

python -m venv .venv
source .venv/bin/activate          # Windows: .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt    # exact, reproducible pins

requirements.txt is a pip freeze lockfile; pyproject.toml declares the high-level, unbounded dependencies. Use the lockfile for reproducibility and pip install -e ".[dev]" if you want the package plus the dev tooling (pytest, ruff, pre-commit).

Make targets

Target Effect
make install create .venv and install the lockfile
make test / make cov pytest / pytest with a coverage report
make lint / make fmt ruff check . / ruff format .
make run Streamlit UI (app/ui.py)
make demo offline pipeline run, writes data/nimbusai_memo.pdf
make docker-build / docker-run / docker-demo / docker-cli the four container workflows

Continuous integration

Workflow Trigger What it does
ci.yml push to main, every PR tests on Python 3.11/3.12/3.13 with coverage, ruff check, ruff format --check, all pre-commit hooks
codeql.yml push, PR, weekly cron CodeQL security-and-quality for Python and the GitHub Actions workflows, SARIF → code scanning
coverage.yml push to main regenerates coverage.svg and offers it as an auto-merge pull request
release.yml tag v*.*.* verifies tag ↔ pyproject.toml, builds sdist + wheel, publishes a GitHub Release, optional PyPI publish via Trusted Publishing

Branch protection on main requires a pull request plus the Tests (…) and Lint (ruff) status checks, so nothing reaches main without them.

Releasing

# 1. bump version in pyproject.toml + add a CHANGELOG entry
# 2. commit and push to main
git tag -a v0.2.0 -m "Release v0.2.0"
git push origin v0.2.0

The workflow fails fast if the tag and the package version disagree, so a mismatch cannot produce a release. Tags containing -rc, -beta or -alpha become pre-releases.

Optional PyPI publishing uses OIDC (pypa/gh-action-pypi-publish), enabled by setting the repository variable PUBLISH_TO_PYPI=true; no long-lived token is stored.

Production considerations

Topic Guidance
Scaling The UI is stateless; run several replicas behind a proxy (Streamlit needs WebSocket support).
Secrets Inject via the platform's secret store; .env is a local-development convenience.
Data retention Uploaded decks and memos live in /app/data; nothing is sent anywhere except the configured LLM, LlamaParse, Tavily and LangSmith endpoints.
Cost control Cost per run is bounded by the graph (MAX_CRITIC_LOOPS = 2); disable LangSmith tracing to avoid the extra span volume.
Keys Prefer a workspace-scoped service key for the app rather than a personal token — see Configuration.

Last reviewed: 2026-10-23 · Owner: @SergeyGer

Clone this wiki locally