Initial commit

This commit is contained in:
root 2020-08-16 19:09:32 +00:00
commit a512f9cd94
2 changed files with 53 additions and 0 deletions

26
deploy.sh Executable file
View File

@ -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

27
script Normal file
View File

@ -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");
}
}