sourcegraph/dev/zoekt/wrapper
Stefan Hengl c61b0f1a7b
all: /bin/bash -> /usr/bin/env bash (#23673)
I ran into issues setting up Sourcegraph on NixOS, because NixOS, like
some other distros, doesn't have a /bin/bash. We already use /usr/bin/env
in many of our scripts, so this improves consistency, too.
2021-08-06 12:02:43 +02:00

43 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euf -o pipefail
cmd="${1:-}"
replica="${2:-0}"
index="$HOME/.sourcegraph/zoekt/index-$replica"
if ((replica != 0)) && [[ -n "${DISABLE_SEARCH_SHARDING-}" ]]; then
exit 0
fi
webport=$((3070 + replica))
indexport=$((6072 + replica))
# Mirroring:
# - https://github.com/sourcegraph/infrastructure/blob/d67cfdaf7760b926df165745e40f7bd9507d1c20/docker-images/zoekt-indexserver/Dockerfile#L28-L35
# - https://github.com/sourcegraph/infrastructure/blob/d67cfdaf7760b926df165745e40f7bd9507d1c20/docker-images/zoekt-webserver/Dockerfile#L27-L34
export GOGC=50
case "$cmd" in
indexserver)
exec zoekt-sourcegraph-indexserver \
-sourcegraph_url http://localhost:3090 \
-index "$index" \
-hostname "localhost:$webport" \
-interval 1m \
-listen ":$indexport" \
-cpu_fraction 0.25
;;
webserver)
exec env JAEGER_DISABLED=false zoekt-webserver -index "$index" -pprof -rpc -listen ":$webport"
;;
*)
echo "USAGE: $0 (indexserver|webserver)"
exit 1
;;
esac