While looking up developer docs about a couple things, I felt compelled to do a bit of cleanup. We had two docs, `dev/index.md` and `dev/background-information/index.md`, which featured the same lengthy table of contents to other subpages. The two lists were meant to be identical, as was noted by a comment at the top of the latter doc: ``` <!-- Link back any new sections to doc/dev/index.md as well --> ``` But the lists had actually diverged quite a bit, and frankly it just felt redundant to have the latter doc when it was literally only this table of contents and nothing else. So I removed the redundant doc, merged the lists, dropped outdated and duplicative subpage links, and regrouped a couple sections that only had one or two items listed under then. The header hierarchy had also gotten messed up in a couple ways (for example SQL was listed as a subsection of `git` 🤪), so I fixed that up. This hopefully means both maintaining and browsing the developer docs will be easier! I have left a couple comments inline to clarify items that were moved or removed. ## Test plan Tested locally, tried to verify most links still worked! Also verified the ToC hierarchy is corrected: <img width="366" alt="image" src="https://github.com/sourcegraph/sourcegraph/assets/8942601/df064955-6c8f-4a40-bfd2-bf493fc0ec40"> <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles -->
3.5 KiB
Quickstart for setting up the local environment
This is the quickstart guide for developing Sourcegraph.
NOTE: If you run into any troubles, you can alternatively consult the deprecated quickstart instructions without
sgor 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.
Install sg
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.
Ensure you have SSH setup for GitHub
Follow the instructions on Adding a new SSH key to your GitHub account for checking if you have an existing SSH for your current machine and setting one up if not.
Run sg setup
In the directory where you want the sourcegraph repository to be checked out, 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.
Run databases
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.
Start Sourcegraph
If you are a Sourcegraph employee, start the local development server for Sourcegraph Enterprise with the following command:
sg start
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!
Running Sourcegraph in different configurations
If you want to run Sourcegraph in different configurations (with the monitoring stack, with code insights enabled...), 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
Additional resources
Here are some additional resources to help you go further:
- Full
sgreference - Troubleshooting local development
- Continuous integration
- Background information for more context on various topics.