Add support for local clickhouse in docker (#48)

Caveats / Deficiencies

This is not a perfect match for the server clickhouse config since we're
using MergeTree() as the engine. It seemed like it was going to be much
more complex to exactly match production, but I may have missed something
obvious.

The create tables sql only seems to be run on a completely fresh install.
This commit is contained in:
John Richmond 2025-05-29 16:49:59 -07:00 committed by GitHub
parent 723b753596
commit 6a65576136
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,34 @@
CREATE TABLE IF NOT EXISTS default.events
(
-- Shared
`id` UUID,
`orgId` String,
`userId` String,
`timestamp` Int32,
`type` String,
-- App
`appVersion` String,
`vscodeVersion` String,
`platform` String,
`editorName` String,
`language` String,
`mode` String,
-- Task
`taskId` Nullable(String),
`apiProvider` Nullable(String),
`modelId` Nullable(String),
`diffStrategy` Nullable(String),
`isSubtask` Nullable(Bool),
-- Completion
`inputTokens` Nullable(Int32),
`outputTokens` Nullable(Int32),
`cacheReadTokens` Nullable(Int32),
`cacheWriteTokens` Nullable(Int32),
`cost` Nullable(Float32)
)
ENGINE = MergeTree()
ORDER BY (id, type, timestamp)
SETTINGS index_granularity = 8192;

View file

@ -11,3 +11,16 @@ services:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DATABASES=roo_code_development,roo_code_test
clickhouse:
image: clickhouse/clickhouse-server
ports:
- "8123:8123"
- "9000:9000"
volumes:
- ./.docker/clickhouse:/var/lib/clickhouse/
- ./.docker/clickhouse-logs:/var/log/clickhouse-server/
- ./.docker/scripts/clickhouse:/docker-entrypoint-initdb.d
environment:
- CLICKHOUSE_DB=default
- CLICKHOUSE_USER=default
- CLICKHOUSE_PASSWORD=password