Skip to content

Commit

Permalink
Merge pull request #59 from keephq/feature/nginx-ingress
Browse files Browse the repository at this point in the history
feat(ingress): moving to nginx-ingress
  • Loading branch information
shahargl authored Oct 23, 2024
2 parents 3b03459 + bf4e6b0 commit 9b0f15e
Show file tree
Hide file tree
Showing 16 changed files with 499 additions and 318 deletions.
115 changes: 96 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,114 @@
# Keep Helm Chart
The Keep Helm Chart provides a convenient way to deploy and manage Keep on Kubernetes using Helm, a package manager for Kubernetes applications.

# Prerequisites

## Ingress Controller (Recommended)
The recommended way to deploy Keep is with ingress-nginx that serves as a single ingress for all services (backend, frontend, and websocket server).

1. Install ingress-nginx:
```bash
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace
```

2. Enable snippet annotations:
The ingress controller must have snippet annotations enabled. You can enable it during installation:
```bash
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace \
--set controller.config.allow-snippet-annotations=true
```

To verify if snippet annotations are enabled:
```bash
# Check the configmap
kubectl get configmap -n ingress-nginx ingress-nginx-controller -o yaml | grep allow-snippet-annotations

# Or check the controller logs
kubectl logs -n ingress-nginx -l app.kubernetes.io/component=controller | grep "allow-snippet-annotations"
```

# Installation
The easiest way to install Keep with Helm is with the following command:

## Option 1: With ingress-nginx (Recommended)
```bash
# add the Helm repository
# Add the Helm repository
helm repo add keephq https://keephq.github.io/helm-charts
# pull the latest version of the chart
helm pull keephq/keep
# install the chart

# Install Keep with ingress enabled (default nginx)
helm install keep keephq/keep -n keep --create-namespace
```

## Option 2: Without ingress-nginx (Not recommended)
Keep can be deployed without ingress-nginx, but this will create three separate ingresses (one for each service):
```bash
# Add the Helm repository
helm repo add keephq https://keephq.github.io/helm-charts

# Install Keep without ingress
helm install keep keephq/keep
```

# Post-Installation

## With ingress-nginx
Your Keep installation will be available at the ingress host you configured. Check your ingress status:
```bash
kubectl get ingress
```

## Without ingress-nginx
You'll need to set up port forwarding to access the services:
```bash
# Expose the UI locally
kubectl port-forward svc/keep-frontend 3000:3000 &

# Expose the Backend locally
kubectl port-forward svc/keep-backend 8080:8080 &

# Export websocket server (optional)
kubectl port-forward svc/keep-websocket 6001:6001 &
```

# Uninstallation
`helm uninstall keep`
```bash
helm uninstall keep
```

# Configuration
To view supported configuration, see [this](charts/keep/README.md).

# Openshift
Keep's Helm Chart also supports installation on Openshift.
Simply set up the keys under frontend(/backend).route:
- route.host: your desired hostname
# Platform-Specific Instructions

# Local Kubernetes
For local kubernetes without external IP (such as NodePort or LoadBalancer), you'll need to run port forwarding:
## Openshift
Keep's Helm Chart supports installation on Openshift.
Configure the route settings under frontend(/backend).route:
```yaml
frontend:
route:
host: your-desired-hostname
```
## Port forward
```bash
## Local Kubernetes
For local Kubernetes clusters without external IP (such as when using NodePort or LoadBalancer):
# expose the UI locally
kubectl port-forward svc/keep-frontend 3000:3000 & \
# export websocket server (optional)
kubectl port-forward svc/keep-websocket 6001:6001 &
```
1. If using ingress-nginx, ensure your ingress controller is properly configured for local development
2. If not using ingress-nginx, use the port forwarding method described in the "Without ingress-nginx" section
# Troubleshooting
## Common Issues
1. Ingress not working
- Verify ingress-nginx is properly installed
- Check if snippet annotations are enabled
- Verify ingress configuration with `kubectl describe ingress`

2. WebSocket connection issues
- Ensure the websocket service is running
- Check ingress configuration for proper WebSocket headers
- Verify connectivity using `curl` or browser developer tools

For more detailed configuration options and troubleshooting, refer to the [documentation](charts/keep/README.md).
4 changes: 2 additions & 2 deletions charts/keep/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v2
name: keep
version: 0.1.24
version: 0.1.25
description: Keep Helm Chart
type: application
icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75
appVersion: 0.26.1
appVersion: 0.27.0
deprecated: false
annotations:
app: keep
Expand Down
132 changes: 72 additions & 60 deletions charts/keep/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keep

![Version: 0.1.18](https://img.shields.io/badge/Version-0.1.18-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.25.3](https://img.shields.io/badge/AppVersion-0.25.3-informational?style=flat-square)
![Version: 0.1.25](https://img.shields.io/badge/Version-0.1.25-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.27.0](https://img.shields.io/badge/AppVersion-0.27.0-informational?style=flat-square)

Keep Helm Chart

Expand All @@ -27,6 +27,13 @@ Keep Helm Chart
| backend.autoscaling.minReplicas | int | `1` | |
| backend.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| backend.autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| backend.backendConfig.healthCheck.checkIntervalSec | int | `30` | |
| backend.backendConfig.healthCheck.healthyThreshold | int | `1` | |
| backend.backendConfig.healthCheck.path | string | `"/docs"` | |
| backend.backendConfig.healthCheck.port | int | `8080` | |
| backend.backendConfig.healthCheck.timeoutSec | int | `10` | |
| backend.backendConfig.healthCheck.type | string | `"HTTP"` | |
| backend.backendConfig.healthCheck.unhealthyThreshold | int | `3` | |
| backend.databaseConnectionStringFromSecret.enabled | bool | `false` | |
| backend.databaseConnectionStringFromSecret.secretKey | string | `""` | |
| backend.databaseConnectionStringFromSecret.secretName | string | `""` | |
Expand All @@ -37,18 +44,16 @@ Keep Helm Chart
| backend.env[1].value | string | `"k8s"` | |
| backend.env[2].name | string | `"PORT"` | |
| backend.env[2].value | string | `"8080"` | |
| backend.env[3].name | string | `"SECRET_MANAGER_DIRECTORY"` | |
| backend.env[3].value | string | `"/state"` | |
| backend.env[4].name | string | `"PUSHER_APP_ID"` | |
| backend.env[4].value | int | `1` | |
| backend.env[5].name | string | `"PUSHER_APP_KEY"` | |
| backend.env[5].value | string | `"keepappkey"` | |
| backend.env[6].name | string | `"PUSHER_APP_SECRET"` | |
| backend.env[6].value | string | `"keepappsecret"` | |
| backend.env[7].name | string | `"PUSHER_HOST"` | |
| backend.env[7].value | string | `"keep-websocket"` | |
| backend.env[8].name | string | `"PUSHER_PORT"` | |
| backend.env[8].value | int | `6001` | |
| backend.env[3].name | string | `"PUSHER_APP_ID"` | |
| backend.env[3].value | int | `1` | |
| backend.env[4].name | string | `"PUSHER_APP_KEY"` | |
| backend.env[4].value | string | `"keepappkey"` | |
| backend.env[5].name | string | `"PUSHER_APP_SECRET"` | |
| backend.env[5].value | string | `"keepappsecret"` | |
| backend.env[6].name | string | `"PUSHER_HOST"` | |
| backend.env[6].value | string | `"keep-websocket"` | |
| backend.env[7].name | string | `"PUSHER_PORT"` | |
| backend.env[7].value | int | `6001` | |
| backend.extraInitContainers | list | `[]` | |
| backend.extraVolumeMounts | list | `[]` | |
| backend.extraVolumes | list | `[]` | |
Expand All @@ -59,15 +64,7 @@ Keep Helm Chart
| backend.healthCheck.probes.readinessProbe.tcpSocket.port | int | `8080` | |
| backend.image.pullPolicy | string | `"Always"` | |
| backend.image.repository | string | `"us-central1-docker.pkg.dev/keephq/keep/keep-api"` | |
| backend.image.tag | string | `"{{ .Chart.AppVersion }}"` | |
| backend.imagePullSecrets | list | `[]` | |
| backend.ingress.annotations | object | `{}` | |
| backend.ingress.className | string | `""` | |
| backend.ingress.enabled | bool | `true` | |
| backend.ingress.hosts[0].host | string | `"chart-example-backend.local"` | |
| backend.ingress.hosts[0].paths[0].path | string | `"/"` | |
| backend.ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| backend.ingress.tls | list | `[]` | |
| backend.nodeSelector | object | `{}` | |
| backend.openAiApi.enabled | bool | `false` | |
| backend.openAiApi.openAiApiKey | string | `""` | |
Expand Down Expand Up @@ -126,47 +123,34 @@ Keep Helm Chart
| frontend.autoscaling.minReplicas | int | `1` | |
| frontend.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| frontend.autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| frontend.backendConfig.healthCheck.checkIntervalSec | int | `30` | |
| frontend.backendConfig.healthCheck.healthyThreshold | int | `1` | |
| frontend.backendConfig.healthCheck.path | string | `"/signin"` | |
| frontend.backendConfig.healthCheck.port | int | `3000` | |
| frontend.backendConfig.healthCheck.timeoutSec | int | `10` | |
| frontend.backendConfig.healthCheck.type | string | `"HTTP"` | |
| frontend.backendConfig.healthCheck.unhealthyThreshold | int | `3` | |
| frontend.enabled | bool | `true` | |
| frontend.env[0].name | string | `"NEXTAUTH_SECRET"` | |
| frontend.env[0].value | string | `"secret"` | |
| frontend.env[10].name | string | `"PUSHER_PORT"` | |
| frontend.env[10].value | int | `6001` | |
| frontend.env[11].name | string | `"PUSHER_APP_KEY"` | |
| frontend.env[11].value | string | `"keepappkey"` | |
| frontend.env[1].name | string | `"NEXTAUTH_URL"` | |
| frontend.env[1].value | string | `"http://localhost:3000"` | |
| frontend.env[2].name | string | `"API_URL"` | |
| frontend.env[2].value | string | `"http://keep-backend:8080"` | |
| frontend.env[3].name | string | `"NEXT_PUBLIC_API_URL"` | |
| frontend.env[3].value | string | `""` | |
| frontend.env[4].name | string | `"NEXT_PUBLIC_POSTHOG_KEY"` | |
| frontend.env[4].value | string | `"phc_muk9qE3TfZsX3SZ9XxX52kCGJBclrjhkP9JxAQcm1PZ"` | |
| frontend.env[5].name | string | `"NEXT_PUBLIC_POSTHOG_HOST"` | |
| frontend.env[5].value | string | `"https://app.posthog.com"` | |
| frontend.env[6].name | string | `"ENV"` | |
| frontend.env[6].value | string | `"development"` | |
| frontend.env[7].name | string | `"NODE_ENV"` | |
| frontend.env[7].value | string | `"development"` | |
| frontend.env[8].name | string | `"HOSTNAME"` | |
| frontend.env[8].value | string | `"0.0.0.0"` | |
| frontend.env[9].name | string | `"PUSHER_HOST"` | |
| frontend.env[9].value | string | `"keep-websocket.default.svc.cluster.local"` | |
| frontend.env[1].name | string | `"VERCEL"` | |
| frontend.env[1].value | int | `1` | |
| frontend.env[2].name | string | `"ENV"` | |
| frontend.env[2].value | string | `"development"` | |
| frontend.env[3].name | string | `"NODE_ENV"` | |
| frontend.env[3].value | string | `"development"` | |
| frontend.env[4].name | string | `"HOSTNAME"` | |
| frontend.env[4].value | string | `"0.0.0.0"` | |
| frontend.env[5].name | string | `"PUSHER_APP_KEY"` | |
| frontend.env[5].value | string | `"keepappkey"` | |
| frontend.healthCheck.enabled | bool | `false` | |
| frontend.healthCheck.probes.livenessProbe.httpGet.path | string | `"/"` | |
| frontend.healthCheck.probes.livenessProbe.httpGet.port | string | `"http"` | |
| frontend.healthCheck.probes.readinessProbe.httpGet.path | string | `"/"` | |
| frontend.healthCheck.probes.readinessProbe.httpGet.port | string | `"http"` | |
| frontend.image.pullPolicy | string | `"Always"` | |
| frontend.image.repository | string | `"us-central1-docker.pkg.dev/keephq/keep/keep-ui"` | |
| frontend.image.tag | string | `"{{ .Chart.AppVersion }}"` | |
| frontend.imagePullSecrets | list | `[]` | |
| frontend.ingress.annotations | object | `{}` | |
| frontend.ingress.className | string | `""` | |
| frontend.ingress.enabled | bool | `true` | |
| frontend.ingress.hosts[0].host | string | `"chart-example.local"` | |
| frontend.ingress.hosts[0].paths[0].path | string | `"/"` | |
| frontend.ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| frontend.ingress.tls | list | `[]` | |
| frontend.nodeSelector | object | `{}` | |
| frontend.podAnnotations | object | `{}` | |
| frontend.podSecurityContext | object | `{}` | |
Expand All @@ -185,8 +169,28 @@ Keep Helm Chart
| frontend.serviceAccount.name | string | `""` | |
| frontend.tolerations | list | `[]` | |
| fullnameOverride | string | `""` | |
| global.ingress.annotations | object | `{}` | |
| global.ingress.backendPrefix | string | `"/v2"` | |
| global.ingress.className | string | `"nginx"` | |
| global.ingress.enabled | bool | `true` | |
| global.ingress.frontendPrefix | string | `"/"` | |
| global.ingress.hosts | list | `[]` | |
| global.ingress.tls | list | `[]` | |
| global.ingress.websocketPrefix | string | `"/websocket"` | |
| ingress-nginx.controller.admissionWebhooks.certManager.enabled | bool | `false` | |
| ingress-nginx.controller.admissionWebhooks.failurePolicy | string | `"Ignore"` | |
| ingress-nginx.controller.admissionWebhooks.patch.enabled | bool | `true` | |
| ingress-nginx.controller.admissionWebhooks.patch.image.pullPolicy | string | `"IfNotPresent"` | |
| ingress-nginx.controller.allowSnippetAnnotations | bool | `true` | |
| ingress-nginx.controller.service.annotations | object | `{}` | |
| ingress-nginx.controller.service.enabled | bool | `true` | |
| ingress-nginx.controller.service.ports.http | int | `80` | |
| ingress-nginx.controller.service.ports.https | int | `443` | |
| ingress-nginx.controller.service.type | string | `"LoadBalancer"` | |
| ingress-nginx.enabled | bool | `true` | |
| isGKE | bool | `false` | |
| nameOverride | string | `""` | |
| namespace | string | `"default"` | |
| namespace | string | `"keep"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
Expand All @@ -197,14 +201,18 @@ Keep Helm Chart
| websocket.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| websocket.autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| websocket.enabled | bool | `true` | |
| websocket.env[0].name | string | `"SOKETI_USER_AUTHENTICATION_TIMEOUT"` | |
| websocket.env[0].value | int | `3000` | |
| websocket.env[1].name | string | `"SOKETI_DEFAULT_APP_ID"` | |
| websocket.env[1].value | int | `1` | |
| websocket.env[2].name | string | `"SOKETI_DEFAULT_APP_KEY"` | |
| websocket.env[2].value | string | `"keepappkey"` | |
| websocket.env[3].name | string | `"SOKETI_DEFAULT_APP_SECRET"` | |
| websocket.env[3].value | string | `"keepappsecret"` | |
| websocket.env[0].name | string | `"SOKETI_HOST"` | |
| websocket.env[0].value | string | `"0.0.0.0"` | |
| websocket.env[1].name | string | `"SOKETI_DEBUG"` | |
| websocket.env[1].value | string | `"1"` | |
| websocket.env[2].name | string | `"SOKETI_USER_AUTHENTICATION_TIMEOUT"` | |
| websocket.env[2].value | int | `3000` | |
| websocket.env[3].name | string | `"SOKETI_DEFAULT_APP_ID"` | |
| websocket.env[3].value | int | `1` | |
| websocket.env[4].name | string | `"SOKETI_DEFAULT_APP_KEY"` | |
| websocket.env[4].value | string | `"keepappkey"` | |
| websocket.env[5].name | string | `"SOKETI_DEFAULT_APP_SECRET"` | |
| websocket.env[5].value | string | `"keepappsecret"` | |
| websocket.healthCheck.enabled | bool | `false` | |
| websocket.healthCheck.probes.livenessProbe.httpGet.path | string | `"/"` | |
| websocket.healthCheck.probes.livenessProbe.httpGet.port | string | `"http"` | |
Expand All @@ -219,6 +227,10 @@ Keep Helm Chart
| websocket.podSecurityContext | object | `{}` | |
| websocket.replicaCount | int | `1` | |
| websocket.resources | object | `{}` | |
| websocket.route.enabled | bool | `false` | |
| websocket.route.host | string | `"chart-example.local"` | |
| websocket.route.tls | list | `[]` | |
| websocket.route.wildcardPolicy | string | `"None"` | |
| websocket.securityContext | object | `{}` | |
| websocket.service.port | int | `6001` | |
| websocket.service.type | string | `"ClusterIP"` | |
Expand Down
Loading

0 comments on commit 9b0f15e

Please sign in to comment.