Skip to content

Commit 0941a83

Browse files
authored
add docs about configuring gitserver's replica count before initally deploying to the cluster (sourcegraph#81)
1 parent dd7c0e9 commit 0941a83

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

docs/configure.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,22 +298,38 @@ We also have the following experimental language servers (please [read about the
298298
299299
## Configure gitserver replica count
300300
301-
Repository clones are consistently striped across all `gitserver` replicas. Other services need to be aware of how many `gitserver` replicas exist so they can resolve an individual repo.
301+
**Note:** If you're creating a new cluster and would like to change `gitserver`'s replica count, do
302+
so _before_ running `./kubectl-apply-all.sh` for the first time. Changing this after the cluster
303+
configuration has been applied will require manually resizing the `indexed-search` volume.
304+
305+
Increasing the number of `gitserver` replicas can improve performance when your instance contains a large number of repositories. Repository clones are consistently striped across all `gitserver` replicas. Other services need to be aware of how many `gitserver` replicas exist so they can resolve an individual repo.
302306
303307
To change the number of `gitserver` replicas:
304308
305309
1. Update the `replicas` field in [gitserver.StatefulSet.yaml](../base/gitserver/gitserver.StatefulSet.yaml).
306-
2. Update the `SRC_GIT_SERVERS` environment variable in all services to reflect the number of replicas.
310+
1. Update the `SRC_GIT_SERVERS` environment variable in all services to reflect the number of replicas.
307311
308-
For example, if there are 2 gitservers then `SRC_GIT_SERVERS` should have the value `gitserver-0.gitserver:3178 gitserver-1.gitserver:3178`.
312+
For example, if there are 2 gitservers then `SRC_GIT_SERVERS` should have the value `gitserver-0.gitserver:3178 gitserver-1.gitserver:3178`:
309313
310314
```yaml
311315
- env:
312316
- name: SRC_GIT_SERVERS
313317
value: gitserver-0.gitserver:3178 gitserver-1.gitserver:3178
314318
```
315319
316-
Here is a convenience script that performs both steps:
320+
1. Update the requested `storage` capacity in [base/indexed-search/indexed-search.PersistentVolumeClaim.yaml](../base/indexed-search/indexed-search.PersistentVolumeClaim.yaml) to be `200Gi` multiplied by the number of `gitserver` replicas.
321+
322+
For example, if there are 2 `gitserver` replicas then the `storage` requested in [base/indexed-search/indexed-search.PersistentVolumeClaim.yaml](../base/indexed-search/indexed-search.PersistentVolumeClaim.yaml) should have the value `400Gi`.
323+
324+
```yaml
325+
# base/indexed-search/indexed-search.PersistentVolumeClaim.yaml
326+
spec:
327+
resources:
328+
requests:
329+
storage: 400Gi
330+
```
331+
332+
Here is a convenience script that performs all three steps:
317333
318334
```bash
319335
# This script requires https://github.com/sourcegraph/jy and https://github.com/sourcegraph/yj
@@ -331,6 +347,11 @@ GITSERVERS=$(for i in `seq 0 $(($REPLICA_COUNT-1))`; do echo -n "gitserver-$i.gi
331347
# Update SRC_GIT_SERVERS environment variable in other services
332348
find . -name "*yaml" -exec sed -i.sedibak -e "s/value: gitserver-0.gitserver:3178.*/value: $GITSERVERS/g" {} +
333349
350+
IDX_SEARCH=base/indexed-search/indexed-search.PersistentVolumeClaim.yaml
351+
352+
# Update the storage requested in indexed-search's persistent volume claim
353+
cat $IDX_SEARCH | yj | jq --arg REPLICA_COUNT "$REPLICA_COUNT" '.spec.resources.requests.storage = ((($REPLICA_COUNT |tonumber) * 200) | tostring)+"Gi"' | jy -o $IDX_SEARCH
354+
334355
# Delete sed's backup files
335356
find . -name "*.sedibak" -delete
336357
```

docs/install.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
git clone https://github.com/sourcegraph/deploy-sourcegraph && cd deploy-sourcegraph && git checkout ${VERSION}
3131
```
3232

33+
1. If you want to add a large number of repositories to your instance, you should [configure the number of gitserver replicas](configure.md#configure-gitserver-replica-count) _before_ you continue with the next step.
34+
3335
1. Deploy the desired version of Sourcegraph to your cluster:
3436

3537
```bash

0 commit comments

Comments
 (0)