diff --git a/.github/workflows/helm-tests.yml b/.github/workflows/helm-tests.yml index c9bdb7a5..31ce2270 100644 --- a/.github/workflows/helm-tests.yml +++ b/.github/workflows/helm-tests.yml @@ -81,6 +81,9 @@ jobs: echo "Image tag: $IMAGE_TAG" cat helm/Chart.yaml + - name: Add Helm repositories + run: helm repo add bitnami https://charts.bitnami.com/bitnami + - name: Build Helm dependencies run: helm dependency build helm/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index abd186c4..4f50b4c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: - name: Lint run: | uv run ruff check - uv run ruff format --check + uv run ruff format --diff - name: Run tests run: | NO_COLOR=true uv run pytest --reruns 2 --disable-warnings --log-cli-level=INFO --cov-report xml:cov.xml --cov=bbot_server . diff --git a/README.md b/README.md index 2cf107f7..c06473a8 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,81 @@ Note: this requires Docker and Docker Compose to be installed. bbctl server start ``` +## Deploy with Helm (Kubernetes) + +BBOT Server can be deployed to Kubernetes using its official Helm chart. The chart deploys the API server, watchdog, MongoDB, and Redis. + +### Quick Start + +```bash +# Add the Helm repo +helm repo add blacklanternsecurity https://blacklanternsecurity.github.io/bbot-server + +# Install +helm install bbot blacklanternsecurity/bbot-server +``` + +Or install directly from the OCI registry: + +```bash +helm install bbot oci://registry-1.docker.io/blacklanternsecurity/bbot-server +``` + +### Configuration + +Key values can be overridden with `--set` or a custom values file: + +```bash +helm install bbot blacklanternsecurity/bbot-server \ + --set ingress.enabled=true \ + --set ingress.hosts[0].host=bbot.example.com \ + --set ingress.hosts[0].paths[0].path=/ \ + --set ingress.hosts[0].paths[0].pathType=Prefix +``` + +Or with a values file: + +```yaml +# custom-values.yaml +ingress: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: letsencrypt + hosts: + - host: bbot.example.com + paths: + - path: / + pathType: Prefix + tls: + - secretName: bbot-tls + hosts: + - bbot.example.com + +secrets: + # provide your own API key, or leave empty to auto-generate + apiKey: "" +``` + +```bash +helm install bbot blacklanternsecurity/bbot-server -f custom-values.yaml +``` + +### Retrieving the API Key + +If you didn't provide an API key, one is auto-generated. Retrieve it with: + +```bash +kubectl get secret bbot-api-key -o jsonpath='{.data.api-key}' | base64 -d +``` + +### Upgrading + +```bash +helm repo update +helm upgrade bbot blacklanternsecurity/bbot-server +``` + ## Interacting with BBOT Server Remotely (Multiplayer) By default, BBOT Server listens on localhost. Use `--listen` to expose it to the network: diff --git a/pyproject.toml b/pyproject.toml index 4b3e7947..76d73473 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bbot-server" -version = "0.1.0" +version = "0.1.1" description = "" authors = [{name = "TheTechromancer"}] license = "AGPL-3.0" diff --git a/test_helm_deployment.py b/test_helm_deployment.py index d642ec9a..b7045f4c 100644 --- a/test_helm_deployment.py +++ b/test_helm_deployment.py @@ -216,7 +216,9 @@ def setUpClass(cls): ) print("Image loaded successfully") - # Update Helm dependencies + # Add Helm repositories and update dependencies + print("Adding Helm repositories...") + cls.helm("repo", "add", "bitnami", "https://charts.bitnami.com/bitnami", timeout=30) print("Updating Helm dependencies...") cls.helm("dependency", "update", "helm/", timeout=60)