Migrating from Oracle OpenGrok to Sourcegraph for code search

You can migrate from Oracle's OpenGrok to Sourcegraph for code search by following the steps in this document.


Sourcegraph is a self-hosted code search and intelligence tool that helps developers find, review, understand, and debug code. Organizations that switch from OpenGrok to Sourcegraph typically cite the following reasons:

  • Sourcegraph supports searching any revision (not just specific branches) and does not require waiting for periodic reindexing.
  • Sourcegraph's query syntax, user interface, and integrations are superior and easier to use.
  • Sourcegraph's code navigation, has better language support (hover tooltips, definitions, references, implementations, etc.) and is based on the Language Server Protocol standard.
  • The Sourcegraph API is more powerful, better documented, and easier to use than OpenGrok's API.
  • Sourcegraph scales to more repositories/users and supports Kubernetes-based clustered/high-availability deployments better (with the cluster deployment option).

Both Sourcegraph and OpenGrok are self-hosted, and your code never touches Sourcegraph's (or Oracle's) servers.

Oracle releases OpenGrok under the open-source CDDL license and does not (currently) have any monetization plans for it. Sourcegraph is a commercial product, with a free tier and paid premium features available.

Every organization's needs are different. Try Sourcegraph for free to see if it's right for your organization.

For more information about Sourcegraph, see:

Migration guide

Migrating from Oracle OpenGrok to Sourcegraph consists of 4 steps:

  1. Deploying Sourcegraph
  2. Configuring repositories
  3. Configuring user authentication
  4. Rolling out Sourcegraph organization-wide

The following sections guide you through the migration process.

Deploying Sourcegraph

We offer several methods for deploying Sourcegraph for various requirements—see Getting started to learn more about how to get started with Sourcegraph.

Choose a deployment option and follow the instructions. When you've signed into your Sourcegraph instance as a site admin, continue to the next section.

Configuring repositories

Sourcegraph and Oracle OpenGrok differ in how they access repositories:

Sourcegraph's "active" model lets it:

  • serve fresher repository data (to search and browse just-git pushed data);
  • synchronize the list of repositories on the code host (so that newly added repositories are searchable/browseable)
  • offer code host integrations and "View file on code host" links

Sourcegraph also partially supports the "passive" model like OpenGrok, but it's not recommended because you lose these benefits. To use it anyway, see "Add repositories already cloned to disk".

To configure which repositories Sourcegraph will make available for searching and browsing:

  • For repositories on popular code hosts, use the Quick configure actions on your Sourcegraph instance's site admin "Site configuration" page.
  • For other repositories and for more information, see "Add repositories" in the Sourcegraph documentation.

When you've added repositories and confirmed that you can search and browse them, continue to the next section.

Configuring user authentication

Like Oracle OpenGrok, Sourcegraph is self-hosted. You control who can access it. Sourcegraph supports many user authentication and security options:

Rolling out Sourcegraph organization-wide

After you've set Sourcegraph up, it's time to share it with your organization. Successful roll-outs of Sourcegraph typically involve the following steps.

  • Send a message (in team chat or email) announcing Sourcegraph:

    I set up Sourcegraph as a possible alternative to OpenGrok for code search. [Describe the perceived benefits vs. OpenGrok that are most relevant to your organization.]

    Try it:

    • Search: [URL to an example search results page on your Sourcegraph instance]
    • Code browsing: [URL to a code file page on your Sourcegraph instance]

    [Include screenshots of your Sourcegraph instance here]

    Post feedback at https://github.com/sourcegraph/sourcegraph [change if needed]

  • Create an internal document based on the Sourcegraph tour, substituting links to and names of your organization's code. This explains how Sourcegraph helps developers perform common tasks better.

  • Encourage installation of the browser extension to get Sourcegraph code navigation and search in your organization's existing code host.

  • Roll out the Chrome extension using Google Workspace automatic installation to everyone in your organization.

  • Check the access logs for OpenGrok to see what users search for. Try searching for the same things on Sourcegraph, and ensure that you get the expected results. (Note: Sourcegraph's search query syntax differs from OpenGrok's.)

  • Monitor your Sourcegraph instance's site admin "Analytics" page to see who's using it. Ask them for specific feedback. Also seek feedback from the most frequent users of OpenGrok.

If there are any blockers preventing your organization from switching to Sourcegraph, we'd love to hear from you so we can address them.

Let us know how we can help! File an issue with feedback/problems/questions, or contact us directly.