mirror of
https://github.com/civitai/civitai.git
synced 2026-09-20 22:08:18 +08:00
Fixes clickhouse connection to run metrics
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ NEXT_PUBLIC_ADS=true
|
||||
# Clickhouse
|
||||
CLICKHOUSE_HOST=http://localhost:18123
|
||||
CLICKHOUSE_USERNAME=default
|
||||
CLICKHOUSE_PASSWORD=clickhouse
|
||||
CLICKHOUSE_PASSWORD=
|
||||
CLICKHOUSE_TRACKER_URL=http://localhost:3000
|
||||
|
||||
# Email
|
||||
|
||||
@@ -17,6 +17,12 @@ down:
|
||||
.PHONY: restart
|
||||
restart: down start
|
||||
|
||||
# Rebuilds the containers
|
||||
.PHONY: rebuild
|
||||
rebuild:
|
||||
docker-compose down \
|
||||
&& docker-compose up --build -d
|
||||
|
||||
# Stop and remove all containers, networks, images, and volumes
|
||||
.PHONY: burn
|
||||
burn:
|
||||
|
||||
+2
-1
@@ -89,7 +89,8 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server:22.2
|
||||
image: clickhouse/clickhouse-server
|
||||
container_name: clickhouse
|
||||
ports:
|
||||
- "18123:8123"
|
||||
- "19000:9000"
|
||||
|
||||
Vendored
+1
-1
@@ -8,7 +8,7 @@ import { env as clientEnv, formatErrors } from './client.mjs';
|
||||
import { serverSchema } from './schema.mjs';
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
dotenv.config({ path: __dirname + '/../../.env.development' });
|
||||
dotenv.config({ path: ['.env.local', '.env.development'] });
|
||||
}
|
||||
|
||||
const _serverEnv = serverSchema.safeParse(process.env);
|
||||
|
||||
@@ -69,7 +69,7 @@ function getClickHouse() {
|
||||
}
|
||||
|
||||
export let clickhouse: CustomClickHouseClient | undefined;
|
||||
const shouldConnect = env.CLICKHOUSE_HOST && env.CLICKHOUSE_USERNAME && env.CLICKHOUSE_PASSWORD;
|
||||
const shouldConnect = env.CLICKHOUSE_HOST && env.CLICKHOUSE_USERNAME;
|
||||
if (shouldConnect) {
|
||||
if (isProd) clickhouse = getClickHouse();
|
||||
else {
|
||||
|
||||
@@ -204,7 +204,7 @@ async function getEngagementTasks(ctx: MetricProcessorRunContext) {
|
||||
tf.timeframe,
|
||||
${snippets.timeframeSum('ae."createdAt"')} "hideCount"
|
||||
FROM "ArticleEngagement" ae
|
||||
JOIN "Article" a ON a.id = bt."entityId" -- ensure the article exists
|
||||
JOIN "Article" a ON a.id = ae."articleId" -- ensure the article exists
|
||||
CROSS JOIN (SELECT unnest(enum_range(NULL::"MetricTimeframe")) AS timeframe) tf
|
||||
WHERE "articleId" IN (${ids}) AND ae.type = 'Hide'
|
||||
GROUP BY "articleId", tf.timeframe
|
||||
|
||||
Reference in New Issue
Block a user