-
Notifications
You must be signed in to change notification settings - Fork 277
docs: add docker compose quickstart #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e441546
upgrade docker/README.md with docker compose V2 quick start guide
JaredforReal f0518a3
add docker-quickstart doc
JaredforReal dd5f514
remove docker dir & rerank docker-quickstart in sidebar
JaredforReal 59a575c
add install docker compose v2 section
JaredforReal d3ebe32
change title
JaredforReal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,58 +1,113 @@ | ||
| # Docker Compose Quick Start Guide | ||
| # Docker Compose (v2) Quick Start Guide | ||
|
|
||
| This Docker Compose configuration allows you to quickly run Semantic Router + Envoy proxy locally. | ||
| Run Semantic Router + Envoy locally using Docker Compose v2. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Docker and Docker Compose | ||
| - Ensure ports 8801, 50051, 19000 are not in use | ||
| - Docker Engine and Docker Compose v2 (use the `docker compose` command, not the legacy `docker-compose`) | ||
| - Ensure ports 8801, 50051, 19000 are free | ||
|
|
||
| ## Install in Docker Compose | ||
| ## Install and Run with Docker Compose v2 | ||
|
|
||
| 1. **Clone the repository and navigate to the project directory** | ||
| 1) Clone the repo and move into it (from your workspace root): | ||
|
|
||
| ```bash | ||
| git clone https://github.com/vllm-project/semantic-router.git | ||
| cd semantic_router | ||
| ``` | ||
| ```bash | ||
| git clone https://github.com/vllm-project/semantic-router.git | ||
| cd semantic-router | ||
| ``` | ||
|
|
||
| 2. **Download required models** (if not already present): | ||
| 2) Download required models (classification models): | ||
|
|
||
| ```bash | ||
| make download-models | ||
| ``` | ||
|
|
||
| ```bash | ||
| make download-models | ||
| ``` | ||
| This downloads the classification models used by the router: | ||
|
|
||
| This will download the necessary ML models for classification: | ||
| - Category classifier (ModernBERT-base) | ||
| - PII classifier (ModernBERT-base) | ||
| - Jailbreak classifier (ModernBERT-base) | ||
| - Category classifier (ModernBERT-base) | ||
| - PII classifier (ModernBERT-base) | ||
| - Jailbreak classifier (ModernBERT-base) | ||
|
|
||
| 3. **Start the services using Docker Compose** | ||
| Note: The BERT similarity model defaults to a remote Hugging Face model. See Troubleshooting for offline/local usage. | ||
|
|
||
| ```bash | ||
| # Start core services (semantic-router + envoy) | ||
| docker-compose up --build | ||
| 3) Start the services with Docker Compose v2: | ||
|
|
||
| # Or run in background | ||
| docker-compose up --build -d | ||
| ```bash | ||
| # Start core services (semantic-router + envoy) | ||
| docker compose up --build | ||
|
|
||
| # Start with testing services (includes mock vLLM) | ||
| docker-compose --profile testing up --build | ||
| ``` | ||
| # Or run in background (recommended) | ||
| docker compose up --build -d | ||
|
|
||
| 4. **Verify the installation** | ||
| - Semantic Router: http://localhost:50051 (gRPC service) | ||
| - Envoy Proxy: http://localhost:8801 (main endpoint) | ||
| - Envoy Admin: http://localhost:19000 (admin interface) | ||
| # With testing profile (includes mock vLLM) | ||
| docker compose --profile testing up --build | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
| 4) Verify | ||
|
|
||
| ### 1. Build and Start Services | ||
| - Semantic Router (gRPC): localhost:50051 | ||
| - Envoy Proxy: http://localhost:8801 | ||
| - Envoy Admin: http://localhost:19000 | ||
|
|
||
| ## Common Operations | ||
|
|
||
| ```bash | ||
| # Start core services (semantic-router + envoy) | ||
| docker-compose up --build | ||
| # View service status | ||
| docker compose ps | ||
|
|
||
| # Follow logs for the router service | ||
| docker compose logs -f semantic-router | ||
|
|
||
| # Exec into the router container | ||
| docker compose exec semantic-router bash | ||
|
|
||
| # Stop and clean up containers | ||
| docker compose down | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### 1) Router exits immediately with a Hugging Face DNS/download error | ||
|
|
||
| Symptoms (from `docker compose logs -f semantic-router`): | ||
|
|
||
| ``` | ||
| Failed to initialize BERT: request error: https://huggingface.co/... Dns Failed: resolve dns name 'huggingface.co:443' | ||
| ``` | ||
|
|
||
| Why: `bert_model.model_id` in `config/config.yaml` points to a remote model (`sentence-transformers/all-MiniLM-L12-v2`). If the container cannot resolve or reach the internet, startup fails. | ||
|
|
||
| Fix options: | ||
|
|
||
| - Allow network access in the container (recommended): | ||
| - Ensure your host can resolve DNS, or add DNS servers to the `semantic-router` service in `docker-compose.yml`: | ||
|
|
||
| ```yaml | ||
| services: | ||
| semantic-router: | ||
| # ... | ||
| dns: | ||
| - 1.1.1.1 | ||
| - 8.8.8.8 | ||
| ``` | ||
|
|
||
| - If behind a proxy, set `http_proxy/https_proxy/no_proxy` env vars for the service. | ||
|
|
||
| - Use a local copy of the model (offline): | ||
| 1. Download `sentence-transformers/all-MiniLM-L12-v2` to `./models/sentence-transformers/all-MiniLM-L12-v2/` on the host. | ||
| 2. Update `config/config.yaml` to use the local path (mounted into the container at `/app/models`): | ||
|
|
||
| ```yaml | ||
| bert_model: | ||
| model_id: "models/sentence-transformers/all-MiniLM-L12-v2" | ||
| threshold: 0.6 | ||
| use_cpu: true | ||
| ``` | ||
|
|
||
| 3. Recreate services: `docker compose up -d --build` | ||
|
|
||
| ### 2) Port already in use | ||
|
|
||
| Make sure 8801, 50051, 19000 are not bound by other processes. Adjust ports in `docker-compose.yml` if needed. | ||
|
|
||
| # Or run in background | ||
| docker-compose up --build -d | ||
| ``` | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.