Mitigate AI Platform
App setup

Kubernetes Setup

Install and deploy the application on Kubernetes

Install

Install kubectl and helm CLI tools:

# macOS
brew install kubectl helm
# ubuntu
snap install helm --classic

Get and set the current kubectl and helm context:

kubectl config get-contexts
kubectl config use-context root@<host>

Create kubernetes namespace for chatbot:

kubectl create namespace chatbot

Install cert-manager:

helm install \
  cert-manager oci://quay.io/jetstack/charts/cert-manager \
  --version v1.18.2 \
  --namespace cert-manager \
  --create-namespace \
  --set crds.enabled=true

Install letsencrypt issuer:

kubectl apply -f - <<EOF
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    # The ACME server URL
    server: https://acme-v02.api.letsencrypt.org/directory
    # Email address used for ACME registration
    email: admin@mitigate.dev
    # The ACME certificate profile
    profile: tlsserver
    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: letsencrypt-prod
    # Enable the HTTP-01 challenge provider
    solvers:
      - http01:
          ingress: {}
EOF

Install postgres & minio (skip this when using external services):

helm install chatbot-postgresql oci://registry-1.docker.io/bitnamicharts/postgresql -n chatbot
helm install chatbot-minio oci://registry-1.docker.io/bitnamicharts/minio \
  -n chatbot \
  --set defaultBuckets=chatbot-uploads \
  --set ingress.enabled=true \
  --set ingress.tls=true \
  --set ingress.ingressClassName=traefik \
  --set ingress.annotations.cert-manager\\.io/cluster-issuer=letsencrypt-prod \
  --set ingress.hostname=minio-chatbot-demo.mitigate.dev

PostgreSQL pgvector Extension

The chatbot requires the pgvector extension for vector similarity search.

Using provided PostgreSQL image: The Bitnami PostgreSQL image installed above already includes the pgvector extension. No additional setup is required.

Using custom PostgreSQL: If you're using an external PostgreSQL database or a different Docker image, you must install the pgvector extension. See the official installation instructions: https://github.com/pgvector/pgvector#installation

Options for custom setups:

  • Switch to a PostgreSQL Docker image that includes pgvector
  • Install pgvector manually following the official installation guide

Login to docker registry:

DOCKER_USER='robot$gh-actions'
DOCKER_PASSWORD=ey...kJ0

docker login --username=$DOCKER_USER --password=$DOCKER_PASSWORD core.harbor.makit.lv

Login to helm registry:

helm registry login --username $DOCKER_USER --password $DOCKER_PASSWORD core.harbor.makit.lv

Build & Push Docker Image:

TAG=$(git rev-parse HEAD)

DOCKER_REPOSITORY_URL="core.harbor.makit.lv/mitigate-chatbot/chatbot"

rm -rf tmp/build
TAG=$(git rev-parse HEAD)
git clone .git tmp/build
$(cd tmp/build && git checkout $TAG)
echo $TAG > tmp/build/VERSION
docker build --platform linux/amd64 -t $DOCKER_REPOSITORY_URL:$TAG tmp/build
rm -rf tmp/build

docker tag $DOCKER_REPOSITORY_URL:$TAG $DOCKER_REPOSITORY_URL:latest
docker push $DOCKER_REPOSITORY_URL:$TAG
docker push $DOCKER_REPOSITORY_URL:latest

Package the helm chart:

TAG=$(git rev-parse HEAD)

helm package ./helm --version="1.0.0-$TAG" --app-version=$TAG

Push helm chart to repo:

TAG=$(git rev-parse HEAD)

helm push chatbot-1.0.0-$TAG.tgz oci://core.harbor.makit.lv/mitigate-chatbot

Setup docker registry secret that will be used later in imagePullSecrets[0].name:

DOCKER_USER='robot$gh-actions'
DOCKER_PASSWORD=ey...kJ0

# kubectl delete secret chatbot-registry -n chatbot
kubectl create secret docker-registry chatbot-registry \
  -n chatbot \
  --docker-server=https://core.harbor.makit.lv/ \
  --docker-username=$DOCKER_USER \
  --docker-password=$DOCKER_PASSWORD

Install chatbot helm chart from local package (see helm/values.yaml for available configuration variables):

# kubectl logs job.batch/chatbot-db-setup -n chatbot
# kubectl delete job.batch/chatbot-db-setup -n chatbot

TAG=$(git rev-parse HEAD)

MINIO_ROOT_USER=$(kubectl get secret chatbot-minio -n chatbot -o jsonpath="{.data.root-user}" | base64 -d)

MINIO_ROOT_PASSWORD=$(kubectl get secret chatbot-minio -n chatbot -o jsonpath="{.data.root-password}" | base64 -d)

ACTIVE_STORAGE_CONFIG=$(echo "{\"service\":\"S3\",\"access_key_id\":\"$MINIO_ROOT_USER\",\"secret_access_key\":\"$MINIO_ROOT_PASSWORD\",\"region\": \"us-east-1\",\"bucket\":\"chatbot-uploads\",\"endpoint\":\"https://minio-chatbot-demo.mitigate.dev\",\"force_path_style\":true}" | base64)

DATABASE_URL="postgres://postgres:$(kubectl get secret/chatbot-postgresql -n chatbot -o jsonpath='{.data.postgres-password}' | base64 -d)@chatbot-postgresql/postgres"

SECRET_KEY_BASE=$(openssl rand -hex 64)

helm install chatbot chatbot-1.0.0-$TAG.tgz \
  -n chatbot \
  --set "imagePullSecrets[0].name=chatbot-registry" \
  --set "env.DATABASE_URL=$DATABASE_URL" \
  --set "env.ACTIVE_STORAGE_CONFIG=$ACTIVE_STORAGE_CONFIG" \
  --set "env.SECRET_KEY_BASE=$SECRET_KEY_BASE" \
  --set "env.APP_HOST=chatbot-demo.mitigate.dev"

or install chatbot helm chart from repo:

helm install chatbot oci://core.harbor.makit.lv/mitigate-chatbot/chatbot \
  -n chatbot \
  --version=1.0.0-$TAG \
  --set "imagePullSecrets[0].name=chatbot-registry" \
  --set "env.DATABASE_URL=$DATABASE_URL" \
  --set "env.ACTIVE_STORAGE_CONFIG=$ACTIVE_STORAGE_CONFIG" \
  --set "env.SECRET_KEY_BASE=$SECRET_KEY_BASE" \
  --set "env.APP_HOST=chatbot-demo.mitigate.dev"

Check if everything is OK:

helm list -n chatbot
kubectl get all,cm,secret,ing -n chatbot
kubectl events -n chatbot

Upgrade

Upgrade chatbot helm chart from local package:

TAG=$(git rev-parse HEAD)

helm upgrade chatbot chatbot-1.0.0-$TAG.tgz -n chatbot --reuse-values

or upgrade chatbot helm chart from repo:

TAG=$(git rev-parse HEAD)

helm upgrade chatbot oci://core.harbor.makit.lv/mitigate-chatbot/chatbot -n chatbot --version=1.0.0-$TAG --reuse-values

Environment Variables

For detailed information about all available environment variables and their configuration, see:

These documents provide complete setup instructions, examples, and security best practices for configuring your chatbot deployment.

Maintenance

For ongoing application maintenance, monitoring, and troubleshooting, see:

On this page