Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ sage.yaml
relay-monitor.yaml
cities1000.txt
countries.txt
deploy/local/docker-compose/xatu-consumoor-staging.yaml
39 changes: 39 additions & 0 deletions deploy/local/docker-compose/consumoor-clickhouse-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Initialize the consumoor ClickHouse database by copying all table schemas from default.
set -e

CH_HOST="${CH_HOST:-xatu-clickhouse-01}"

ch() {
clickhouse-client --host="$CH_HOST" "$@"
}

echo "Creating consumoor database..."
ch --query="CREATE DATABASE IF NOT EXISTS consumoor ON CLUSTER '{cluster}'"

echo "Getting local tables from default database..."
tables=$(ch --query="SELECT name FROM system.tables WHERE database = 'default' AND name LIKE '%_local' AND engine LIKE 'Replicated%' ORDER BY name")

for table in $tables; do
echo "Copying: default.$table -> consumoor.$table"

# Get the CREATE TABLE DDL and modify it for consumoor database:
# 1. Replace database qualifier: default. -> consumoor.
# 2. Add ON CLUSTER after table name
# 3. Append /consumoor to the ZK path (first quoted arg in MergeTree())
# to ensure unique paths regardless of path pattern variant
ch --format=TSVRaw --query="SHOW CREATE TABLE default.\`$table\`" \
| sed '1s/^CREATE TABLE default\./CREATE TABLE IF NOT EXISTS consumoor./' \
| sed "1s/\$/ ON CLUSTER '{cluster}'/" \
| sed "s|MergeTree('/\([^']*\)'|MergeTree('/\1/consumoor'|" \
| ch --multiquery

# Create corresponding distributed table
dist_table="${table%_local}"
echo "Creating distributed: consumoor.$dist_table"
ch --query="CREATE TABLE IF NOT EXISTS consumoor.\`$dist_table\` ON CLUSTER '{cluster}' AS consumoor.\`$table\` ENGINE = Distributed('{cluster}', 'consumoor', '$table', rand())"
done

echo ""
table_count=$(echo "$tables" | wc -w | tr -d ' ')
echo "Consumoor database initialization complete! ($table_count tables copied)"
47 changes: 47 additions & 0 deletions deploy/local/docker-compose/docker-compose.staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Staging overlay: disables local Kafka, Vector, consumoor, and non-essential services.
# Consumoor runs as a native binary on the host (not in Docker) because Kafka
# brokers advertise internal K8s DNS names that aren't resolvable from Docker.
#
# Usage:
# docker compose -f docker-compose.yml -f deploy/local/docker-compose/docker-compose.staging.yml up -d
#
# See deploy/local/docker-compose/staging-correctness-test.sh for the full workflow.

services:
# --- Disabled services (not needed for staging correctness test) ---
xatu-kafka:
profiles: ["disabled"]
xatu-kafka-storage-format:
profiles: ["disabled"]
xatu-init-kafka:
profiles: ["disabled"]
xatu-server:
profiles: ["disabled"]
xatu-postgres:
profiles: ["disabled"]
xatu-postgres-migrator:
profiles: ["disabled"]
xatu-vector-http-kafka:
profiles: ["disabled"]
xatu-vector-kafka-clickhouse:
profiles: ["disabled"]
xatu-vector-kafka-clickhouse-libp2p:
profiles: ["disabled"]
xatu-sentry-logs:
profiles: ["disabled"]
xatu-cannon:
profiles: ["disabled"]
xatu-nginx:
profiles: ["disabled"]
xatu-grafana:
profiles: ["disabled"]
xatu-prometheus:
profiles: ["disabled"]
tempo:
profiles: ["disabled"]
tempo-init:
profiles: ["disabled"]

# --- Consumoor runs as native binary on the host, not in Docker ---
xatu-consumoor:
profiles: ["disabled"]
Loading
Loading