Skip to content

Commit

Permalink
docs: add deployment how-to for Docker Compose (#309)
Browse files Browse the repository at this point in the history
Fixes #288

---------

Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
  • Loading branch information
sujithrpillai and kurtisvg authored Feb 28, 2025
1 parent 584c8ae commit 1cba482
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 9 deletions.
106 changes: 106 additions & 0 deletions docs/en/how-to/deploy_docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
title: "Deploy using Docker Compose"
type: docs
weight: 3
description: >
How to deploy Toolbox using Docker Compose.
---

<!-- Contributor: Sujith R Pillai <sujithrpillai@gmail.com> -->


## Before you begin

1. [Install Docker Compose.](https://docs.docker.com/compose/install/)

## Configure `tools.yaml` file

Create a `tools.yaml` file that contains your configuration for Toolbox. For
details, see the
[configuration](https://github.com/googleapis/genai-toolbox/blob/main/README.md#configuration)
section.

## Deploy using Docker Compose

1. Create a `docker-compose.yml` file, customizing as needed:

```yaml
services:
toolbox:
# TODO: It is recommended to pin to a specific image version instead of latest.
image: us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:latest
hostname: toolbox
platform: linux/amd64
ports:
- "5000:5000"
volumes:
- ./config:/config
command: [ "toolbox", "--tools_file", "/config/tools.yaml", "--address", "0.0.0.0"]
depends_on:
db:
condition: service_healthy
networks:
- tool-network
db:
# TODO: It is recommended to pin to a specific image version instead of latest.
image: postgres
hostname: db
environment:
POSTGRES_USER: toolbox_user
POSTGRES_PASSWORD: my-password
POSTGRES_DB: toolbox_db
ports:
- "5432:5432"
volumes:
- ./db:/var/lib/postgresql/data
# This file can be used to bootstrap your schema if needed.
# See "initialization scripts" on https://hub.docker.com/_/postgres/ for more info
- ./config/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U toolbox_user -d toolbox_db"]
interval: 10s
timeout: 5s
retries: 5
networks:
- tool-network
networks:
tool-network:

```

1. Run the following command to bring up the Toolbox and Postgres instance

```bash
docker-compose up -d
```


{{< notice tip >}}

You can use this setup quickly set up Toolbox + Postgres to follow along in our
[Quickstart](../getting-started/local_quickstart.md)

{{< /notice >}}



## Connecting with Toolbox Client SDL

Next, we will use Toolbox with the Client SDKs:

1. The url for the Toolbox server running using docker-compose will be:

```
http://localhost:5000
```

1. Import and initialize the client with the URL:

```bash
from toolbox_langchain_sdk import ToolboxClient
# Replace with the cloud run service URL generated above
toolbox = ToolboxClient("$YOUR_URL")
```


9 changes: 2 additions & 7 deletions docs/en/how-to/deploy_toolbox.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Deploy to Cloud Run"
type: docs
weight: 2
weight: 1
description: >
How to set up and configure Toolbox to run on Cloud Run.
---
Expand Down Expand Up @@ -160,11 +160,6 @@ Next, we will use `gcloud` to authenticate requests to our Cloud Run instance:

Next, we will use Toolbox with client SDK:

1. Below is a list of Client SDKs that are supported:

- LangChain / LangGraph
- LlamaIndex

1. Run the following to retrieve a non-deterministic URL for the cloud run service:

```bash
Expand All @@ -177,5 +172,5 @@ Next, we will use Toolbox with client SDK:
from toolbox_langchain_sdk import ToolboxClient
# Replace with the cloud run service URL generated above
toolbox = ToolboxClient("http://URL")
toolbox = ToolboxClient("http://$YOUR_URL")
```
4 changes: 2 additions & 2 deletions docs/en/how-to/export_telemetry.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Export Telemetry using the Otel Collector"
title: "Export Telemetry"
type: docs
weight: 2
weight: 4
description: >
How to set up and configure Toolbox to use the Otel Collector.
---
Expand Down

0 comments on commit 1cba482

Please sign in to comment.