fs-docker¶
Run the app and the consumer agent in Docker behind a login page (Docker Desktop on a laptop, or a server): one call writes the folder, start and stop it, update, add environments.
name: "Feature Store: Docker deployment"
description: "Run the tdfs4ds app and consumer agent in Docker, on a laptop (Docker Desktop on Windows or macOS) or a server: one call writes a ready folder (tdfs4ds.create_docker_deployment), a login page asks for the environment (Teradata system) and the person's own credentials, start / stop / update / add an environment, and start and stop it from the Docker Desktop application. Invoke when the user wants the app or the assistant running in a container, wants to share it with colleagues, or asks how to stop, restart, update or remove it. SKIP when the agent must run as a hosted AI Studio service — use fs-deploy-agentops; SKIP for a chatbot in a notebook — use fs-agent."
argument-hint: "[folder][source: pypi|wheel|checkout]"
allowed-tools: "Read, Edit, Write, Bash, PowerShell, Glob, Grep"
Run the tdfs4ds admin app and consumer agent in Docker behind a login page. Each person picks an environment (a Teradata system), logs in with their own credentials, and works in an app process of their own.
User context: $ARGUMENTS
Related skills (call before / after this one)¶
| Step | Skill | Why |
|---|---|---|
| Before | fs-setup |
The store (tdfs4ds.setup()) must exist on each environment you offer. |
| Before | fs-document |
The assistant answers only from documented objects. |
| Before | fs-agent |
Check the models and the assistant in a session first; the folder copies the session's settings. |
| Instead | fs-deploy-agentops |
When the agent must be a hosted AI Studio service rather than a container you run. |
Docs: Deployment -> Docker with a login page and Docker: many users, many environments.
What you get¶
browser -> gateway :8000 (login page, environments, sessions)
|-- worker (jane @ production) own database connection, own settings
|-- worker (paul @ laboratory)
`-- chroma (vector index server, shared)
Two containers, one stack: tdfs4ds (the gateway and its workers) and chroma. The page is published on this computer only (127.0.0.1:8000).
1. Prerequisites (check, do not assume)¶
- Docker Desktop installed and the engine running ("Engine running" in its status bar). On Windows,
docker.exeis often not on PATH: it is in%LOCALAPPDATA%\Programs\DockerDesktop\resources\bin(or%ProgramFiles%\Docker\Docker\resources\bin). The generatedstart.ps1looks there itself. - Port 8000 free (
TDFS4DS_SERVE_PORTin.envchanges it). - A way to reach each Teradata system from this computer (VPN where needed): the container uses the computer's network.
- A model for the assistant, if you want chat answers (see step 2). The app itself works without.
$docker = "$env:LOCALAPPDATA\Programs\DockerDesktop\resources\bin\docker.exe"
& $docker version --format '{{.Server.Version}}' # fails when the engine is not running
Test-NetConnection 127.0.0.1 -Port 8000 -InformationLevel Quiet # False = free
2. Create the folder (one call)¶
Run it from a session where the models, the vector store and the store are configured, so the folder copies those settings. Database passwords are never written. Model keys are written only if you say so (include_secrets=True); otherwise the folder holds a placeholder and rep['missing'] names it.
import tdfs4ds
rep = tdfs4ds.create_docker_deployment(
"tdfs4ds-docker", # the folder; its name is the stack's name in Docker Desktop
environments=[
{"id": "lab", "label": "Laboratory", "host": "vantage-lab.example.com",
"logmechs": ["TD2"], "encrypt": True, "database": "FS_LAB"},
], # the current connection is added first when there is one
source="pypi", # 'wheel' for a version not on PyPI yet, 'checkout' for a source tree
prompt=False, # True asks the missing pieces (label, port, API key)
include_secrets=False, # model keys stay placeholders unless you consent
)
print(rep["problems"], rep["warnings"], rep["missing"])
Read warnings: no instruct model means the deployed chat will not answer; an unreachable host is a warning only. Command line equivalent: python -m tdfs4ds.deployment tdfs4ds-docker --source pypi.
Put the folder where it will stay (your user profile, not a temporary folder): Docker Desktop shows the stack under the folder's name, and ./state and ./config are read from it at every start.
3. Start it¶
cd tdfs4ds-docker
.\start.ps1 # finds docker.exe, builds, starts, waits for /health, opens the browser
.\start.ps1 -NoBrowser # do not open the page
.\start.ps1 -Check # also test port 1025 of every environment from inside the container
On Linux or macOS: ./start.sh (--check). The first build takes about 3.5 to 4 minutes (the image is 2.7 GB); later starts take seconds. Then open http://localhost:8000, choose the environment, log in.
4. Stop and start from Docker Desktop¶
After start.ps1, Docker Desktop's Containers tab shows a group named after the folder (tdfs4ds-docker) with two containers, tdfs4ds-1 and chroma-1.
- Stop the whole app: the group's Stop (square) button. Start it again: the group's Start (play) button. Both containers stop and start together; the page answers again within a few seconds (measured: 2 s), and the first login afterwards takes about 20 s while that person's worker connects.
- One container: the same buttons on a single row. If only
tdfs4ds-1is started, startchroma-1as well, or the assistant's search has no index. - Restart policy: the compose file sets
restart: unless-stopped. The stack starts again when Docker Desktop starts (after a reboot), except when you stopped it yourself: a stopped stack stays stopped until you start it. - After a stop and start, people log in again (sessions live in memory). What is kept: the saved environments (
state/environments.json), remembered credentials (volumetdfs4ds_secrets, key in the browser), the vector index (volumechroma_data). - Delete in Docker Desktop removes the containers; the data volumes remain unless you also delete them in the Volumes tab.
The same from a terminal, in the folder:
docker compose stop # = the Stop button
docker compose start # = the Start button
docker compose restart tdfs4ds
docker compose ps
docker compose logs -f tdfs4ds
5. Use it¶
- Environments:
config/environments.yaml(yours, read only) and the ones people add with New environment... on the login page (saved instate/environments.jsonafter a successful logon, never with a password). Edit either file; no restart needed forstate/,docker compose restart tdfs4dsforconfig/. - Remember my credentials (login form, unchecked by default): TD2 and LDAP only; encrypted password in a volume, key in that browser. Not for shared computers.
- Programs calling the assistant:
/v1withAuthorization: Bearer <key>: give an environmentapi_key_var,service_user_var,service_password_var(names of variables in.env), thenhttp://localhost:8000/env/<id>/v1/chat/completions. - Model API key: type it in the app (Parameters, admin profile): Instruct model / Embedding model, API key, Apply. The page never shows a key, only whether one is set; an empty field keeps the key in use. In Docker it is saved encrypted for everybody on the server (volume
tdfs4ds_secrets, key derived fromTDFS4DS_SERVE_SECRET), reaches the people logged in at once, and survives a restart. Or putTDFS4DS_INSTRUCT_MODEL_API_KEY=...in.envanddocker compose up -d(the container must be recreated, not only restarted); a key saved in the app wins over.env. - Full capabilities: a person without database roles (
TDFS4DS_ADMIN,TDFS4DS_ENGINEER,TDFS4DS_SCIENTIST) is an analyst and sees only the business pages. On your own computer setmin_profile: adminon the environments (orcreate_docker_deployment(..., min_profile="admin"), orTDFS4DS_SERVE_MIN_PROFILE=adminin.env). It decides what the app offers, not what the database allows. - Sharing with colleagues: the page is on
127.0.0.1only. Opening it needs TLS in front (a reverse proxy;TDFS4DS_SERVE_COOKIE_SECURE=true). A VS Code / dev tunnel suits a short pilot only (5 GB a month, preview service, may be blocked by company policy).
6. Update, change, remove¶
# new tdfs4ds version, or new settings from the session: regenerate in place
tdfs4ds.create_docker_deployment("tdfs4ds-docker", source="pypi", overwrite=True, prompt=False)
overwrite=True rewrites the generated files, patches your .env (your own lines, comments and the cookie secret are kept) and never touches state/. Then .\start.ps1 rebuilds with the new version.
| Want | Do |
|---|---|
| Stop, keep everything | Stop in Docker Desktop, or docker compose stop |
| Remove containers, keep data | docker compose down |
| Remove everything, data too | docker compose down -v (deletes the vector index and remembered credentials; state/ and config/ stay on disk) |
| Back to the single-process app | TDFS4DS_SERVE_MODE=single in .env: no login page, one connection from TDFS4DS_TD_* |
7. The same login page without Docker¶
python -m tdfs4ds.serve --login (no Docker needed; --min-profile admin, --no-browser, --port, --host): the gateway
on this computer, listening on 127.0.0.1, with the environments from ./environments.yaml|json or
~/.tdfs4ds/environments.* (else TDFS4DS_TD_HOST, plus New environment...), everything saved under
~/.tdfs4ds/serve. Stopping it stops every person's process.
8. When something is wrong¶
| Symptom | Cause | Action |
|---|---|---|
start.ps1: "Docker was not found" |
Docker Desktop not installed | install it |
| "The Docker engine does not answer" | Docker Desktop not running | start it, wait for "Engine running" |
port is already allocated |
something uses 8000 | stop it, or TDFS4DS_SERVE_PORT=8001 in .env |
Build fails at pip install behind a company proxy |
proxy variables | set HTTP_PROXY / HTTPS_PROXY in .env (the generator copies the session's) |
| Login: "unreachable" (503) | no network path to that system (VPN, system stopped) | trial systems stop by themselves: start the environment; .\start.ps1 -Check |
| Login: refused (401) | wrong credentials or logon mechanism not accepted | try another mechanism (logmechs of the environment) |
| Login works, chat says nothing / "Unsupported INSTRUCT_MODEL_PROVIDER" or "No API key" | no model or key | set them in Parameters (admin), or in .env + docker compose up -d |
| Only the business pages, no Parameters | profile analyst (no database roles) | min_profile: admin (see above). The feature store itself (and the read-only stores to also read from) can still be chosen by anybody in the header store button (each person has their own worker) |
| "server is full" at login | TDFS4DS_SERVE_MAX_WORKERS reached (default 8; a worker uses 300 to 500 MB) |
log someone out, or raise it and the Docker Desktop memory |
| A person's page stopped after a while | inactivity limit (30 min) or a worker died | log in again |
Page opens, /ui/... fails after editing config/ |
environments file error | the gateway log names the file and the problem: docker compose logs tdfs4ds |
Worker log lines (masked) appear in docker compose logs tdfs4ds; a worker that fails to start shows its last lines on the login page.
Rules¶
- Never put a database password in the folder. People type it on the login page. The only exception is the optional
/v1service account, which goes in.envunder the variable names the environment declares. - Keep the folder out of source control (
.gitignoreis generated):.envholds the cookie secret and any model key. - Do not open the port to the network without TLS.
- A running stack uses the folder's files: do not move or delete the folder while it runs; stop it first.