Skip to content

Commit 5a993cd

Browse files
authored
doc(testing): Locally (#1)
Signed-off-by: Julio Jimenez <julio@julioj.com>
1 parent 54b1fcc commit 5a993cd

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,35 @@ Protocol notes (all handled by `clicklisp udf`):
188188
- The UDF streams are byte-transparent (latin-1), so non-UTF-8 bytes in
189189
String values round-trip instead of crashing the process.
190190

191+
### Trying it against a local ClickHouse
192+
193+
Run a ClickHouse server in Docker with the static Linux binary (from
194+
`scripts/build-static.sh` or a release) mounted into `user_scripts_path`
195+
— on Apple Silicon the aarch64 build runs natively in the container:
196+
197+
```sh
198+
# clicklisp-linux-aarch64 on Apple Silicon, clicklisp-linux-x86_64 on Intel
199+
docker run -d --name clicklisp-ch \
200+
-v "$PWD/dist/clicklisp-linux-aarch64:/var/lib/clickhouse/user_scripts/clicklisp" \
201+
-v "$PWD/examples/clicklisp_function.xml:/etc/clickhouse-server/clicklisp_function.xml" \
202+
clickhouse/clickhouse-server:latest
203+
204+
docker exec clicklisp-ch clickhouse-client \
205+
-q "SELECT clicklisp_entropy('q7x9z2j4k8w1'), clicklisp_rot13('uryyb')"
206+
```
207+
208+
Detection rules compile on the host and pipe straight into the server,
209+
calling back into the Lisp UDF:
210+
211+
```sh
212+
bin/clicklisp rules sql --load examples/rules.lisp dga-domains \
213+
| grep -v '^--' \
214+
| docker exec -i clicklisp-ch clickhouse-client --format PrettyCompact
215+
```
216+
217+
UDF stderr (failed rows, hot-reload notices) lands in the server log:
218+
`docker logs clicklisp-ch`. Tear down with `docker rm -f clicklisp-ch`.
219+
191220
### Hot patching
192221

193222
`--watch` re-loads a Lisp file whenever it changes, *while the pool process

0 commit comments

Comments
 (0)