Configuration
Docker Setup
Kostrack ships a single docker-compose.yml that starts TimescaleDB and Grafana with everything pre-configured.
Starting the stack
docker compose up -d # start in background
docker compose ps # verify both services healthy
docker compose logs -f # follow logs
What starts
| Container | Port | Description |
|---|---|---|
kostrack-db | 5432 | TimescaleDB (Postgres 15 + TimescaleDB extension). Schema loaded from init-db.sql on first run. |
kostrack-grafana | 3000 | Grafana with pre-provisioned datasource and Overview dashboard. |
Data persistence
All data lives in named Docker volumes:
| Volume | Contents |
|---|---|
timescale-data | All llm_calls, pricing, budgets |
grafana-data | Grafana dashboard customisations |
docker compose down # stop — data preserved
docker compose down -v # stop AND delete all data (reset)
Useful DB commands
# Connect to the database
docker exec -it kostrack-db psql -U kostrack -d kostrack
# Check recent calls
SELECT time, provider, model, cost_usd, tags->>'project'
FROM llm_calls ORDER BY time DESC LIMIT 20;
# Spend today by project
SELECT tags->>'project', SUM(cost_usd)
FROM llm_calls
WHERE time >= date_trunc('day', NOW())
GROUP BY 1 ORDER BY 2 DESC;
# Check writer health
SELECT * FROM writer_health;
# Verify pricing loaded
SELECT provider, model, input_rate, output_rate
FROM pricing_current ORDER BY provider, model;
Schema not loading?
The init script only runs on a fresh volume. To re-run manually:
docker exec -i kostrack-db psql -U kostrack -d kostrack < init-db.sql