Building and Starting Zoekt

This document provides a step-by-step guide on building and starting the Zoekt project.

Using go build

  1. Clone the repository:

    git clone https://github.com/sourcegraph/zoekt.git
    cd zoekt
    
  2. Build the project:

    go build
    

    This command builds the Zoekt executable. The resulting binary will be named zoekt and placed in the current directory.

  3. Run the Zoekt server:

    ./zoekt -http :8080 -data /path/to/index/directory -ui /path/to/ui/directory
    
    • Replace /path/to/index/directory with the actual path to the directory where you want to store the index.
    • Replace /path/to/ui/directory with the actual path to the directory where you want to store the UI.
    • The -http :8080 flag specifies the port the server will listen on. You can change this to a different port if desired.

Using Docker

  1. Build the Docker image:

    docker build -t zoekt .
    
  2. Run the Docker container:

    docker run -d -p 8080:8080 -v /path/to/index/directory:/data -v /path/to/ui/directory:/ui zoekt
    
    • Replace /path/to/index/directory with the actual path to the directory where you want to store the index.
    • Replace /path/to/ui/directory with the actual path to the directory where you want to store the UI.

Using Nix

  1. Install Nix:

    curl -L https://nixos.org/nix/install | sh
    
  2. Build the project:

    nix-build
    

    This command builds the Zoekt project using Nix.

  3. Run the Zoekt server:

    ./result/bin/zoekt -http :8080 -data /path/to/index/directory -ui /path/to/ui/directory
    
    • Replace /path/to/index/directory with the actual path to the directory where you want to store the index.
    • Replace /path/to/ui/directory with the actual path to the directory where you want to store the UI.
    • The -http :8080 flag specifies the port the server will listen on. You can change this to a different port if desired.

This guide covers the basic steps of building and starting Zoekt. For more advanced usage, please refer to the official documentation.

Source: https://github.com/sourcegraph/zoekt