Zoekt is an open-source code search engine developed by Sourcegraph. It can be integrated with Sourcegraph to provide enhanced code search and navigation capabilities. Here are the possible options for integrating Zoekt with Sourcegraph:
- Running Zoekt as a separate service:
Zoekt can be run as a separate service that listens for queries and returns search results. Sourcegraph can be configured to use Zoekt as its code search backend by setting the
searchEngineURL
configuration option to the URL of the Zoekt service.
Example:
searchEngineURL = "http://zoekt:9200/-/index/your-index-name"
- Running Zoekt as a Docker container:
Zoekt can be run as a Docker container, which can be easily integrated with Sourcegraph. The
docker-compose.yml
file provided by Sourcegraph can be used to run both Sourcegraph and Zoekt together.
Example:
services:
sourcegraph:
image: sourcegraph/sourcegraph:${SOURCEGRAPH_VERSION:-latest}
ports:
- "3080:3080"
volumes:
- ./sourcegraph:/var/sourcegraph/data
- ./src-data:/var/src-data
depends_on:
- zoekt
zoekt:
image: sourcegraph/zoekt:${ZOEKT_VERSION:-latest}
ports:
- "9200:9200"
volumes:
- ./zoekt-data:/var/zoekt/data
Source: https://github.com/sourcegraph/sourcegraph/blob/main/docker-compose.yml
- Running Zoekt as a Kubernetes service:
Zoekt can be run as a Kubernetes service, which can be easily integrated with a Sourcegraph deployment on Kubernetes. The
zoekt-deployment.yaml
andzoekt-service.yaml
files provided by Sourcegraph can be used to deploy Zoekt on Kubernetes.
Example:
apiVersion: apps/v1
kind: Deployment
metadata:
name: zoekt
spec:
replicas: 1
selector:
matchLabels:
app: zoekt
template:
metadata:
labels:
app: zoekt
spec:
containers:
- name: zoekt
image: sourcegraph/zoekt:${ZOEKT_VERSION:-latest}
ports:
- containerPort: 9200
volumeMounts:
- name: zoekt-data
mountPath: /var/zoekt/data
volumes:
- name: zoekt-data
persistentVolumeClaim:
claimName: zoekt-data
---
apiVersion: v1
kind: Service
metadata:
name: zoekt
spec:
selector:
app: zoekt
ports:
- name: http
port: 9200
targetPort: 9200
type: ClusterIP
Source: https://github.com/sourcegraph/sourcegraph/tree/main/deploy/kubernetes/zoekt
In all of the above options, Zoekt can be configured to index specific repositories or all repositories in the Sourcegraph instance. The zoekt-indexer.yml
file provided by Sourcegraph can be used to configure Zoekt indexing.
Example:
indexer:
# The name of the index to create.
index: your-index-name
# The repositories to index.
repositories:
- git://github.com/sourcegraph/sourcegraph
- git://github.com/sourcegraph/zoekt
# The Zoekt server to connect to.
server:
url: http://zoekt:9200
# Optional:
# headers:
# - name: X-My-Header
# value: my-value
Overall, Zoekt provides a powerful and flexible code search engine that can be easily integrated with Sourcegraph to provide enhanced code search and navigation capabilities.