Install Sourcegraph via Shell Script
Following these docs will launch a pre-configured single node Sourcegraph instance via shell script.
The script can be run on the following distros.
- Amazon Linux 2
As it is impossible to test all possible deployment environments it is possible albeit unlikely to encounter an error. We highly suggest using one of our curated Machine Images if possible.
Instance Size Chart
Determine the instance type required to support the number of users and repositories you have using this table. If you fall between two sizes, choose the larger of the two.
For example, if you have 8,000 users with 80,000 repositories, your instance size would be L. If you have 1,000 users with 80,000 repositories, you should go with size M.
|Users||<= 500||<= 1,000||<= 5,000||<= 10,000||<= 20,000|
|Repositories||<= 5,000||<= 10,000||<= 50,000||<= 100,000||<= 250,000|
|Recommended vCPU / RAM||8 / 32 GiB||16 / 64 GiB||32 / 128 GiB||48 / 192 GiB||96 / 384 GiB|
|Minimum vCPU / RAM||8 / 32 GiB||8 / 32 GiB||16 / 64 GiB||32 / 128 GiB||48 / 192 GiB|
Before running the install script please ensure ensure the target machine meets the following prerequisites.
- Sufficient CPU and RAM according to the instance size chart
- A root disk size with
50 GiBfree space for ephemeral data.
- A secondary disk of size
250 GiBminimum. Adjust to your specific needs.
- A non-root user with
sudopermissions to execute the script
IMPORTANT For optimal performance both disks should be backed by SSDs or equivalently fast storage.
The script accepts the following parameters:
The data disk where Sourcegraph persistent data should be stored e.g.
The script will format the disk if it has not been formatted already. If you choose to format and mount the disk yourself it must be mounted to
/mnt/dataMUST be a separate disk than e.g. the base OS for upgrades.
The Instance Size to use. Defaults to
The Sourcegraph version to deploy. Defaults to the latest version
curl -sfL https://raw.githubusercontent.com/sourcegraph/deploy/main/install/scripts/k3s/install.sh | bash -s -- <args>
Sourcegraph will be available on ports 80 and 443 (using a self signed certificate).
We recommend deploying your own reverse proxy to terminate TLS connections with a properly signed certificate.
IMPORTANT Back up your volumes before each upgrade
- Shutdown the current machine running the Sourcegraph instance
- Detach the data disk
- Launch a new machine with the same specification as the current instance
- Use the existing data disk in place of creating a new one
- Run the install script targeting the data disk.
- Wait for Sourcegraph to start.
Please refer to the upgrade procedure above if you wish to rollback your instance.
Storage and Backups
We strongly recommend taking snaphots of the data disk on an automatic, scheduled basis.