Skip to content

Commit

Permalink
Add examples for using external redis
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellzc committed Mar 1, 2022
1 parent 3929944 commit 38055af
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 0 deletions.
53 changes: 53 additions & 0 deletions charts/sourcegraph/examples/external-redis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Using external Redis instances

Sourcegraph deployment by default ships two separate Redis instances for different purposes

- [redis-cache.Deployment.yaml](../../templates/redis/redis-cache.Deployment.yaml)
- [redis-store.Deployment.yaml](../../templates/redis/redis-store.Deployment.yaml)

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)

## Optional 1 - One shared external Redis instance

Example values override [override-shared.yaml](./override-shared.yaml).

### `REDIS_ENDPOINT`

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)

## Option 2 - Two separate external Redis instances

Example values override [override-separate.yaml](./override-separate.yaml).

### `REDIS_CACHE_ENDPOINT`

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)

### `REDIS_STORE_ENDPOINT`

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)

## Notes

You may store these sensitive environment variables in a [Secret](https://kubernetes.io/docs/concepts/configuration/secret/).

```yaml
apiVersion: v1
kind: Secret
metadata:
name: sourcegraph-external-redis-credentials
data:
# notes: secrets data has to be base64-encoded
REDIS_ENDPOINT: ""
```
```yaml
apiVersion: v1
kind: Secret
metadata:
name: sourcegraph-external-redis-credentials
data:
# notes: secrets data has to be base64-encoded
REDIS_CACHE_ENDPOINT: ""
REDIS_STORE_ENDPOINT: ""
```
86 changes: 86 additions & 0 deletions charts/sourcegraph/examples/external-redis/override-separate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Demonstrate using external redis instance(s)
# Disables deployment of the internal `redis-cache` and `redis-store` deployment

frontend:
env:
REDIS_CACHE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_CACHE_ENDPOINT
REDIS_STORE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_STORE_ENDPOINT

repoUpdater:
env:
REDIS_CACHE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_CACHE_ENDPOINT
REDIS_STORE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_STORE_ENDPOINT

gitserver:
env:
REDIS_CACHE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_CACHE_ENDPOINT
REDIS_STORE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_STORE_ENDPOINT

searcher:
env:
REDIS_CACHE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_CACHE_ENDPOINT
REDIS_STORE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_STORE_ENDPOINT

symbols:
env:
REDIS_CACHE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_CACHE_ENDPOINT
REDIS_STORE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_STORE_ENDPOINT

worker:
env:
REDIS_CACHE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_CACHE_ENDPOINT
REDIS_STORE_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_STORE_ENDPOINT

redisCache:
enabled: false

redisStore:
enabled: false
56 changes: 56 additions & 0 deletions charts/sourcegraph/examples/external-redis/override-shared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Demonstrate using external redis instance(s)
# Disables deployment of the internal `redis-cache` and `redis-store` deployment

frontend:
env:
REDIS_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_ENDPOINT

repoUpdater:
env:
REDIS_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_ENDPOINT

gitserver:
env:
REDIS_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_ENDPOINT

searcher:
env:
REDIS_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_ENDPOINT

symbols:
env:
REDIS_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_ENDPOINT

worker:
env:
REDIS_ENDPOINT:
valueFrom:
secretKeyRef: # Pre-existing secret, not created by this chart
name: sourcegraph-external-redis-credentials
key: REDIS_ENDPOINT

redisCache:
enabled: false

redisStore:
enabled: false
55 changes: 55 additions & 0 deletions charts/sourcegraph/override.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
storageClass:
create: false # Disable if you have your own existing storage class
name: standard

sourcegraph:
localDevMode: true

codeInsightsDB:
serviceAccount:
create: true
codeIntelDB:
serviceAccount:
create: true
githubProxy:
serviceAccount:
create: true
gitserver:
serviceAccount:
create: true
indexedSearch:
serviceAccount:
create: true
minio:
serviceAccount:
create: true
pgsql:
serviceAccount:
create: true
preciseCodeIntel:
serviceAccount:
create: true
redisCache:
serviceAccount:
create: true
redisStore:
serviceAccount:
create: true
repoUpdater:
serviceAccount:
create: true
searcher:
serviceAccount:
create: true
symbols:
serviceAccount:
create: true
syntectServer:
serviceAccount:
create: true
tracing:
serviceAccount:
create: true
worker:
serviceAccount:
create: true

0 comments on commit 38055af

Please sign in to comment.