76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
# This is a simplified example for learning purposes. Do not use this in production.
|
|
# For production-ready deployments, see: https://www.tensorzero.com/docs/gateway/deployment
|
|
|
|
services:
|
|
gateway:
|
|
image: tensorzero/gateway
|
|
volumes:
|
|
# Mount our tensorzero.toml file into the container
|
|
- ./config:/app/config:ro
|
|
command: --config-file /app/config/tensorzero.toml
|
|
environment:
|
|
OPENAI_API_KEY: ${OPENAI_API_KEY:?Environment variable OPENAI_API_KEY must be set.}
|
|
TENSORZERO_POSTGRES_URL: postgres://postgres:postgres@postgres:5432/tensorzero
|
|
ports:
|
|
- "3000:3000"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"wget",
|
|
"--no-verbose",
|
|
"--tries=1",
|
|
"--spider",
|
|
"http://localhost:3000/health",
|
|
]
|
|
start_period: 10s
|
|
start_interval: 1s
|
|
timeout: 1s
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
gateway-run-postgres-migrations:
|
|
condition: service_completed_successfully
|
|
|
|
ui:
|
|
image: tensorzero/ui
|
|
environment:
|
|
TENSORZERO_GATEWAY_URL: http://gateway:3000
|
|
ports:
|
|
- "4000:4000"
|
|
depends_on:
|
|
gateway:
|
|
condition: service_healthy
|
|
|
|
postgres:
|
|
image: tensorzero/postgres:17
|
|
command: ["postgres", "-c", "cron.database_name=tensorzero"]
|
|
environment:
|
|
POSTGRES_DB: tensorzero
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d tensorzero"]
|
|
start_period: 30s
|
|
start_interval: 1s
|
|
timeout: 1s
|
|
|
|
# Apply Postgres migrations before the gateway starts
|
|
gateway-run-postgres-migrations:
|
|
image: tensorzero/gateway
|
|
environment:
|
|
TENSORZERO_POSTGRES_URL: postgres://postgres:postgres@postgres:5432/tensorzero
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
command: ["--run-postgres-migrations"]
|
|
|
|
volumes:
|
|
postgres-data:
|