You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/self-hosted/external-services/object-storage.mdx
+74-15Lines changed: 74 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,70 @@ By default, Sourcegraph will use a `sourcegraph/blobstore` server bundled with t
4
4
5
5
You can alternatively configure your instance to instead store this data in an S3 or GCS bucket. Doing so may decrease your hosting costs as persistent volumes are often more expensive than the same storage space in an object store service.
6
6
7
+
## `sourcegraph` bucket
8
+
9
+
<Callouttype="warning">
10
+
11
+
Self-hosted Sourcegraph instances using S3 or GCS object storage should now provision
12
+
an additional bucket named `sourcegraph`. Sourcegraph currently reports a warning
13
+
when this bucket is not present, and it will become required for new features in
14
+
a future release.
15
+
</Callout>
16
+
17
+
The `sourcegraph` bucket is intended to be the single bucket for new Sourcegraph features. Instead of creating one bucket per feature, new features store objects under namespaced key prefixes within this bucket.
18
+
19
+
Existing buckets for code graph indexes and search jobs remain in use. This change ensures future features can be enabled without requiring a new bucket for each feature.
20
+
21
+
### Using S3 for the `sourcegraph` bucket
22
+
23
+
Set the following environment variables to target an S3 bucket for shared Sourcegraph uploads.
### Automatically provision the `sourcegraph` bucket
46
+
47
+
If you would like to allow your Sourcegraph instance to manage the target bucket configuration, set the following environment variable:
48
+
49
+
<Callouttype="note">
50
+
51
+
This requires additional bucket-management permissions from your configured storage vendor (AWS or GCP).
52
+
</Callout>
53
+
54
+
-`SOURCEGRAPH_UPLOAD_MANAGE_BUCKET=true`
55
+
7
56
## Code Graph Indexes
8
57
9
58
To target a managed object storage service for storing [code graph index uploads](../../code-navigation/precise-code-navigation), you will need to set a handful of environment variables for configuration and authentication to the target service.
10
59
11
60
- If you are running a `sourcegraph/server` deployment, set the environment variables on the server container
12
61
- If you are running via Docker-compose or Kubernetes, set the environment variables on the `frontend`, `worker`, and `precise-code-intel-worker` containers
13
62
14
-
### Using S3
63
+
### Using S3 for the Code Graph Indexes bucket
15
64
16
65
To target an S3 bucket you've already provisioned, set the following environment variables. Authentication can be done through [an access and secret key pair](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys) (and optional session token), or via the EC2 metadata API.
17
66
18
67
<Callouttype="warning">
19
-
{''}
68
+
20
69
Never commit AWS access keys in Git. You should consider using a secret handling
21
-
service offered by your cloud provider.{''}
70
+
service offered by your cloud provider.
22
71
</Callout>
23
72
24
73
-`PRECISE_CODE_INTEL_UPLOAD_BACKEND=S3`
@@ -31,21 +80,21 @@ To target an S3 bucket you've already provisioned, set the following environment
If a non-default region is supplied, ensure that the subdomain of the endpoint
36
-
URL (_the `AWS_ENDPOINT` value_) matches the target region.{''}
85
+
URL (_the `AWS_ENDPOINT` value_) matches the target region.
37
86
</Callout>
38
87
39
88
<Callouttype="tip">
40
-
{''}
89
+
41
90
You don't need to set the `PRECISE_CODE_INTEL_UPLOAD_AWS_ACCESS_KEY_ID` environment
42
91
variable when using `PRECISE_CODE_INTEL_UPLOAD_AWS_USE_EC2_ROLE_CREDENTIALS=true`
43
92
because role credentials will be automatically resolved. Attach the IAM role
44
93
to the EC2 instances hosting the `frontend`, `worker`, and `precise-code-intel-worker`
45
-
containers in a multi-node environment.{''}
94
+
containers in a multi-node environment.
46
95
</Callout>
47
96
48
-
### Using GCS
97
+
### Using GCS for the Code Graph Indexes bucket
49
98
50
99
To target a GCS bucket you've already provisioned, set the following environment variables. Authentication is done through a service account key, supplied as either a path to a volume-mounted file, or the contents read in as an environment variable payload.
51
100
@@ -55,10 +104,15 @@ To target a GCS bucket you've already provisioned, set the following environment
### Automatically provision the Code Graph Indexes bucket
59
108
60
109
If you would like to allow your Sourcegraph instance to control the creation and lifecycle configuration management of the target buckets, set the following environment variables:
61
110
111
+
<Callouttype="note">
112
+
113
+
This requires additional bucket-management permissions from your configured storage vendor (AWS or GCP).
114
+
</Callout>
115
+
62
116
-`PRECISE_CODE_INTEL_UPLOAD_MANAGE_BUCKET=true`
63
117
-`PRECISE_CODE_INTEL_UPLOAD_TTL=168h` (default)
64
118
@@ -69,12 +123,12 @@ To target a third party managed object storage service for storing [search job r
69
123
- If you are running a `sourcegraph/server` deployment, set the environment variables on the server container
70
124
- If you are running via Docker-compose or Kubernetes, set the environment variables on the `frontend` and `worker` containers
71
125
72
-
### Using S3
126
+
### Using S3 for the Search Job Results bucket
73
127
74
128
Set the following environment variables to target an S3 bucket you've already provisioned. Authentication can be done through [an access and secret key pair](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys) (and optionally through session token) or via the EC2 metadata API.
75
129
76
130
<Callouttype="warning">
77
-
{''}
131
+
78
132
Never commit AWS access keys in Git. You should consider using a secret handling
79
133
service offered by your cloud provider.
80
134
</Callout>
@@ -89,19 +143,19 @@ Set the following environment variables to target an S3 bucket you've already pr
If a non-default region is supplied, ensure that the subdomain of the endpoint
94
148
URL (the `AWS_ENDPOINT` value) matches the target region.
95
149
</Callout>
96
150
97
151
<Callouttype="tip">
98
-
{''}
152
+
99
153
You don't need to set the `SEARCH_JOBS_UPLOAD_AWS_ACCESS_KEY_ID` environment
100
154
variable when using `SEARCH_JOBS_UPLOAD_AWS_USE_EC2_ROLE_CREDENTIALS=true` because
101
155
role credentials will be automatically resolved.
102
156
</Callout>
103
157
104
-
### Using GCS
158
+
### Using GCS for the Search Job Results bucket
105
159
106
160
Set the following environment variables to target a GCS bucket you've already provisioned. Authentication is done through a service account key, either as a path to a volume-mounted file or the contents read in as an environment variable payload.
107
161
@@ -111,8 +165,13 @@ Set the following environment variables to target a GCS bucket you've already pr
### Automatically provision the Search Job Results bucket
115
169
116
170
If you would like to allow your Sourcegraph instance to control the creation and lifecycle configuration management of the target buckets, set the following environment variables:
117
171
172
+
<Callouttype="note">
173
+
174
+
This requires additional bucket-management permissions from your configured storage vendor (AWS or GCP).
0 commit comments