← Back to Guides
Profile image for Marco Suter

By Marco Suter

Published 14th April 2022

Deploy Sourcegraph on Northflank

In this guide, we show you how to easily create a single-instance deployment of Sourcegraph. Sourcegraph allows you to search, navigate and analyse your source code repositories with a number of powerful tools.

To deploy Sourcegraph on Northflank, we will use their public Docker image and to persist data across restarts we will add a volume to the service. Keep reading for the detailed steps!

  1. Create a new deployment service with following configuration

    1. External image with path sourcegraph/server:3.38.1.

    2. Under networking port, 7080 (HTTP), make sure to tick "Publicly expose this port to the internet".

    3. Under resources it's recommended to use a plan nf-compute-100 or larger to ensure appropriate app performance.

    4. Under advanced, add a new persistent volume.

      1. Add a container mount path /var/opt/sourcegraph, tick "Use custom volume mount paths" and use data as "Volume mount path" for this container mount path.

      2. Add a second container mount path /etc/sourcegraph and use config as "Volume mount path" for this container mount path.

      • Choose storage size according to your needs (generally, larger and more complex repositories require more storage size). This can also be increased later if your storage needs change.

      Sourcegraph on Northflank, deployment steps

  2. Wait for your Sourcegraph instance to start up and open the web interface by clicking on the link in the upper right corner of your service.

  3. On the initial Sourcegraph page, you'll be asked to create an account.

  4. After having logged-in, you'll encounter the "Site Admin" page which allows you to manage your Sourcegraph instance. We recommend to configure a few settings:

    1. Add external URL: Go to menu entry "Site configuration", click "Set external URL" and enter the URL of your service. This is the URL of your Sourcegraph app and will be something like https://p01--sourcegraph--sourcegraph--marc-vits.code.run (Don't forget to add the https:// prefix).

      URL site configuration for Sourcegraph on Northflank

    2. Next, we want to add a git repository provider. We'll use Github, but Sourcegraph allows to add a large number of git providers. Click "Manage code hosts" and then "Add code host" and "Github".

      a. Create an access token by following the steps outlined in their documentation. Then, paste it into the token field in the JSON config.

      b. You can optionally include or exclude certain repositories.

      c. Click "Update repository".

      Add Github on Sourcegraph, deployment on Northflank

  5. You are now ready to use your own instance of Sourcegraph to search your repositories.

If you encounter any issues while following this guide we're happy to assist you with your Sourcegraph deployment at support@northflank.com. At Northflank we also have dedicated support plans for business customers.

How to deploy Sourcegraph on Northflank with their Docker image

Northflank allows you to deploy your code within minutes. Sign up for a Northflank account and create a free project to get started.

  • Multiple read and write replicas
  • Observe & monitor with real-time metrics & logs
  • Low latency and high performance
  • Private and optional public load balancing as well as Northflank local proxy
  • Dedicated support plans

Share this article with your network