A fast, precise code search solution that integrates Zoekt with GitLab. This project provides the infrastructure for indexing and searching code across GitLab repositories with high performance and accuracy.
gitlab-zoekt is built on top of Zoekt, a fast code search engine maintained by Sourcegraph. It creates specialized search indexes of GitLab repositories by communicating with Gitaly (GitLab's Git repository storage service) and provides a search API for performing fast, exact and regex searches across indexed code.
Key features:
This repository includes three binaries:
gitlab-zoekt-indexer: Original indexer binarygitlab-zoekt-webserver: Original webserver binarygitlab-zoekt: New unified binary that can run in either indexer or webserver mode# Build the original indexer (deprecated)
$ make build
$ ./bin/gitlab-zoekt-indexer
2023/08/14 11:07:29 Usage: ./bin/gitlab-zoekt-indexer [ --version | --index_dir=<DIR> | --path_prefix=<PREFIX> | --listen=:<PORT> ]
# Build the original webserver (deprecated)
$ make build-web
# Build the unified binary
$ make build-unified
$ ./bin/gitlab-zoekt
Usage: ./bin/gitlab-zoekt <command> [options]
Commands:
indexer Run in indexer mode
webserver Run in webserver mode
version Print version information
For command specific help:
./bin/gitlab-zoekt <command> -help
The unified binary supports both indexer and webserver modes:
# Run in indexer mode
$ ./bin/gitlab-zoekt indexer -index_dir=/data/index -listen=:6060
# Run in CI/testing mode (skips gitlab_url and self_url requirements)
$ ./bin/gitlab-zoekt indexer -index_dir=/data/index -listen=:6060 -ci
# Run in webserver mode
$ ./bin/gitlab-zoekt webserver -index_dir=/data/index -listen=:6070
# Show help for a specific mode
$ ./bin/gitlab-zoekt indexer -help
$ ./bin/gitlab-zoekt webserver -help
# Show version information
$ ./bin/gitlab-zoekt version
GDK_DIR env variable (for example, export GDK_DIR="$HOME/projects/gdk").gdk stop gitlab-zoekt-indexer-development-1 gitlab-zoekt-indexer-development-2 gitlab-zoekt-webserver-development-1 gitlab-zoekt-webserver-development-2
make gdk. This will replace GDK processes with the unified binary from this repo.[!note] If your gitlab is different from
http://localhost:3000, please also setGDK_GITLAB_URL. For example:export GDK_GITLAB_URL="https://gdk.test:3443"
For trying out zoekt. Not an official installation method.
See example
make build-unified
docker-compose up
# One time
make test
# On every change (requires https://github.com/watchexec/watchexec installed)
make watch-test
go build -o zoekt-index ./cmd/zoekt-index
./zoekt-index -index /tmp/.zoekt -meta ~/code/gitlab-zoekt/_support/test/309.meta.json ~/code/gitlab-zoekt
In order to release the changes to GitLab.com production, follow these steps:
Bump up the VERSION file in this repository following semantic versioning
Update the version file in the monolith Note: MR is created automatically via Renovate bot.
Changing this allows the Monolith run specs against the newer Zoekt Indexer. This file is also planned to be used for OmniBus in the future, to indicate which Zoekt Indexer to run.
Prepare a CNG MR to release a new image. Example: !2533
Deploy to GSTG by updating gstg.zoekt-versions.yaml. Example MR: !4607
Deploy to GPRD by updating gprd.zoekt-versions.yaml. Example MR: !4616
After we verify that everything works as expected for a few days, we can release the same change to SM customers:
gitlab-zoekt. Example: !121