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!
Create a new deployment service with following configuration
External image with path
sourcegraph/server:3.38.1
.Under networking port, 7080 (HTTP), make sure to tick "Publicly expose this port to the internet".
Under resources it's recommended to use a plan
nf-compute-100
or larger to ensure appropriate app performance.Under advanced, add a new persistent volume.
Add a container mount path
/var/opt/sourcegraph
, tick "Use custom volume mount paths" and usedata
as "Volume mount path" for this container mount path.Add a second container mount path
/etc/sourcegraph
and useconfig
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.
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.
On the initial Sourcegraph page, you'll be asked to create an account.
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:
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 thehttps://
prefix).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".
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.
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