Repository navigation
Container image, compose file and deploy runbook for the IT-hosted instance - #14
Open
thefactremains wants to merge 1 commit into
Open
thefactremains wants to merge 1 commit into
thefactremains wants to merge 1 commit into
Conversation
One Docker image (Python 3.12 slim, non-root, MiniLM ONNX model baked in) runs ingest, the REST API and the streamable-http MCP server by command. docker-compose.yml wires api + mcp + a one-shot ingest job on one data volume with /health checks; DEPLOY.md covers env vars, ports, volume, outbound access, the path allowlist and the daily 03:00 UTC schedule. A GitHub Actions workflow publishes ghcr.io/percona-lab/percona-dk (:latest and :sha-<short>) on pushes to main. Code changes: - /health on both servers adds last_ingest and index_age_hours, read from the .last_ingest marker the MCP auto-refresh already uses. - MCP header logging now redacts credential headers and covers streamable-http (/mcp) as well as SSE. - REFRESH_DAYS=0 now disables MCP auto-refresh, as the README documents (it previously meant "always refresh"); compose relies on this. - README documents pointing the remote shim at a new PERCONA_DK_BACKEND. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
Everything Percona IT needs to run percona-dk behind the VPN on their own VM. IT handles the VM, reverse proxy, HTTPS, allowlist and
/healthmonitoring. This PR provides the image, compose file and runbook.Dockerfile:python:3.12-slim, installs the package plusgit, runs as non-rootapp(UID/GID 10001). Chroma's all-MiniLM-L6-v2 ONNX model is downloaded at build time into~/.cache/chroma/onnx_models, so containers never fetch it at runtime. One image, three roles by command: ingest, REST API (8000), MCP streamable-http (8402,/mcp). Chroma telemetry is off.docker-compose.yml:apiandmcpservices with/healthchecks, plus aningestservice in aningestprofile, sodocker compose updoesn't start it anddocker compose run --rm ingestdoes. All three share thepercona-dk-datavolume at/data.mcpgetsREFRESH_DAYS=0, because ingest runs on its own schedule. Logs rotate at 20 MB x 5..github/workflows/docker-publish.yml: builds on PRs without pushing. On pushes tomainit publishesghcr.io/percona-lab/percona-dk:latestand:sha-<short>.DEPLOY.md: environment variables (including the productionREPOSlist), ports, volume contents, image location, outbound access (github.com, percona.community, forums.percona.com, plus ghcr for pulls), the public path allowlist, the daily 03:00 UTC schedule as either a cron line or a systemd timer, monitoring thresholds, and a note that there are no secrets.PERCONA_DK_BACKEND(in the client'senvblock, since the shim doesn't read.env). The default backend is unchanged until IT gives the final hostname.Code changes
/healthon both the REST API and the MCP server now includeslast_ingest(UTC ISO 8601) andindex_age_hours. Both come from theDATA_DIR/.last_ingestmarker that the MCP auto-refresh already reads, and both arenullbefore the first ingest. The shared helper isshared.index_freshness._HeaderLogMiddlewareredactsAuthorization,Cookie,Set-Cookie,Proxy-Authorizationand any header withkeyortokenin its name. It now also wraps streamable-http (/mcp), not only SSE, through a newbuild_http_app(transport)./healthrequests are not logged.REFRESH_DAYS=0now disables MCP auto-refresh, as the README and.env.examplealready said. Before this change,days > 0was always true, so0meant "refresh on every startup". Compose depends on the fix.Ingestion logic and the index format are unchanged. Re-indexing still needs
docker compose restart api mcpafter ingest, and the schedule in DEPLOY.md does that. The separate hot-swap work will remove the restart.Verification
pytest: 97 passed. That is 89 hermetic tests, including 10 new ones intests/test_deploy.py, plustest_api.pyandtest_verify_ingestion.pyrun against a real index.docker buildsucceeds locally (arm64 via colima). With--network none, the container embeds and queries using the baked model.docker compose run --rm ingestwith one repo (percona/repo-config-docs), thendocker compose up -d. Both services reachedhealthy, and/healthreturnedlast_ingestandindex_age_hourson both ports.GET /searchreturned results. A real MCP client overhttp://localhost:8402/mcplisted the tools and ran a search. The container log showedauthorizationandx-api-keyas[REDACTED], the secret value appeared 0 times, and the log printedAuto-refresh disabled (REFRESH_DAYS=0).For the maintainer to check
REPOSlist in DEPLOY.md comes from the local DK.env. Please confirm it matches sherpa's.env./statson sherpa didn't return JSON when I tried.docker pullreturnsunauthorized, make the package public or give IT read access.linux/amd64only. Addlinux/arm64if IT's VM is ARM.🤖 Generated with Claude Code