From a512f9cd94d37d4efdbbd78619d1799c0e6e430d Mon Sep 17 00:00:00 2001 From: root Date: Sun, 16 Aug 2020 19:09:32 +0000 Subject: [PATCH] Initial commit --- deploy.sh | 26 ++++++++++++++++++++++++++ script | 27 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 deploy.sh create mode 100644 script diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..63e8efd --- /dev/null +++ b/deploy.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +docker pull simon987/sist2:latest + +ES=http://db.lxd:9200 + + +rm -rf ./*.idx 2> /dev/null + +docker run --rm -v $(pwd)/:/host simon987/sist2:latest scan --name "Demo files" -q 1.0 -t 12 --content-size 99999999 /host/demo_files/ -o /host/demo.idx +docker run --rm -v $(pwd)/:/host simon987/sist2:latest scan --name "Linux source code" -q 1 -t 12 --content-size 99999999 /host/linux/ -o /host/linux.idx +docker run --rm -v $(pwd)/:/host simon987/sist2:latest scan --name "Biodiversity Heritage Library" -t 12 -q 1 /host/bhl/ -o /host/bhl.idx + +docker run --rm -v $(pwd)/:/host simon987/sist2:latest index --es-url $ES /host/demo.idx + +docker run --rm -v $(pwd)/:/host simon987/sist2:latest index --es-url $ES -t 7 --batch-size 40 /host/linux.idx +sleep 30 +docker run --rm -v $(pwd)/:/host simon987/sist2:latest exec-script --es-url $ES --script-file /host/script /host/linux.idx + +docker run --rm -v $(pwd)/:/host simon987/sist2:latest index --es-url $ES /host/bhl.idx + + +docker rm -f sist2_demo +docker run --name sist2_demo --restart always -d -v $(pwd)/:/host -p 4090:4090 \ + simon987/sist2:latest web --bind 0.0.0.0:4090 --very-verbose --es-url $ES \ + /host/demo.idx /host/linux.idx /host/bhl.idx diff --git a/script b/script new file mode 100644 index 0000000..3cf5823 --- /dev/null +++ b/script @@ -0,0 +1,27 @@ +ArrayList tags = ctx._source.tag = new ArrayList(); + +if (ctx._source?.mime == "text/x-c") { + tags.add("language.c"); + + if (ctx._source.extension == "h") { + tags.add("language.c.header"); + } else if (ctx._source.extension == "dts") { + tags.add("language.c.device tree source"); + } +} else if (ctx._source?.mime == "text/x-asm") { + tags.add("language.assembly"); + + if (ctx._source.path.contains("/arm/") || ctx._source.path.contains("/arm64/")) { + tags.add("language.assembly.ARM#2459b5"); + } else if (ctx._source.path.contains("/powerpc/")) { + tags.add("language.assembly.PPC#53d836"); + } else if (ctx._source.path.contains("/mips/")) { + tags.add("language.assembly.MIPS#c3d639"); + } else if (ctx._source.path.contains("/csky/")) { + tags.add("language.assembly.csky#c44023"); + } else if (ctx._source.path.contains("/sparc/")) { + tags.add("language.assembly.sparc#d81cd2"); + } else if (ctx._source.path.contains("/x86/")) { + tags.add("language.assembly.x86#7e21ef"); + } +}