> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qodo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Context Engine

> Follow this guide to set up, install, and begin using the Context Engine in on-prem environments.

<Note>
  **Context Engine documentation**

  [See the full Context Engine documentation](/core-concepts/context-engine) for more details on the Context Engine.
</Note>

## Prerequisites

### Infrastructure requirements

The machine running the Context Engine components should have at least:

* **vCPU:** 8

* 16 **GB RAM**

**PostgreSQL Instance (Recommended Size):**

* **vCPU**: 4

* **Memory**: 32 GB

* **Disk**: 100 GB

> You may opt for smaller instances if working with a relatively small codebase.

**PostgreSQL Version**: 17

**Required Configuration:**

* `pg_vector` extension installed

  *Note: This is pre-installed in managed cloud deployments.*

* TCP port `5432` must be accessible from the Kubernetes cluster where the Context Engine will be deployed

* Two separate databases:

  * `rag-indexer`

  * `metadata`

* Two PostgreSQL users with full access to their respective databases

#### Supported Git providers:

* GitHub (Cloud or Enterprise)

* GitLab

* Bitbucket Data Center

### Models supported

These models are used by the Context Engine and must be available for the Context Engine to be used:

* `gpt-5`

* `claude-4.1-opus`

<Note>
  Contact Qodo support if **none of these AI models are supported by your system**.
</Note>

<Note>
  Contact Qodo support If you're using a **custom LLM gateway**.
</Note>

## 1. Context Engine installation

The Context Engine consists of a few components. Install them **in the following order**:

1. `metadata-service`

2. `rag-indexer`

3. `context-retriever`

4. `context-retriever-mcp` (only if you'd like to connect your codebase understanding capabilities to tools that are not Qodo Gen or Qodo Merge).

We recommend deploying all components in the **same Kubernetes namespace**.

Each component requires its own `values.yaml` file with configuration like the following.

### 1. metadata-service

**Example** `metadata-values.yaml`**:**

```yaml expandable theme={null}
image:
  repository: artif-reg-self-hosted.codium.ai/proxy/codium-stack/us-central1-docker.pkg.dev/codium-production/codium-repo-self-hosted/qodo-engine-metadata
  tag: 1.33.1
  
deployments:
  enabled: true
  resources:
    requests:
      cpu: "500m"
      memory: "2Gi"
  ports:
    - containerPort: 8000
      name: http
  probes:
    liveness:
      httpGet:
        path: /api/v1/health
        port: http
      initialDelaySeconds: 15
      failureThreshold: 5
      periodSeconds: 30
      successThreshold: 1

service:
  enabled: true
  type: NodePort
  port: 8000
  ports:
    http:
      targetPort: http

# add externalSecrets block here if needed

volumes:
  qodo-aware-secrets:
    secret:
      secretName: qodo-aware-secrets

volumeMounts:
  qodo-aware-secrets:
    mountPath: /workspace/app/config_prod
```

**Install with Helm:**

```bash theme={null}
helm upgrade --install metadata-service oci://artifacts-self-hosted.qodo.ai/codium-stack/stable/module -f ./metadata-values.yaml
```

### 2. rag-indexer

```bash expandable theme={null}
image:
  repository: artif-reg-self-hosted.codium.ai/proxy/codium-stack/us-central1-docker.pkg.dev/codium-production/codium-repo-self-hosted/qodo-engine-indexer
  tag: 1.33.1
  
deployments:
  enabled: true
  resources:
    requests:
      cpu: "500m"
      memory: "2Gi"
  ports:
    - containerPort: 3000
      name: http
  probes:
    liveness:
      httpGet:
        path: /api/v1/indexer/health
        port: http
      initialDelaySeconds: 15
      failureThreshold: 5
      periodSeconds: 30
      successThreshold: 1

service:
  enabled: true
  type: NodePort
  port: 3000
  ports:
    http:
      targetPort: http

# add externalSecrets block here if needed

volumes:
  qodo-aware-secrets:
    secret:
      secretName: qodo-aware-secrets

volumeMounts:
  qodo-aware-secrets:
    mountPath: /workspace/qodo_engine/shared_settings/secrets

cronJobs:
  reindex:
    schedule: "0 3 * * *"
    concurrencyPolicy: "Allow"
    suspend: false
    image:
      repository: curlimages/curl
      tag: 8.11.1
      pullPolicy: IfNotPresent
    command:
      - "/bin/sh"
      - "-c"
      - "curl -X POST -H 'Content-Type: application/json' -d '{}' http://indexer:3000/api/v1/indexer/reindex"

configMaps:
  main:
    REINDEX_CRONJOB_SCHEDULE: "0 3 * * *"
    ENVIRONMENT_TYPE: "ON_PREM"
```

**Install with Helm:**

```bash theme={null}
helm upgrade --install rag-indexer oci://artifacts-self-hosted.qodo.ai/codium-stack/stable/module -f ./rag-indexer-values.yaml
```

### 3. context-retriever

```yaml expandable theme={null}
image:
  repository: artif-reg-self-hosted.codium.ai/proxy/codium-stack/us-central1-docker.pkg.dev/codium-production/codium-repo-self-hosted/qodo-engine-context-retriever
  tag: 1.33.1
  
deployments:
  enabled: true
  resources:
    requests:
      cpu: "500m"
      memory: "2Gi"
  ports:
    - containerPort: 8001
      name: http
  probes:
    liveness:
      httpGet:
        path: /v1/context/health
        port: http
      initialDelaySeconds: 15
      failureThreshold: 5
      periodSeconds: 30
      successThreshold: 1

service:
  enabled: true
  type: NodePort
  port: 8001
  ports:
    http:
      targetPort: http

volumes:
  qodo-aware-secrets:
    secret:
      secretName: qodo-aware-secrets

# add externalSecrets block here if needed

volumeMounts:
  qodo-aware-secrets:
    mountPath: /app/qodo_engine/shared_settings/secrets

envFrom:
  configMapRefs:
    - name: main

configMaps:
  main:
    SERVICE_CONFIG__AUTH_BACKEND_PROVIDER: "noauth"
    ENVIRONMENT_TYPE: "ON_PREM"
    test: "TEsts"
```

**Install with Helm:**

```bash theme={null}
helm upgrade --install context-retriever oci://artifacts-self-hosted.qodo.ai/codium-stack/stable/module -f ./context-retriever-values.yaml
```

4. Trigger initial indexing (if you prefer to not wait until the cronjob is triggered): `kubectl create job indexer-reindex-manual --from=cronjob/indexer-reindex`

5. Verify `indexer` pod (that is part of the deployment, not the job) logs, to confirm indexing has completed (can take anywhere from minutes to up to a day, depends on how many repositories are configured and how big they are).

### 4. context-retriever-mcp

<Note>
  **Note**: Set `context-retriever-mcp` only if you'd like to connect your codebase understanding capabilities to tools that are not Qodo Gen or Qodo Merge.
</Note>

```yaml expandable theme={null}
image:
  repository: artif-reg-self-hosted.codium.ai/proxy/codium-stack/us-central1-docker.pkg.dev/codium-production/codium-repo-self-hosted/qodo-engine-context-retriever
  tag: 1.5.0
  
deployments:
  enabled: true
  resources:
    requests:
      cpu: "500m"
      memory: "2Gi"
  ports:
    - containerPort: 8001
      name: http
  probes:
    liveness:
      httpGet:
        path: /health
        port: http
      initialDelaySeconds: 15
      failureThreshold: 5
      periodSeconds: 30
      successThreshold: 1

ingress:
  enabled: true
  host: "" # add client host here
  annotations:
    # add relevant annotations here
  hosts:
    - paths:
        - path: /mcp
          pathType: Prefix

replicaCount: 1

service:
  enabled: true
  type: NodePort
  port: 8001
  ports:
    http:
      targetPort: http

volumes:
  qodo-aware-secrets:
    secret:
      secretName: qodo-aware-secrets

# add externalSecrets block here if needed

volumeMounts:
  qodo-aware-secrets:
    mountPath: /app/qodo_engine/shared_settings/secrets

envFrom:
  configMapRefs:
    - name: main

configMaps:
  main:
    SERVICE_CONFIG__EXPOSE_MCP_SERVER: "true"
    ENVIRONMENT_TYPE: "ON_PREM"
    SERVICE_CONFIG__AUTH_BACKEND_PROVIDER: "local"
```

## 2. Finish setup on your version control

Finish setting up Qodo Aware on your version control:

<CardGroup>
  <Card title="GitHub" href="/on-prem/git-integration/install/github" img="https://mintcdn.com/qodo/8f9QSVoLIbSaCs56/images/on-prem/card-github.png?fit=max&auto=format&n=8f9QSVoLIbSaCs56&q=85&s=cd5f89266dfd192aee6f8c9707e0b676" width="1380" height="898" data-path="images/on-prem/card-github.png" />

  <Card title="GitLab" href="/on-prem/git-integration/install/gitlab" img="https://mintcdn.com/qodo/8f9QSVoLIbSaCs56/images/on-prem/card-gitlab.png?fit=max&auto=format&n=8f9QSVoLIbSaCs56&q=85&s=1f29c8f6cd70a9106b4ebddaa0a4c60a" width="1380" height="898" data-path="images/on-prem/card-gitlab.png" />
</CardGroup>

### Bitbucket Data Center

### 2.1 Custom CA

If you are using an on-prem git provider with HTTPS connection from qodo-engine you will need to configure the custom CA like this:

```yaml hoghlight= [{1-2}] theme={null}
configMaps:
  main:
    CONFIG__CERTIFICATE_BUNDLE: "/etc/ssl/custom/ca.pem"

volumeMounts:
  custom-ca:
    mountPath: /etc/ssl/custom/ca.pem
    subPath: ca.pem

volumes:
  custom-ca:
    secret:
      secretName: customer-ca-secret
```

## Enabling Context Engine functionality in the Git integration

#### Git Integration

1. Update qodo-merge secret, append the following

```bash theme={null}
[rag_arguments]
enable_rag=true

[context_retrieval_service]
url = "<service name>.<namespace>" # set this to context-retriever service address
```

1. Restart pods to pick up the new secret.
