|
1 | | -# sourcebot-k8s |
2 | | -Kubernetes config and Helm chart for Sourcebot |
| 1 | +# Sourcebot Helm Chart |
| 2 | + |
| 3 | +   |
| 4 | + |
| 5 | +The open source Sourcegraph alternative. Sourcebot gives you a powerful interface to search through all your repos and branches across multiple code hosts. |
| 6 | + |
| 7 | +**Homepage:** <https://sourcebot.dev/> |
| 8 | + |
| 9 | +## TL;DR |
| 10 | + |
| 11 | +```bash |
| 12 | +# Create a secret with your credentials |
| 13 | +kubectl create secret generic sourcebot \ |
| 14 | + --from-literal=postgresql-password=your-secure-password \ |
| 15 | + --from-literal=redis-password=your-secure-password |
| 16 | + |
| 17 | +# Add the Helm repository |
| 18 | +helm repo add sourcebot https://sourcebot-dev.github.io/sourcebot-helm-chart |
| 19 | +helm repo update |
| 20 | + |
| 21 | +# Install Sourcebot |
| 22 | +helm install sourcebot sourcebot/sourcebot \ |
| 23 | + --set postgresql.auth.existingSecret=sourcebot \ |
| 24 | + --set redis.auth.existingSecret=sourcebot |
| 25 | +``` |
| 26 | + |
| 27 | +## Introduction |
| 28 | + |
| 29 | +This chart bootstraps a Sourcebot deployment on a Kubernetes cluster using the Helm package manager. |
| 30 | + |
| 31 | +By default, this chart deploys: |
| 32 | +- Sourcebot application |
| 33 | +- PostgreSQL database (via Bitnami subchart) |
| 34 | +- Redis/Valkey cache (via Bitnami subchart) |
| 35 | + |
| 36 | +## Prerequisites |
| 37 | + |
| 38 | +- Kubernetes 1.19+ |
| 39 | +- Helm 3.x |
| 40 | +- PV provisioner support in the underlying infrastructure (for PostgreSQL and Sourcebot data persistence) |
| 41 | + |
| 42 | +## Installing the Chart |
| 43 | + |
| 44 | +### Quick Start |
| 45 | + |
| 46 | +See the [minimal installation example](./examples/minimal-installation/) for a complete quick start guide. |
| 47 | + |
| 48 | +### Step-by-Step Installation |
| 49 | + |
| 50 | +1. **Create a Secret** with your database and Redis passwords: |
| 51 | + |
| 52 | +```bash |
| 53 | +kubectl create secret generic sourcebot \ |
| 54 | + --from-literal=postgresql-password=your-secure-password \ |
| 55 | + --from-literal=redis-password=your-secure-password |
| 56 | +``` |
| 57 | + |
| 58 | +2. **Add the Helm Repository**: |
| 59 | + |
| 60 | +```bash |
| 61 | +helm repo add sourcebot https://sourcebot-dev.github.io/sourcebot-helm-chart |
| 62 | +helm repo update |
| 63 | +``` |
| 64 | + |
| 65 | +3. **Install the Chart**: |
| 66 | + |
| 67 | +```bash |
| 68 | +helm install sourcebot sourcebot/sourcebot \ |
| 69 | + --set postgresql.auth.existingSecret=sourcebot \ |
| 70 | + --set redis.auth.existingSecret=sourcebot |
| 71 | +``` |
| 72 | + |
| 73 | +Or using a values file: |
| 74 | + |
| 75 | +```bash |
| 76 | +helm install sourcebot sourcebot/sourcebot -f values.yaml |
| 77 | +``` |
| 78 | + |
| 79 | +## Configuration |
| 80 | + |
| 81 | +### Database Configuration |
| 82 | + |
| 83 | +By default, PostgreSQL is deployed as a subchart. The chart automatically configures the connection using component-based environment variables (`DATABASE_HOST`, `DATABASE_USERNAME`, `DATABASE_PASSWORD`, etc.), which are assembled into `DATABASE_URL` by the application's entrypoint script. |
| 84 | + |
| 85 | +#### Using the Deployed PostgreSQL Subchart |
| 86 | + |
| 87 | +```yaml |
| 88 | +postgresql: |
| 89 | + deploy: true # Default |
| 90 | + auth: |
| 91 | + username: sourcebot |
| 92 | + database: sourcebot |
| 93 | + existingSecret: sourcebot |
| 94 | + secretKeys: |
| 95 | + userPasswordKey: postgresql-password |
| 96 | + adminPasswordKey: postgresql-password |
| 97 | + primary: |
| 98 | + persistence: |
| 99 | + enabled: true |
| 100 | + size: 8Gi |
| 101 | +``` |
| 102 | +
|
| 103 | +#### Using an External PostgreSQL Instance |
| 104 | +
|
| 105 | +```yaml |
| 106 | +postgresql: |
| 107 | + deploy: false |
| 108 | + host: your-postgres-host.example.com |
| 109 | + port: 5432 |
| 110 | + auth: |
| 111 | + username: sourcebot |
| 112 | + database: sourcebot |
| 113 | + existingSecret: sourcebot |
| 114 | + secretKeys: |
| 115 | + userPasswordKey: postgresql-password |
| 116 | +``` |
| 117 | +
|
| 118 | +### Redis Configuration |
| 119 | +
|
| 120 | +Similar to PostgreSQL, Redis/Valkey can be deployed as a subchart or configured to use an external instance. |
| 121 | +
|
| 122 | +#### Using the Deployed Redis Subchart |
| 123 | +
|
| 124 | +```yaml |
| 125 | +redis: |
| 126 | + deploy: true # Default |
| 127 | + auth: |
| 128 | + username: default |
| 129 | + existingSecret: sourcebot |
| 130 | + existingSecretPasswordKey: redis-password |
| 131 | +``` |
| 132 | +
|
| 133 | +#### Using an External Redis Instance |
| 134 | +
|
| 135 | +```yaml |
| 136 | +redis: |
| 137 | + deploy: false |
| 138 | + host: your-redis-host.example.com |
| 139 | + port: 6379 |
| 140 | + auth: |
| 141 | + username: default |
| 142 | + existingSecret: sourcebot |
| 143 | + existingSecretPasswordKey: redis-password |
| 144 | +``` |
| 145 | +
|
| 146 | +### Sourcebot Configuration |
| 147 | +
|
| 148 | +Configure your code repositories and other settings: |
| 149 | +
|
| 150 | +```yaml |
| 151 | +sourcebot: |
| 152 | + config: |
| 153 | + $schema: https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json |
| 154 | + connections: |
| 155 | + github-repos: |
| 156 | + type: github |
| 157 | + token: |
| 158 | + env: GITHUB_TOKEN |
| 159 | + repos: |
| 160 | + - owner/repo1 |
| 161 | + - owner/repo2 |
| 162 | + settings: |
| 163 | + reindexIntervalMs: 86400000 # 24 hours |
| 164 | +``` |
| 165 | +
|
| 166 | +### Persistence Configuration |
| 167 | +
|
| 168 | +By default, Sourcebot uses persistent storage to retain repository data and search indexes across pod restarts: |
| 169 | +
|
| 170 | +```yaml |
| 171 | +sourcebot: |
| 172 | + persistence: |
| 173 | + enabled: true # Default |
| 174 | + size: 10Gi |
| 175 | + storageClass: "" # Uses cluster default |
| 176 | + accessModes: |
| 177 | + - ReadWriteOnce |
| 178 | +``` |
| 179 | +
|
| 180 | +To use an existing PersistentVolumeClaim: |
| 181 | +
|
| 182 | +```yaml |
| 183 | +sourcebot: |
| 184 | + persistence: |
| 185 | + enabled: true |
| 186 | + existingClaim: my-existing-pvc |
| 187 | +``` |
| 188 | +
|
| 189 | +To disable persistence (not recommended for production): |
| 190 | +
|
| 191 | +```yaml |
| 192 | +sourcebot: |
| 193 | + persistence: |
| 194 | + enabled: false |
| 195 | +``` |
| 196 | +
|
| 197 | +### Ingress Configuration |
| 198 | +
|
| 199 | +Enable ingress to expose Sourcebot: |
| 200 | +
|
| 201 | +```yaml |
| 202 | +sourcebot: |
| 203 | + ingress: |
| 204 | + enabled: true |
| 205 | + className: nginx |
| 206 | + annotations: |
| 207 | + cert-manager.io/cluster-issuer: letsencrypt-prod |
| 208 | + hosts: |
| 209 | + - host: sourcebot.example.com |
| 210 | + paths: |
| 211 | + - path: / |
| 212 | + pathType: Prefix |
| 213 | + tls: |
| 214 | + - hosts: |
| 215 | + - sourcebot.example.com |
| 216 | + secretName: sourcebot-tls |
| 217 | +``` |
| 218 | +
|
| 219 | +### Resource Limits |
| 220 | +
|
| 221 | +Set appropriate resource limits for production: |
| 222 | +
|
| 223 | +```yaml |
| 224 | +sourcebot: |
| 225 | + resources: |
| 226 | + requests: |
| 227 | + cpu: 1000m |
| 228 | + memory: 2Gi |
| 229 | + limits: |
| 230 | + cpu: 2000m |
| 231 | + memory: 4Gi |
| 232 | +``` |
| 233 | +
|
| 234 | +## Examples |
| 235 | +
|
| 236 | +Check out the [examples directory](./examples/) for complete configuration examples: |
| 237 | +
|
| 238 | +- [Minimal Installation](./examples/minimal-installation/) - Basic setup with subcharts |
| 239 | +- More examples coming soon! |
| 240 | +
|
| 241 | +## Upgrading |
| 242 | +
|
| 243 | +### To a New Version |
| 244 | +
|
| 245 | +```bash |
| 246 | +helm upgrade sourcebot sourcebot/sourcebot -f values.yaml |
| 247 | +``` |
| 248 | + |
| 249 | +### Major Version Upgrades |
| 250 | + |
| 251 | +Always check the [CHANGELOG](../../CHANGELOG.md) for breaking changes before upgrading between major versions. |
| 252 | + |
| 253 | +## Uninstalling |
| 254 | + |
| 255 | +To uninstall/delete the `sourcebot` deployment: |
| 256 | + |
| 257 | +```bash |
| 258 | +helm uninstall sourcebot |
| 259 | +``` |
| 260 | + |
| 261 | +This removes all Kubernetes components associated with the chart but **preserves PersistentVolumeClaims (PVCs) by default**. This includes: |
| 262 | +- `sourcebot-data` - Sourcebot repository data and search indexes |
| 263 | +- `data-sourcebot-postgresql-0` - PostgreSQL data (if deployed) |
| 264 | +- `valkey-data-sourcebot-redis-*` - Redis data (if deployed) |
| 265 | + |
| 266 | +To also remove all PVCs (⚠️ **this will delete all your data**): |
| 267 | + |
| 268 | +```bash |
| 269 | +kubectl delete pvc -l app.kubernetes.io/instance=sourcebot |
| 270 | +``` |
0 commit comments