Enable code intelligence auto-indexing

This how-to explains how to turn on auto-indexing on your Sourcegraph instance to enable precise code intelligence.

Deploy executors

First, deploy the executor service targeting your Sourcegraph instance. This will provide the necessary compute resources that clone the target Git repository, securely analyze the code to produce a precise code intelligence index, then upload that index to your Sourcegraph instance for processing.

Enable index job scheduling

Next, enable the precise code intelligence auto-indexing feature by enabling the following feature flag in your Sourcegraph instance's site configuration.

{
  "codeIntelAutoIndexing.enabled": true
}

This step will control the scheduling of indexing jobs which are made available to the executors deployed in the previous step.

Configure auto-indexing policies

Once auto-indexing has been enabled, create auto-indexing policies to control the set of repositories and commits that are eligible for indexing.

Tune the index scheduler

The frequency of index job scheduling can be tuned via the following environment variables read by worker service containers running the codeintel-auto-indexing task.

PRECISE_CODE_INTEL_AUTO_INDEXING_TASK_INTERVAL: The frequency with which to run periodic codeintel auto-indexing tasks. Default is every 10 minutes.

PRECISE_CODE_INTEL_AUTO_INDEXING_REPOSITORY_PROCESS_DELAY: The minimum frequency that the same repository can be considered for auto-index scheduling. Default is every 24 hours.

PRECISE_CODE_INTEL_AUTO_INDEXING_REPOSITORY_BATCH_SIZE: The number of repositories to consider for auto-indexing scheduling at a time. Default is 100.

PRECISE_CODE_INTEL_AUTO_INDEX_MAXIMUM_REPOSITORIES_INSPECTED_PER_SECOND: The maximum number of repositories inspected for auto-indexing per second. Set to zero to disable limit. Default is 0.