Add Docker setup with PG and MCP servers#99
Conversation
- Dockerfile: Multi-stage build with all database drivers and optional dependencies (serve, mcp, all-databases). 781MB runtime image. - docker-entrypoint.sh: Single container with SIDEMANTIC_MODE env var to control serve/mcp/both modes - .dockerignore: Excludes unnecessary files for faster builds - Add --host parameter to sidemantic serve CLI and config for container networking (0.0.0.0 support) - README: Comprehensive Docker usage section with examples Server fully tested: psql connections work, semantic layer tables queryable, demo mode verified.
Builds the image, starts the PG server in demo mode, and runs psql queries to verify semantic layer tables are accessible.
Replace passthrough SELECT * queries with GROUP BY queries that exercise metric computation (product_count, avg_price, customer_count).
Pushes sidequery/sidemantic:latest and :version tags on main after tests pass. Uses GHA build cache and buildx. Requires DOCKERHUB_USERNAME and DOCKERHUB_TOKEN repo secrets.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83fac25c84
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
docker-entrypoint.sh
Outdated
| exec sidemantic serve --host 0.0.0.0 $ARGS $SERVE_ARGS "$@" | ||
| ;; | ||
| mcp) | ||
| exec sidemantic mcp-serve $ARGS "$@" |
There was a problem hiding this comment.
Stop forwarding unsupported connection args to mcp-serve
In mcp mode (and also both mode), the entrypoint forwards $ARGS to sidemantic mcp-serve; when SIDEMANTIC_CONNECTION is set this injects --connection, but mcp_serve only accepts directory, --db, and --demo (sidemantic/cli.py), so startup fails with a CLI option error. This makes MCP/both container runs fail as soon as users configure a backend connection via environment variables.
Useful? React with 👍 / 👎.
docker-entrypoint.sh
Outdated
|
|
||
| case "$MODE" in | ||
| serve) | ||
| exec sidemantic serve --host 0.0.0.0 $ARGS $SERVE_ARGS "$@" |
There was a problem hiding this comment.
Quote entrypoint arguments to avoid shell splitting
The command expands $ARGS and $SERVE_ARGS unquoted, so values from environment variables are subject to shell word splitting and metacharacter handling; connection strings and credentials commonly contain characters like & or spaces, which can turn into broken/misaligned CLI arguments at runtime. This can make valid SIDEMANTIC_CONNECTION/auth values fail unpredictably in Docker deployments.
Useful? React with 👍 / 👎.
No longer triggers on every push/PR. Runs automatically after a successful PyPI publish, or manually via workflow_dispatch.
Quote all env var expansions to handle special characters in connection strings and credentials. Only pass --db to mcp-serve (it doesn't accept --connection, --username, --password, or --port).
Summary
Docker setup for sidemantic with a single container supporting multiple server modes. Includes PostgreSQL wire protocol server (for BI tools) and MCP server (for AI/LLM integration).
SIDEMANTIC_MODEenv var (serve/mcp/both)--hostflag onsidemantic servefor container networking (0.0.0.0)