Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Add click house insert

Fang-Pen Lin424b1d6e0aa9
diff --git a/.env.example b/.env.example
index 489aa292cb..4600de6f2b 100644
--- a/.env.example
+++ b/.env.example
@@ -137,3 +137,6 @@ DATADOG_HOSTNAME=
# kubernetes
KUBERNETES_AUTO_FETCH_SERVICE_ACCOUNT_TOKEN=false
+
+# ClickHouse (optional) for audit log storage
+# CLICKHOUSE_URL=http://default:clickhouse@clickhouse:8123
diff --git a/.env.migration.example b/.env.migration.example
index dfc54d1717..774d5584c5 100644
--- a/.env.migration.example
+++ b/.env.migration.example
@@ -1,2 +1,3 @@
DB_CONNECTION_URI=postgres://infisical:infisical@localhost:5432/infisical
AUDIT_LOGS_DB_CONNECTION_URI=
+CLICKHOUSE_URL=http://default:clickhouse@localhost:8123
diff --git a/backend/e2e-test/vitest-environment-knex.ts b/backend/e2e-test/vitest-environment-knex.ts
index 78727844e5..d27980b0f2 100644
--- a/backend/e2e-test/vitest-environment-knex.ts
+++ b/backend/e2e-test/vitest-environment-knex.ts
@@ -11,6 +11,7 @@ import { initLogger } from "@app/lib/logger";
import { main } from "@app/server/app";
import { AuthMethod, AuthTokenType } from "@app/services/auth/auth-type";
+import { buildClickHouseFromConfig } from "@app/lib/config/clickhouse";
import { mockSmtpServer } from "./mocks/smtp";
import { initDbConnection } from "@app/db";
import { queueServiceFactory } from "@app/queue";
@@ -56,6 +57,8 @@ export default {
const redis = buildRedisFromConfig(envCfg);
await redis.flushdb("SYNC");
+ const clickhouseClient = buildClickHouseFromConfig(envCfg);
+
try {
// called after all tests with this env have been run
await db.raw("DROP SCHEMA IF EXISTS public CASCADE");
@@ -90,6 +93,7 @@ export default {
kmsRootConfigDAL,
superAdminDAL,
redis,
+ clickhouse: clickhouseClient,
envConfig: envCfg
});
diff --git a/backend/package-lock.json b/backend/package-lock.json
index 587a29bc2b..593874e224 100644
--- a/backend/package-lock.json
+++ b/backend/package-lock.json
@@ -16,6 +16,7 @@
"@aws-sdk/client-secrets-manager": "^3.504.0",
"@aws-sdk/client-sts": "^3.600.0",
"@casl/ability": "^6.5.0",
+ "@clickhouse/client": "^1.17.0",
"@elastic/elasticsearch": "^9.1.1",
"@fastify/cookie": "^9.3.1",
"@fastify/cors": "^8.5.0",
@@ -662,7 +663,6 @@
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.637.0.tgz",
"integrity": "sha512-xUi7x4qDubtA8QREtlblPuAcn91GS/09YVEY/RwU7xCY0aqGuFwgszAANlha4OUIqva8oVj2WO4gJuG+iaSnhw==",
"license": "Apache-2.0",
- "peer": true,
"dependencies": {
"@aws-crypto/sha256-browser": "5.2.0",
"@aws-crypto/sha256-js": "5.2.0",
@@ -4444,7 +4444,6 @@
"version": "3.632.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.632.0.tgz",
"integrity": "sha512-Oh1fIWaoZluihOCb/zDEpRTi+6an82fgJz7fyRBugyLhEtDjmvpCQ3oKjzaOhoN+4EvXAm1ZS/ZgpvXBlIRTgw==",
- "peer": true,
"dependencies": {
"@aws-crypto/sha256-browser": "5.2.0",
"@aws-crypto/sha256-js": "5.2.0",
@@ -4521,7 +4520,6 @@
"version": "3.632.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.632.0.tgz",
"integrity": "sha512-Ss5cBH09icpTvT+jtGGuQlRdwtO7RyE9BF4ZV/CEPATdd9whtJt4Qxdya8BUnkWR7h5HHTrQHqai3YVYjku41A==",
- "peer": true,
"dependencies": {
"@aws-crypto/sha256-browser": "5.2.0",
"@aws-crypto/sha256-js": "5.2.0",
@@ -8812,7 +8810,6 @@
"integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.26.2",
@@ -10743,6 +10740,24 @@
"url": "https://github.com/stalniy/casl/blob/master/BACKERS.md"
}
},
+ "node_modules/@clickhouse/client": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/@clickhouse/client/-/client-1.17.0.tgz",
+ "integrity": "sha512-Y3DQoamKZ/Iyosoq7Lj7lqpDkQDK4R/5mI52yJs4ZLPIO+d6/CYDqTbFBIb4No3C/AlXUYE4TKhj/kXDpe6rOA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@clickhouse/client-common": "1.17.0"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@clickhouse/client-common": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/@clickhouse/client-common/-/client-common-1.17.0.tgz",
+ "integrity": "sha512-MiwwgXViFAQA2YZkN4ymF1ynzG0K49KeSX9/iOcmJetWkxqSekDdpyp1GjwATWa9R215uQ+hGzJtJujeQVZZIw==",
+ "license": "Apache-2.0"
+ },
"node_modules/@colors/colors": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz",
@@ -10843,7 +10858,6 @@
"url": "https://opencollective.com/csstools"
}
],
- "peer": true,
"engines": {
"node": ">=18"
},
@@ -10865,7 +10879,6 @@
"url": "https://opencollective.com/csstools"
}
],
- "peer": true,
"engines": {
"node": ">=18"
}
@@ -12794,9 +12807,6 @@
"win32"
]
},
- "node_modules/@infisical/quic/node_modules/@infisical/quic-linux-arm": {
- "optional": true
- },
"node_modules/@ioredis/commands": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz",
@@ -13509,7 +13519,6 @@
"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.13.tgz",
"integrity": "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==",
"license": "MIT",
- "peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
@@ -14216,7 +14225,6 @@
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz",
"integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.1.0",
@@ -14660,7 +14668,6 @@
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
"integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
- "peer": true,
"engines": {
"node": ">=8.0.0"
}
@@ -15315,7 +15322,6 @@
"resolved": "https://registry.npmjs.org/@react-email/body/-/body-0.2.0.tgz",
"integrity": "sha512-9GCWmVmKUAoRfloboCd+RKm6X17xn7eGL7HnpAZUnjBXBilWCxsKnLMTC/ixSHDKS/A/057M1Tx6ZUXd89sVBw==",
"license": "MIT",
- "peer": true,
"peerDependencies": {
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
}
@@ -15325,7 +15331,6 @@
"resolved": "https://registry.npmjs.org/@react-email/button/-/button-0.2.0.tgz",
"integrity": "sha512-8i+v6cMxr2emz4ihCrRiYJPp2/sdYsNNsBzXStlcA+/B9Umpm5Jj3WJKYpgTPM+aeyiqlG/MMI1AucnBm4f1oQ==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15338,7 +15343,6 @@
"resolved": "https://registry.npmjs.org/@react-email/code-block/-/code-block-0.2.0.tgz",
"integrity": "sha512-eIrPW9PIFgDopQU0e/OPpwCW2QWQDtNZDSsiN4sJO8KdMnWWnXJicnRfzrit5rHwFo+Y98i+w/Y5ScnBAFr1dQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"prismjs": "^1.30.0"
},
@@ -15354,7 +15358,6 @@
"resolved": "https://registry.npmjs.org/@react-email/code-inline/-/code-inline-0.0.5.tgz",
"integrity": "sha512-MmAsOzdJpzsnY2cZoPHFPk6uDO/Ncpb4Kh1hAt9UZc1xOW3fIzpe1Pi9y9p6wwUmpaeeDalJxAxH6/fnTquinA==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15430,7 +15433,6 @@
"resolved": "https://registry.npmjs.org/@react-email/container/-/container-0.0.15.tgz",
"integrity": "sha512-Qo2IQo0ru2kZq47REmHW3iXjAQaKu4tpeq/M8m1zHIVwKduL2vYOBQWbC2oDnMtWPmkBjej6XxgtZByxM6cCFg==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15464,7 +15466,6 @@
"resolved": "https://registry.npmjs.org/@react-email/heading/-/heading-0.0.15.tgz",
"integrity": "sha512-xF2GqsvBrp/HbRHWEfOgSfRFX+Q8I5KBEIG5+Lv3Vb2R/NYr0s8A5JhHHGf2pWBMJdbP4B2WHgj/VUrhy8dkIg==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15477,7 +15478,6 @@
"resolved": "https://registry.npmjs.org/@react-email/hr/-/hr-0.0.11.tgz",
"integrity": "sha512-S1gZHVhwOsd1Iad5IFhpfICwNPMGPJidG/Uysy1AwmspyoAP5a4Iw3OWEpINFdgh9MHladbxcLKO2AJO+cA9Lw==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15502,7 +15502,6 @@
"resolved": "https://registry.npmjs.org/@react-email/img/-/img-0.0.11.tgz",
"integrity": "sha512-aGc8Y6U5C3igoMaqAJKsCpkbm1XjguQ09Acd+YcTKwjnC2+0w3yGUJkjWB2vTx4tN8dCqQCXO8FmdJpMfOA9EQ==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15515,7 +15514,6 @@
"resolved": "https://registry.npmjs.org/@react-email/link/-/link-0.0.12.tgz",
"integrity": "sha512-vF+xxQk2fGS1CN7UPQDbzvcBGfffr+GjTPNiWM38fhBfsLv6A/YUfaqxWlmL7zLzVmo0K2cvvV9wxlSyNba1aQ==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15543,7 +15541,6 @@
"resolved": "https://registry.npmjs.org/@react-email/preview/-/preview-0.0.13.tgz",
"integrity": "sha512-F7j9FJ0JN/A4d7yr+aw28p4uX7VLWs7hTHtLo7WRyw4G+Lit6Zucq4UWKRxJC8lpsUdzVmG7aBJnKOT+urqs/w==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -15648,7 +15645,6 @@
"resolved": "https://registry.npmjs.org/@react-email/text/-/text-0.1.5.tgz",
"integrity": "sha512-o5PNHFSE085VMXayxH+SJ1LSOtGsTv+RpNKnTiJDrJUwoBu77G3PlKOsZZQHCNyD28WsQpl9v2WcJLbQudqwPg==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=18.0.0"
},
@@ -17756,7 +17752,6 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.23.tgz",
"integrity": "sha512-yIdlVVVHXpmqRhtyovZAcSy0MiPcYWGkoO4CGe/+jpP0hmNuihm4XhHbADpK++MsiLHP5MVlv+bcgdF99kSiFQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"undici-types": "~6.21.0"
}
@@ -18247,7 +18242,6 @@
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz",
"integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==",
"dev": true,
- "peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "6.20.0",
"@typescript-eslint/types": "6.20.0",
@@ -18706,7 +18700,6 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
- "peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -19193,7 +19186,6 @@
"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
"integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
"license": "MIT",
- "peer": true,
"dependencies": {
"bn.js": "^4.0.0",
"inherits": "^2.0.1",
@@ -19410,7 +19402,6 @@
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
"license": "MIT",
- "peer": true,
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.4",
@@ -20008,7 +19999,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.8.9",
"caniuse-lite": "^1.0.30001746",
@@ -21421,7 +21411,6 @@
"version": "16.4.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz",
"integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==",
- "peer": true,
"engines": {
"node": ">=12"
},
@@ -21807,7 +21796,6 @@
"dev": true,
"hasInstallScript": true,
"license": "MIT",
- "peer": true,
"bin": {
"esbuild": "bin/esbuild"
},
@@ -21890,7 +21878,6 @@
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz",
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==",
"dev": true,
- "peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -21989,7 +21976,6 @@
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
"dev": true,
- "peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@@ -22078,7 +22064,6 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"dev": true,
- "peer": true,
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
@@ -22490,7 +22475,6 @@
"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
"integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
"license": "MIT",
- "peer": true,
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
@@ -22552,6 +22536,7 @@
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz",
"integrity": "sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"cookie": "0.7.2",
"cookie-signature": "1.0.7",
@@ -22569,12 +22554,14 @@
"node_modules/express-session/node_modules/cookie-signature": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
- "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="
+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
+ "peer": true
},
"node_modules/express-session/node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "peer": true,
"dependencies": {
"ms": "2.0.0"
}
@@ -22582,7 +22569,8 @@
"node_modules/express-session/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "peer": true
},
"node_modules/express/node_modules/cookie": {
"version": "0.7.1",
@@ -23426,6 +23414,7 @@
"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",
"license": "Apache-2.0",
"optional": true,
+ "peer": true,
"dependencies": {
"gaxios": "^5.0.0",
"json-bigint": "^1.0.0"
@@ -23440,6 +23429,7 @@
"integrity": "sha512-95hVgBRgEIRQQQHIbnxBXeHbW4TqFk4ZDJW7wmVtvYar72FdhRIo1UGOLS2eRAKCPEdPBWu+M7+A33D9CdX9rA==",
"license": "Apache-2.0",
"optional": true,
+ "peer": true,
"dependencies": {
"extend": "^3.0.2",
"https-proxy-agent": "^5.0.0",
@@ -29028,6 +29018,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
"integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
+ "peer": true,
"engines": {
"node": ">= 0.8"
}
@@ -29710,7 +29701,6 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz",
"integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==",
- "peer": true,
"engines": {
"node": ">=10"
},
@@ -30053,7 +30043,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -30143,7 +30132,6 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
"license": "MIT",
- "peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -30578,6 +30566,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
"integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==",
+ "peer": true,
"engines": {
"node": ">= 0.8"
}
@@ -30649,7 +30638,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",
"integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -30659,7 +30647,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz",
"integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==",
"license": "MIT",
- "peer": true,
"dependencies": {
"scheduler": "^0.26.0"
},
@@ -33436,7 +33423,6 @@
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz",
"integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
@@ -34723,7 +34709,6 @@
"integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"esbuild": "~0.25.0",
"get-tsconfig": "^4.7.5"
@@ -34890,7 +34875,6 @@
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
"integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
- "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -34931,6 +34915,7 @@
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
"integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
+ "peer": true,
"dependencies": {
"random-bytes": "~1.0.0"
},
@@ -35518,7 +35503,6 @@
"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",
@@ -36128,7 +36112,6 @@
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz",
"integrity": "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==",
"license": "MIT",
- "peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
diff --git a/backend/package.json b/backend/package.json
index 191da90cbd..368e0e5d38 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -28,6 +28,7 @@
"auditlog-migration:status": "knex --knexfile ./dist/db/auditlog-knexfile.mjs --client pg migrate:status",
"auditlog-migration:unlock": "knex --knexfile ./dist/db/auditlog-knexfile.mjs migrate:unlock",
"auditlog-migration:rollback": "knex --knexfile ./dist/db/auditlog-knexfile.mjs migrate:rollback",
+ "clickhouse-migration:latest": "tsx ./src/db/run-clickhouse-migrations.ts",
"migration:new": "tsx ./scripts/create-migration.ts",
"migration:up": "npm run auditlog-migration:up && knex --knexfile ./dist/db/knexfile.mjs --client pg migrate:up",
"migration:down": "npm run auditlog-migration:down && knex --knexfile ./dist/db/knexfile.mjs --client pg migrate:down",
@@ -129,6 +130,7 @@
"@aws-sdk/client-secrets-manager": "^3.504.0",
"@aws-sdk/client-sts": "^3.600.0",
"@casl/ability": "^6.5.0",
+ "@clickhouse/client": "^1.17.0",
"@elastic/elasticsearch": "^9.1.1",
"@fastify/cookie": "^9.3.1",
"@fastify/cors": "^8.5.0",
diff --git a/backend/src/auto-start-migrations.ts b/backend/src/auto-start-migrations.ts
index eb8e989e31..65de089f95 100644
--- a/backend/src/auto-start-migrations.ts
+++ b/backend/src/auto-start-migrations.ts
@@ -2,12 +2,15 @@ import crypto from "node:crypto";
import os from "node:os";
import path from "node:path";
+import { type ClickHouseClient } from "@clickhouse/client";
import dotenv from "dotenv";
import { Knex } from "knex";
import { Logger } from "pino";
+import { getConfig } from "@app/lib/config/env";
import { applyJitter, delay } from "@app/lib/delay";
+import { ensureClickHouseSchema } from "./db/clickhouse-migration-runner";
import {
acquireSanitizedSchemaLock,
createSanitizedSchema,
@@ -23,6 +26,7 @@ dotenv.config();
type TArgs = {
auditLogDb?: Knex;
applicationDb: Knex;
+ clickhouseClient?: ClickHouseClient | null;
logger: Logger;
};
@@ -291,7 +295,7 @@ const withStartupLock = async (db: Knex, logger: Logger, doMigrations: () => Pro
}
};
-export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs) => {
+export const runMigrations = async ({ applicationDb, auditLogDb, clickhouseClient, logger }: TArgs) => {
const generateSanitizedSchema = process.env.GENERATE_SANITIZED_SCHEMA === "true";
try {
@@ -320,6 +324,25 @@ export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs
}
}
+ // Ensure ClickHouse audit_logs table exists if configured
+ if (clickhouseClient) {
+ logger.info("Ensuring ClickHouse audit_logs table exists ...");
+ try {
+ const cfg = getConfig();
+ await ensureClickHouseSchema({
+ client: clickhouseClient,
+ tableName: cfg.CLICKHOUSE_AUDIT_LOG_TABLE_NAME,
+ engine: cfg.CLICKHOUSE_AUDIT_LOG_ENGINE
+ });
+ } catch (clickhouseErr) {
+ logger.error(clickhouseErr, "ClickHouse schema setup failed");
+ process.exit(1);
+ }
+ logger.info("Finished ensuring ClickHouse audit_logs table exists.");
+ } else {
+ logger.info("No ClickHouse client configured: Skipping ClickHouse audit_logs table creation.");
+ }
+
const shouldRunMigration = Boolean(
await applicationDb.migrate.status(migrationConfig).catch(migrationStatusCheckErrorHandler)
); // db.length - code.length
@@ -370,6 +393,7 @@ export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs
await ensureMigrationTables(applicationDb, logger);
logger.info("Running application migrations.");
+
const didPreviousInstanceRunMigration = !(await applicationDb.migrate
.status(migrationConfig)
.catch(migrationStatusCheckErrorHandler));
diff --git a/backend/src/db/clickhouse-migration-runner.ts b/backend/src/db/clickhouse-migration-runner.ts
new file mode 100644
index 0000000000..b8279767cb
--- /dev/null
+++ b/backend/src/db/clickhouse-migration-runner.ts
@@ -0,0 +1,54 @@
+import { type ClickHouseClient } from "@clickhouse/client";
+
+import { logger } from "@app/lib/logger";
+
+const buildCreateAuditLogsTableSQL = (tableName: string, engine: string) => `
+CREATE TABLE IF NOT EXISTS ${tableName}
+(
+ id UUID,
+ actor LowCardinality(String),
+ actorMetadata JSON,
+ ipAddress String,
+ eventType LowCardinality(String),
+ eventMetadata JSON,
+ userAgent LowCardinality(String),
+ userAgentType LowCardinality(String),
+ createdAt DateTime64(6) CODEC(DoubleDelta, ZSTD(3)),
+ orgId UUID,
+ projectId String,
+)
+ENGINE = ${engine}
+PARTITION BY toYYYYMM(createdAt)
+PRIMARY KEY (orgId, projectId, createdAt, id)
+ORDER BY (orgId, projectId, createdAt, id)
+`;
+
+export type TEnsureClickHouseSchemaOpts = {
+ client: ClickHouseClient;
+ tableName: string;
+ engine: string;
+};
+
+/**
+ * Ensure the ClickHouse audit_logs table exists.
+ * If the table already exists, this is a no-op (CREATE TABLE IF NOT EXISTS).
+ */
+export const ensureClickHouseSchema = async ({ client, tableName, engine }: TEnsureClickHouseSchemaOpts) => {
+ logger.info({ tableName }, "Ensuring ClickHouse audit_logs table exists");
+
+ await client.exec({
+ query: "SET allow_experimental_json_type = 1",
+ clickhouse_settings: {
+ wait_end_of_query: 1
+ }
+ });
+
+ await client.exec({
+ query: buildCreateAuditLogsTableSQL(tableName, engine),
+ clickhouse_settings: {
+ wait_end_of_query: 1
+ }
+ });
+
+ logger.info({ tableName }, "ClickHouse audit_logs table ready");
+};
diff --git a/backend/src/db/run-clickhouse-migrations.ts b/backend/src/db/run-clickhouse-migrations.ts
new file mode 100644
index 0000000000..50c6dbad22
--- /dev/null
+++ b/backend/src/db/run-clickhouse-migrations.ts
@@ -0,0 +1,72 @@
+/**
+ * CLI entry point for ensuring ClickHouse schema exists.
+ *
+ * Usage: tsx ./src/db/run-clickhouse-migrations.ts
+ *
+ * Required environment variables:
+ * CLICKHOUSE_URL - ClickHouse connection URL
+ *
+ * Optional environment variables:
+ * CLICKHOUSE_AUDIT_LOG_ENGINE - Engine clause for the audit_logs table
+ * Default: ReplacingMergeTree
+ * CLICKHOUSE_AUDIT_LOG_TABLE_NAME - Table name for audit logs
+ * Default: audit_logs
+ */
+import path from "node:path";
+
+import dotenv from "dotenv";
+
+import { buildClickHouseFromConfig } from "../lib/config/clickhouse";
+import { ensureClickHouseSchema } from "./clickhouse-migration-runner";
+
+dotenv.config({
+ path: path.join(__dirname, "../../../.env.migration")
+});
+dotenv.config({
+ path: path.join(__dirname, "../../../.env")
+});
+
+const DEFAULT_ENGINE = "ReplacingMergeTree";
+const DEFAULT_TABLE_NAME = "audit_logs";
+
+const main = async () => {
+ const clickhouseUrl = process.env.CLICKHOUSE_URL;
+
+ if (!clickhouseUrl) {
+ // eslint-disable-next-line no-console
+ console.info("CLICKHOUSE_URL not set. Nothing to do.");
+ process.exit(0);
+ }
+
+ const client = buildClickHouseFromConfig({ CLICKHOUSE_URL: clickhouseUrl });
+ if (!client) {
+ // eslint-disable-next-line no-console
+ console.error("Failed to create ClickHouse client.");
+ process.exit(1);
+ }
+
+ const engine = process.env.CLICKHOUSE_AUDIT_LOG_ENGINE || DEFAULT_ENGINE;
+ const tableName = process.env.CLICKHOUSE_AUDIT_LOG_TABLE_NAME || DEFAULT_TABLE_NAME;
+
+ // eslint-disable-next-line no-console
+ console.info("Ensuring ClickHouse schema...");
+
+ try {
+ await ensureClickHouseSchema({
+ client,
+ tableName,
+ engine
+ });
+
+ // eslint-disable-next-line no-console
+ console.info("ClickHouse schema ready.");
+ } catch (err) {
+ // eslint-disable-next-line no-console
+ console.error("ClickHouse schema setup failed:", err);
+ process.exit(1);
+ } finally {
+ await client.close();
+ }
+};
+
+void main();
diff --git a/backend/src/ee/services/audit-log/audit-log-queue.ts b/backend/src/ee/services/audit-log/audit-log-queue.ts
index a25968a1e8..a2775a636e 100644
--- a/backend/src/ee/services/audit-log/audit-log-queue.ts
+++ b/backend/src/ee/services/audit-log/audit-log-queue.ts
@@ -1,6 +1,10 @@
+import type { ClickHouseClient } from "@clickhouse/client";
import { randomUUID } from "crypto";
+import type { TProjects } from "@app/db/schemas";
import { TAuditLogStreamServiceFactory } from "@app/ee/services/audit-log-stream/audit-log-stream-service";
+import { getConfig } from "@app/lib/config/env";
+import { logger } from "@app/lib/logger";
import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";
import { TProjectDALFactory } from "@app/services/project/project-dal";
@@ -14,6 +18,7 @@ type TAuditLogQueueServiceFactoryDep = {
queueService: TQueueServiceFactory;
projectDAL: Pick<TProjectDALFactory, "findById">;
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
+ clickhouseClient: ClickHouseClient | null;
};
export type TAuditLogQueueServiceFactory = {
@@ -29,8 +34,12 @@ export const auditLogQueueServiceFactory = async ({
queueService,
projectDAL,
licenseService,
- auditLogStreamService
+ auditLogStreamService,
+ clickhouseClient
}: TAuditLogQueueServiceFactoryDep): Promise<TAuditLogQueueServiceFactory> => {
+ const { CLICKHOUSE_AUDIT_LOG_ENABLED, CLICKHOUSE_AUDIT_LOG_TABLE_NAME, CLICKHOUSE_AUDIT_LOG_INSERT_SETTINGS } =
+ getConfig();
+
const pushToLog = async (data: TCreateAuditLogDTO) => {
await queueService.queue<QueueName.AuditLog>(QueueName.AuditLog, QueueJobs.AuditLog, data, {
removeOnFail: {
@@ -45,7 +54,7 @@ export const auditLogQueueServiceFactory = async ({
const { actor, event, ipAddress, projectId, userAgent, userAgentType } = job.data;
let { orgId } = job.data;
const MS_IN_DAY = 24 * 60 * 60 * 1000;
- let project;
+ let project: TProjects | undefined;
if (!orgId) {
// it will never be undefined for both org and project id
@@ -67,21 +76,59 @@ export const auditLogQueueServiceFactory = async ({
const ttl = ttlInDays * MS_IN_DAY;
- const auditLog = await auditLogDAL.create({
- actor: actor.type,
- actorMetadata: actor.metadata,
- userAgent,
- projectId,
- projectName: project?.name,
- ipAddress,
- orgId,
- eventType: event.type,
- expiresAt: new Date(Date.now() + ttl),
- eventMetadata: event.metadata,
- userAgentType
- });
-
- await auditLogStreamService.streamLog(orgId, auditLog);
+ const now = new Date();
+ const auditLogId = randomUUID();
+
+ const results = await Promise.allSettled([
+ async () => {
+ const auditLog = await auditLogDAL.create({
+ actor: actor.type,
+ actorMetadata: actor.metadata,
+ userAgent,
+ projectId,
+ projectName: project?.name,
+ ipAddress,
+ orgId,
+ eventType: event.type,
+ expiresAt: new Date(Date.now() + ttl),
+ eventMetadata: event.metadata,
+ userAgentType
+ });
+ await auditLogStreamService.streamLog(orgId!, auditLog);
+ },
+ ...(clickhouseClient && CLICKHOUSE_AUDIT_LOG_ENABLED
+ ? [
+ clickhouseClient.insert({
+ table: CLICKHOUSE_AUDIT_LOG_TABLE_NAME,
+ clickhouse_settings: CLICKHOUSE_AUDIT_LOG_INSERT_SETTINGS,
+ values: [
+ {
+ id: auditLogId,
+ actor: actor.type,
+ actorMetadata: actor.metadata ?? {},
+ ipAddress: ipAddress ?? "",
+ eventType: event.type,
+ eventMetadata: event.metadata ?? {},
+ userAgent: userAgent ?? "",
+ userAgentType: userAgentType ?? "",
+ createdAt: now,
+ projectId: projectId ?? "",
+ orgId
+ }
+ ],
+ format: "JSONEachRow"
+ })
+ ]
+ : [])
+ ]);
+
+ const opNames = ["auditLogDAL", "clickhouseClient"];
+ for (let i = 0; i < results.length; i += 1) {
+ const result = results[i];
+ if (result.status === "rejected") {
+ logger.error(result.reason, `Failed to insert audit log [op=${opNames[i]}] [auditLogId=${auditLogId}]`);
+ }
+ }
}
});
diff --git a/backend/src/lib/config/clickhouse.ts b/backend/src/lib/config/clickhouse.ts
new file mode 100644
index 0000000000..eb74324a8f
--- /dev/null
+++ b/backend/src/lib/config/clickhouse.ts
@@ -0,0 +1,13 @@
+import { type ClickHouseClient, createClient } from "@clickhouse/client";
+
+export type TClickHouseConfigKeys = Partial<{
+ CLICKHOUSE_URL: string;
+}>;
+
+export const buildClickHouseFromConfig = (cfg: TClickHouseConfigKeys): ClickHouseClient | null => {
+ if (!cfg?.CLICKHOUSE_URL) return null;
+
+ return createClient({
+ url: cfg.CLICKHOUSE_URL
+ });
+};
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index fa41d242c3..c18aab6ce1 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -85,6 +85,43 @@ const envSchema = z
AUDIT_LOGS_DB_ROOT_CERT: zpStr(
z.string().describe("Postgres database base64-encoded CA cert for Audit logs").optional()
),
+ CLICKHOUSE_URL: zpStr(
+ z
+ .string()
+ .optional()
+ .describe("ClickHouse connection URL. Eg: http://localhost:8123 or https://user:password@host:8443/default")
+ ),
+ CLICKHOUSE_AUDIT_LOG_INSERT_SETTINGS: zpStr(
+ z
+ .string()
+ .optional()
+ .transform((val) => {
+ if (!val || val.trim() === "")
+ return {
+ async_insert: 1,
+ wait_for_async_insert: 1,
+ date_time_input_format: "best_effort"
+ } as Record<string, string | number | boolean>;
+ return JSON.parse(val) as Record<string, string | number | boolean>;
+ })
+ .default('{"async_insert":1,"wait_for_async_insert":1,"date_time_input_format":"best_effort"}')
+ .describe(
+ 'ClickHouse insert settings as JSON. Eg: {"async_insert":1,"wait_for_async_insert":1}. Applied when inserting audit logs.'
+ )
+ ),
+ CLICKHOUSE_AUDIT_LOG_ENGINE: zpStr(
+ z
+ .string()
+ .optional()
+ .default("ReplacingMergeTree")
+ .describe(
+ "ClickHouse engine for the audit_logs table. Used during migrations. Eg: ReplacingMergeTree or SharedReplacingMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')"
+ )
+ ),
+ CLICKHOUSE_AUDIT_LOG_TABLE_NAME: zpStr(
+ z.string().optional().default("audit_logs").describe("ClickHouse table name for audit logs")
+ ),
+ CLICKHOUSE_AUDIT_LOG_ENABLED: zodStrBool.default("true").describe("Enable inserting audit logs into ClickHouse"),
DISABLE_AUDIT_LOG_STORAGE: zodStrBool.default("false").optional().describe("Disable audit log storage"),
GENERATE_SANITIZED_SCHEMA: zodStrBool
.default("false")
@@ -416,6 +453,7 @@ const envSchema = z
isCloud: Boolean(data.LICENSE_SERVER_KEY),
isSmtpConfigured: Boolean(data.SMTP_HOST),
isRedisConfigured: Boolean(data.REDIS_URL || data.REDIS_SENTINEL_HOSTS || data.REDIS_CLUSTER_HOSTS),
+ isClickHouseConfigured: Boolean(data.CLICKHOUSE_URL),
isDevelopmentMode: data.NODE_ENV === "development",
isTestMode: data.NODE_ENV === "test",
isRotationDevelopmentMode:
diff --git a/backend/src/main.ts b/backend/src/main.ts
index f37d0886fa..292cf2d09c 100644
--- a/backend/src/main.ts
+++ b/backend/src/main.ts
@@ -12,6 +12,7 @@ import { runMigrations } from "./auto-start-migrations";
import { initAuditLogDbConnection, initDbConnection } from "./db";
import { hsmServiceFactory } from "./ee/services/hsm/hsm-service";
import { keyStoreFactory } from "./keystore/keystore";
+import { buildClickHouseFromConfig } from "./lib/config/clickhouse";
import { formatSmtpConfig, getDatabaseCredentials, getHsmConfig, initEnvConfig } from "./lib/config/env";
import { buildRedisFromConfig } from "./lib/config/redis";
import { axiosResponseInterceptor } from "./lib/config/request";
@@ -68,7 +69,13 @@ const run = async () => {
})
: undefined;
- await runMigrations({ applicationDb: db, auditLogDb, logger });
+ const clickhouse = buildClickHouseFromConfig(envConfig);
+ await runMigrations({
+ applicationDb: db,
+ auditLogDb,
+ clickhouseClient: clickhouse,
+ logger
+ });
const smtp = smtpServiceFactory(formatSmtpConfig());
@@ -90,6 +97,7 @@ const run = async () => {
queue,
keyStore,
redis,
+ clickhouse,
envConfig
});
diff --git a/backend/src/server/app.ts b/backend/src/server/app.ts
index 30e485d39d..ef22bf43d2 100644
--- a/backend/src/server/app.ts
+++ b/backend/src/server/app.ts
@@ -1,6 +1,7 @@
/* eslint-disable import/extensions */
import path from "node:path";
+import type { ClickHouseClient } from "@clickhouse/client";
import type { FastifyCookieOptions } from "@fastify/cookie";
import cookie from "@fastify/cookie";
import type { FastifyCorsOptions } from "@fastify/cors";
@@ -45,6 +46,7 @@ type TMain = {
queue: TQueueServiceFactory;
keyStore: TKeyStoreFactory;
redis: Redis | Cluster;
+ clickhouse: ClickHouseClient | null;
envConfig: TEnvConfig;
superAdminDAL: TSuperAdminDALFactory;
hsmService: THsmServiceFactory;
@@ -60,6 +62,7 @@ export const main = async ({
queue,
keyStore,
redis,
+ clickhouse,
envConfig,
superAdminDAL,
hsmService,
@@ -175,6 +178,7 @@ export const main = async ({
db,
auditLogDb,
keyStore,
+ clickhouse,
hsmService,
envConfig,
superAdminDAL,
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 9b9117b0e9..eb8e70c6e3 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -1,4 +1,5 @@
import { registerBddNockRouter } from "@bdd_routes/bdd-nock-router";
+import type { ClickHouseClient } from "@clickhouse/client";
import { CronJob } from "cron";
import { Knex } from "knex";
import { monitorEventLoopDelay } from "perf_hooks";
@@ -434,6 +435,7 @@ export const registerRoutes = async (
smtp: smtpService,
queue: queueService,
keyStore,
+ clickhouse,
envConfig,
hsmService,
kmsRootConfigDAL
@@ -444,6 +446,7 @@ export const registerRoutes = async (
smtp: TSmtpService;
queue: TQueueServiceFactory;
keyStore: TKeyStoreFactory;
+ clickhouse: ClickHouseClient | null;
envConfig: TEnvConfig;
hsmService: THsmServiceFactory;
kmsRootConfigDAL: TKmsRootConfigDALFactory;
@@ -758,7 +761,8 @@ export const registerRoutes = async (
queueService,
projectDAL,
licenseService,
- auditLogStreamService
+ auditLogStreamService,
+ clickhouseClient: clickhouse
});
const notificationQueue = notificationQueueServiceFactory({
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index aa8bd8ebd1..a660c624cd 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -34,6 +34,26 @@ services:
volumes:
- redis_data:/data
+ clickhouse:
+ image: clickhouse/clickhouse-server:25.12.5
+ container_name: infisical-dev-clickhouse
+ restart: unless-stopped
+ ports:
+ - "8123:8123"
+ - "9000:9000"
+ volumes:
+ - clickhouse_data:/var/lib/clickhouse
+ - clickhouse_logs:/var/log/clickhouse-server
+ environment:
+ - CLICKHOUSE_DB=default
+ - CLICKHOUSE_USER=default
+ - CLICKHOUSE_PASSWORD=clickhouse
+ - CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1
+ ulimits:
+ nofile:
+ soft: 262144
+ hard: 262144
+
redis-commander:
container_name: infisical-dev-redis-commander
image: rediscommander/redis-commander
@@ -65,6 +85,8 @@ services:
condition: service_started
redis:
condition: service_started
+ clickhouse:
+ condition: service_started
env_file:
- .env
ports:
@@ -196,6 +218,10 @@ volumes:
driver: local
redis_data:
driver: local
+ clickhouse_data:
+ driver: local
+ clickhouse_logs:
+ driver: local
ldap_data:
ldap_config:
grafana_storage: