-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update docs (k8s, install, update, scale, troubleshoot)
- Loading branch information
Showing
5 changed files
with
380 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,19 @@ | |
* <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/" target="_blank">kubectl</a>, v1.8.6 or later | ||
* <a href="https://docs.helm.sh/using_helm/#installing-helm" target="_blank">Helm</a>, v2.9.1 or later | ||
* Access to server infrastructure on which you can create a Kubernetes cluster (see | ||
[resource allocation guidelines](scaling.md)) | ||
[resource allocation guidelines](scale.md)) | ||
|
||
## Install | ||
|
||
> **Note:** Sourcegraph sends performance and usage data to Sourcegraph to help us make our product | ||
> better for you. The data sent does NOT include any source code or file data (including URLs that | ||
> might implicitly contain this information). You can view traces and disable telemetry in the site | ||
> admin area on the server. | ||
Sourcegraph Data Center is deployed using Kubernetes. Before proceeding with these | ||
instructions, [provision a Kubernetes](k8s.md) cluster on the infrastructure of your choice. | ||
instructions, [provision a Kubernetes](k8s.md) cluster on the infrastructure of your choice. Make | ||
sure you have [configured `kubectl` to access your cluster](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/). | ||
|
||
|
||
1. Install Tiller with RBAC privileges (the server-side counterpart to Helm) on your cluster: | ||
|
||
|
@@ -23,13 +30,13 @@ instructions, [provision a Kubernetes](k8s.md) cluster on the infrastructure of | |
helm init --service-account tiller | ||
``` | ||
|
||
* If installing Tiller is not an option, consult the instructions below for installing without Tiller. | ||
* If your Kubernetes environment does not permite RBAC, consult the instructions below for | ||
installing without RBAC. | ||
* If installing Tiller is not an option, consult the instructions below | ||
for [installing without Tiller](#install-without-tiller). | ||
* If your Kubernetes environment does not permit RBAC, consult the instructions below | ||
for [installing without RBAC](#install-without-rbac). | ||
|
||
1. Create a `values.yaml` file with the following contents: | ||
|
||
|
||
``` | ||
cluster: | ||
storageClass: | ||
|
@@ -80,20 +87,65 @@ instructions, [provision a Kubernetes](k8s.md) cluster on the infrastructure of | |
You will now see the Sourcegraph setup page when you visit the address of your instance. If you made your instance | ||
accessible on the public Internet, make sure you secure it before adding your private repositories. | ||
|
||
### Common errors | ||
|
||
* `kubectl get pv` shows no Persistent Volumes, and/or `kubectl get events` shows a `Failed to provision volume with | ||
StorageClass "default"` error. | ||
### Add language servers for code intelligence | ||
|
||
> Code intelligence is a [paid upgrade](https://about.sourcegraph.com/pricing/) on top of the Data | ||
> Center deployment option. After following these instructions to confirm it | ||
> works, [buy code intelligence](https://about.sourcegraph.com/contact/sales). | ||
[Code intelligence](https://about.sourcegraph.com/docs/code-intelligence) provides advanced code | ||
navigation and cross-references for your code on Sourcegraph. | ||
|
||
To enable code intelligence, add a `site.langservers` property to your `values.yaml` file specifying which | ||
language servers to run (omitting languages you don't want): | ||
|
||
```yaml | ||
# values.yaml | ||
|
||
site: { | ||
"langservers": [ | ||
{ "language": "go" }, | ||
{ "language": "javascript" }, | ||
{ "language": "typescript" }, | ||
{ "language": "python" }, | ||
{ "language": "java" }, | ||
{ "language": "php" } | ||
] | ||
} | ||
``` | ||
|
||
After modifying `values.yaml`, update your cluster: | ||
|
||
```bash | ||
helm upgrade -f values.yaml sourcegraph https://github.com/sourcegraph/datacenter/archive/$VERSION.tar.gz | ||
``` | ||
|
||
For more information, | ||
* Refer to the [examples](../examples) directory for an example of a cluster config with code | ||
intelligence enabled. | ||
* See the [language-specific docs](https://about.sourcegraph.com/docs/code-intelligence) for | ||
configuring specific languages. | ||
* [Contact us](mailto:[email protected]) with questions or problems relating to code | ||
intelligence. | ||
|
||
### Additional configuration | ||
|
||
Check that a storage class named "default" exists via `kubectl get storageclass`. If one does exist, run `kubectl get storageclass default -o=yaml` and verify that the zone indicated in the output matches the zone of your cluster. | ||
You can set additional fields in `values.yaml` to configure your cluster to index your code host, | ||
add custom search scopes, enable TLS, turn on SSO, and more. The default set of configuration values | ||
is defined by the `values.yaml` file in *this* directory. | ||
|
||
* `Error: release sourcegraph failed: namespaces "default" is forbidden: User "system:serviceaccount:kube-system:default" cannot get namespaces in the namespace "default": Unknown user "system:serviceaccount:kube-system:default"`. Ensure you have created the RBAC resources and helm is using them. A common reason for it to fail is you are already using Helm, so `helm init --service-account tiller` does not work correctly. To fix this for your existing Helm installation, run: | ||
The structure of `values.yaml` is split into two top-level fields: | ||
- `site` defines application-level settings like code host integrations and authentication settings. The full set of | ||
options for `site` is described here: https://about.sourcegraph.com/docs/config/settings. | ||
- `cluster` defines settings specific to the configuration of the Kubernetes cluster, like replica counts and CPU/memory | ||
allocation. Refer to the `values.yaml` in this repository to see which `cluster` fields can be overridden. | ||
|
||
|
||
### Troubleshooting | ||
|
||
See the [Troubleshooting page](troubleshoot.md). | ||
|
||
```bash | ||
kubectl apply -f https://about.sourcegraph.com/k8s/rbac-config.yml | ||
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' | ||
helm init --service-account tiller --upgrade | ||
``` | ||
|
||
### Install without RBAC | ||
|
||
|
@@ -102,8 +154,9 @@ that clean up temporary cache data. To do that we need to create RBAC resources. | |
Helm's | ||
[Role-based Access Control documentation](https://github.com/kubernetes/helm/blob/v2.8.2/docs/rbac.md). | ||
|
||
If using RBAC is not an option, you can set `"site.rbac": "disabled"` in your `values.yaml` and run `helm init` instead of | ||
`helm init --service-account tiller` to install Tiller. | ||
If using RBAC is not an option, then | ||
* Set `"site.rbac": "disabled"` in your `values.yaml` | ||
* Run `helm init` instead of `helm init --service-account tiller` to install Tiller. | ||
|
||
|
||
### Install without Tiller | ||
|
@@ -130,18 +183,6 @@ If `cluster.storageClass.create` is set to `none`, then you will need to create | |
After installing the Sourcegraph Helm chart, you should see persistent volume claims (`kubectl get pvc`) bound to | ||
volumes provisioned using this storage class. | ||
|
||
## Configuration | ||
You can set additional values in `values.yaml` to configure your cluster. The default set of configuration values is | ||
defined by the `values.yaml` file in *this* directory. | ||
The configuration structure is split into two top-level fields: | ||
- `site` defines application-level settings like code host integrations and authentication settings. The full set of | ||
options for `site` is described here: https://about.sourcegraph.com/docs/config/settings. | ||
- `cluster` defines settings specific to the configuration of the Kubernetes cluster, like replica counts and CPU/memory | ||
allocation. Refer to the `values.yaml` in this repository to see which `cluster` fields can be overridden. | ||
### Secrets | ||
|
||
In some cases, it is desirable to set config fields to the contents of external files. The Helm CLI | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.