This is the quickstart guide for developing Sourcegraph.
NOTE: If you run into any troubles, you can alternatively consult the deprecated quickstart instructions without
sg
or reach out on Slack:You can also get help on our developer experience discussion forum.
NOTE: Looking for how to deploy or use Sourcegraph? See our getting started options.
At Sourcegraph we use sg
, the Sourcegraph developer tool, to manage our local development environment.
To install sg
, run the following in your terminal:
curl --proto '=https' --tlsv1.2 -sSLf https://install.sg.dev | sh
See the sg
documentation for more information or ask in the #dev-experience
Slack channel.
Open a terminal and run the following command:
sg setup
Follow the printed instructions, which will guide you through the installation of all the necessary dependencies to start the local development environment.
If you chose to run PostgreSQL and Redis without Docker (recommended) they should already be running. You can jump to the next section.
If you chose to run Redis and PostgreSQL with Docker, we need to run them:
sg run redis-postgres
Keep this process running and follow the rest of the instructions in another terminal.
If you are a Sourcegraph employee, start the local development server for Sourcegraph Enterprise with the following command:
sg start
If you are not a Sourcegraph employee and don't have access to the dev-private
repository, you want to start Sourcegraph OSS instead:
sg start oss
This will continuously compile your code and live reload your locally running instance of Sourcegraph.
Navigate your browser to https://sourcegraph.test:3443 to see if everything worked.
Congratulations on making it to the end of the quickstart guide!
If you want to run Sourcegraph in different configurations (with the monitoring stack, with code insights enabled, Sourcegraph OSS, ...), run the following:
sg start -help
That prints a list of possible configurations which you can start with sg start
.
For example, you can start Sourcegraph in the mode it uses on Sourcegraph.com by running the following in one terminal window
sg start dotcom
and then, in another terminal window, start the monitoring stack:
sg start monitoring
Here are some additional resources to help you go further:
- Full
sg
reference - Troubleshooting local development
- Continuous integration
- Background information for more context on various topics.