Skip to content

Commit 92fba7b

Browse files
committed
Add examples for using external redis
1 parent bdddee6 commit 92fba7b

3 files changed

Lines changed: 195 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Using external Redis instances
2+
3+
Sourcegraph deployment by default ships two separate Redis instances for different purposes
4+
5+
- [redis-cache.Deployment.yaml](../../templates/redis/redis-cache.Deployment.yaml)
6+
- [redis-store.Deployment.yaml](../../templates/redis/redis-store.Deployment.yaml)
7+
8+
When using external Redis instances, you’ll need specify the corresponding environment variable for [each of the following deployments](https://docs.sourcegraph.com/admin/install/kubernetes/configure#configure-custom-redis)
9+
10+
## Optional 1 - One shared external Redis instance
11+
12+
Example values override [override-shared.yaml](./override-shared.yaml).
13+
14+
### `REDIS_ENDPOINT`
15+
16+
The string must either have the format `$HOST:PORT` or follow the [IANA specification for Redis URLs](https://www.iana.org/assignments/uri-schemes/prov/redis) (e.g., redis://:mypassword@host:6379/2)
17+
18+
## Option 2 - Two separate external Redis instances
19+
20+
Example values override [override-separate.yaml](./override-separate.yaml).
21+
22+
### `REDIS_CACHE_ENDPOINT`
23+
24+
The string must either have the format `$HOST:PORT` or follow the [IANA specification for Redis URLs](https://www.iana.org/assignments/uri-schemes/prov/redis) (e.g., redis://:mypassword@host:6379/2)
25+
26+
### `REDIS_STORE_ENDPOINT`
27+
28+
The string must either have the format `$HOST:PORT` or follow the [IANA specification for Redis URLs](https://www.iana.org/assignments/uri-schemes/prov/redis) (e.g., redis://:mypassword@host:6379/2)
29+
30+
## Notes
31+
32+
You may store these sensitive environment variables in a [Secret](https://kubernetes.io/docs/concepts/configuration/secret/).
33+
34+
```yaml
35+
apiVersion: v1
36+
kind: Secret
37+
metadata:
38+
name: sourcegraph-external-redis-credentials
39+
data:
40+
# notes: secrets data has to be base64-encoded
41+
REDIS_ENDPOINT: ""
42+
```
43+
44+
```yaml
45+
apiVersion: v1
46+
kind: Secret
47+
metadata:
48+
name: sourcegraph-external-redis-credentials
49+
data:
50+
# notes: secrets data has to be base64-encoded
51+
REDIS_CACHE_ENDPOINT: ""
52+
REDIS_STORE_ENDPOINT: ""
53+
```
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Demonstrate using external redis instance(s)
2+
# Disables deployment of the internal `redis-cache` and `redis-store` deployment
3+
4+
frontend:
5+
env:
6+
REDIS_CACHE_ENDPOINT:
7+
valueFrom:
8+
secretKeyRef: # Pre-existing secret, not created by this chart
9+
name: sourcegraph-external-redis-credentials
10+
key: REDIS_CACHE_ENDPOINT
11+
REDIS_STORE_ENDPOINT:
12+
valueFrom:
13+
secretKeyRef: # Pre-existing secret, not created by this chart
14+
name: sourcegraph-external-redis-credentials
15+
key: REDIS_STORE_ENDPOINT
16+
17+
repoUpdater:
18+
env:
19+
REDIS_CACHE_ENDPOINT:
20+
valueFrom:
21+
secretKeyRef: # Pre-existing secret, not created by this chart
22+
name: sourcegraph-external-redis-credentials
23+
key: REDIS_CACHE_ENDPOINT
24+
REDIS_STORE_ENDPOINT:
25+
valueFrom:
26+
secretKeyRef: # Pre-existing secret, not created by this chart
27+
name: sourcegraph-external-redis-credentials
28+
key: REDIS_STORE_ENDPOINT
29+
30+
gitserver:
31+
env:
32+
REDIS_CACHE_ENDPOINT:
33+
valueFrom:
34+
secretKeyRef: # Pre-existing secret, not created by this chart
35+
name: sourcegraph-external-redis-credentials
36+
key: REDIS_CACHE_ENDPOINT
37+
REDIS_STORE_ENDPOINT:
38+
valueFrom:
39+
secretKeyRef: # Pre-existing secret, not created by this chart
40+
name: sourcegraph-external-redis-credentials
41+
key: REDIS_STORE_ENDPOINT
42+
43+
searcher:
44+
env:
45+
REDIS_CACHE_ENDPOINT:
46+
valueFrom:
47+
secretKeyRef: # Pre-existing secret, not created by this chart
48+
name: sourcegraph-external-redis-credentials
49+
key: REDIS_CACHE_ENDPOINT
50+
REDIS_STORE_ENDPOINT:
51+
valueFrom:
52+
secretKeyRef: # Pre-existing secret, not created by this chart
53+
name: sourcegraph-external-redis-credentials
54+
key: REDIS_STORE_ENDPOINT
55+
56+
symbols:
57+
env:
58+
REDIS_CACHE_ENDPOINT:
59+
valueFrom:
60+
secretKeyRef: # Pre-existing secret, not created by this chart
61+
name: sourcegraph-external-redis-credentials
62+
key: REDIS_CACHE_ENDPOINT
63+
REDIS_STORE_ENDPOINT:
64+
valueFrom:
65+
secretKeyRef: # Pre-existing secret, not created by this chart
66+
name: sourcegraph-external-redis-credentials
67+
key: REDIS_STORE_ENDPOINT
68+
69+
worker:
70+
env:
71+
REDIS_CACHE_ENDPOINT:
72+
valueFrom:
73+
secretKeyRef: # Pre-existing secret, not created by this chart
74+
name: sourcegraph-external-redis-credentials
75+
key: REDIS_CACHE_ENDPOINT
76+
REDIS_STORE_ENDPOINT:
77+
valueFrom:
78+
secretKeyRef: # Pre-existing secret, not created by this chart
79+
name: sourcegraph-external-redis-credentials
80+
key: REDIS_STORE_ENDPOINT
81+
82+
redisCache:
83+
enabled: false
84+
85+
redisStore:
86+
enabled: false
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Demonstrate using external redis instance(s)
2+
# Disables deployment of the internal `redis-cache` and `redis-store` deployment
3+
4+
frontend:
5+
env:
6+
REDIS_ENDPOINT:
7+
valueFrom:
8+
secretKeyRef: # Pre-existing secret, not created by this chart
9+
name: sourcegraph-external-redis-credentials
10+
key: REDIS_ENDPOINT
11+
12+
repoUpdater:
13+
env:
14+
REDIS_ENDPOINT:
15+
valueFrom:
16+
secretKeyRef: # Pre-existing secret, not created by this chart
17+
name: sourcegraph-external-redis-credentials
18+
key: REDIS_ENDPOINT
19+
20+
gitserver:
21+
env:
22+
REDIS_ENDPOINT:
23+
valueFrom:
24+
secretKeyRef: # Pre-existing secret, not created by this chart
25+
name: sourcegraph-external-redis-credentials
26+
key: REDIS_ENDPOINT
27+
28+
searcher:
29+
env:
30+
REDIS_ENDPOINT:
31+
valueFrom:
32+
secretKeyRef: # Pre-existing secret, not created by this chart
33+
name: sourcegraph-external-redis-credentials
34+
key: REDIS_ENDPOINT
35+
36+
symbols:
37+
env:
38+
REDIS_ENDPOINT:
39+
valueFrom:
40+
secretKeyRef: # Pre-existing secret, not created by this chart
41+
name: sourcegraph-external-redis-credentials
42+
key: REDIS_ENDPOINT
43+
44+
worker:
45+
env:
46+
REDIS_ENDPOINT:
47+
valueFrom:
48+
secretKeyRef: # Pre-existing secret, not created by this chart
49+
name: sourcegraph-external-redis-credentials
50+
key: REDIS_ENDPOINT
51+
52+
redisCache:
53+
enabled: false
54+
55+
redisStore:
56+
enabled: false

0 commit comments

Comments
 (0)