diff --git a/templates/create_clickhouse_sink.sql b/templates/create_clickhouse_sink.sql new file mode 100644 index 0000000..3e89c88 --- /dev/null +++ b/templates/create_clickhouse_sink.sql @@ -0,0 +1,12 @@ +CREATE SINK click_stats +FROM + m_click_statistic WITH ( + connector = 'clickhouse', + type = 'append-only', + force_append_only='true', + clickhouse.url = 'http://clickhouse-server-1:8123', + clickhouse.user = 'default', + clickhouse.password = '', + clickhouse.database = 'default', + clickhouse.table='click_stats', +); diff --git a/templates/docker-compose.clickhouse.yaml b/templates/docker-compose.clickhouse.yaml new file mode 100644 index 0000000..4f4688c --- /dev/null +++ b/templates/docker-compose.clickhouse.yaml @@ -0,0 +1,43 @@ +services: + clickhouse-server: + image: clickhouse/clickhouse-server:24-alpine + container_name: clickhouse-server-1 + hostname: clickhouse-server-1 + ports: + - "8123:8123" + - "9000:9000" + - "9004:9004" + expose: + - 8123 + - 9009 + configs: + - source: clickhouse_init + target: /docker-entrypoint-initdb.d/init-db.sh + + clickhouse-ui: + image: "ghcr.io/caioricciuti/ch-ui:latest" + ports: + - 5521:5521 + environment: + - VITE_CLICKHOUSE_URL=http://localhost:8123 + - VITE_CLICKHOUSE_USER=default + #- VITE_CLICKHOUSE_PASS=default + depends_on: + - clickhouse-server + +configs: + clickhouse_init: + content: | + #!/bin/bash + set -e + + clickhouse client -n <<-EOSQL + CREATE table click_stats( + clicks_count Int64, + ad_id Int64 + )ENGINE = ReplacingMergeTree + PRIMARY KEY (ad_id); + + EOSQL + +