engram

Deployment Guide

This guide covers different deployment methods for Engram in production and development.

Quick Start (Development)

For local development with persistent storage and auto-restart:

macOS/Windows

just docker-up

This uses docker-compose.yml which connects to an embeddings server (LM Studio, Ollama, …) on your host machine via host.docker.internal.

Linux

just docker-up-linux

This uses docker-compose.linux.yml which uses host networking to connect to the embeddings server.

Common Commands

just docker-down       # Stop services
just docker-logs       # View logs
just docker-restart    # Restart services

Docker Compose

macOS/Windows Configuration

docker-compose.yml:

services:
  engram:
    build: .
    container_name: engram
    restart: unless-stopped
    ports:
      - "3490:3490"
    volumes:
      - engram-data:/data
    environment:
      - DUCKDB_PATH=/data/engram.duckdb
      - EMBEDDING_URL=http://host.docker.internal:11434
      - EMBEDDING_MODEL=nomic-embed-text
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      - engram-network

volumes:
  engram-data:
    driver: local

networks:
  engram-network:
    driver: bridge

Key features:

Linux Configuration

docker-compose.linux.yml:

services:
  engram:
    build: .
    container_name: engram
    restart: unless-stopped
    network_mode: host
    volumes:
      - engram-data:/data
    environment:
      - DUCKDB_PATH=/data/engram.duckdb
      - EMBEDDING_URL=http://localhost:11434
      - EMBEDDING_MODEL=nomic-embed-text

volumes:
  engram-data:
    driver: local

Key differences:

Manual Docker Usage

docker build -t engram .
docker run -p 3490:3490 \
           -e EMBEDDING_URL=http://host.docker.internal:11434 \
           -v $(pwd)/data:/data \
           -e DUCKDB_PATH=/data/engram.duckdb \
           engram

The server exposes:

Kubernetes Deployment

Engram can be deployed to Kubernetes with persistent storage:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: engram
spec:
  replicas: 1
  template:
    spec:
      containers:
        - name: engram
          image: your-registry/engram:latest
          command: ["/engram", "serve"]
          env:
            - name: DUCKDB_PATH
              value: "/data/engram.duckdb"
            - name: EMBEDDING_URL
              value: "http://ollama-service:11434"
            - name: EMBEDDING_MODEL
              value: "nomic-embed-text"
          ports:
            - containerPort: 3490
          volumeMounts:
            - name: data
              mountPath: /data
          readinessProbe:
            httpGet:
              path: /ready
              port: 3490
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /health
              port: 3490
            initialDelaySeconds: 10
            periodSeconds: 30
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: engram-data
---
apiVersion: v1
kind: Service
metadata:
  name: engram
spec:
  selector:
    app: engram
  ports:
    - port: 3490
      targetPort: 3490
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: engram
  annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
spec:
  rules:
    - host: engram.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: engram
                port:
                  number: 3490

Important: SSE connections require long timeouts and no buffering. The ingress annotations above are critical for stable MCP connections.

Troubleshooting

Docker on macOS: Cannot connect to the embeddings server

If you see connection errors to the embeddings server (e.g., Ollama):

  1. Verify Ollama is running: ollama list
  2. Check the extra_hosts configuration is present in docker-compose.yml
  3. Try accessing the embeddings server from within the container:
    docker exec -it engram /bin/sh
    curl http://host.docker.internal:11434/api/tags
    

Docker on Linux: Port conflicts

If using network_mode: host, ensure port 3490 is available:

sudo lsof -i :3490

Volume permissions

If you encounter permission errors with the volume:

# Check volume location
docker volume inspect engram-data

# On Linux, you may need to adjust ownership
docker run --rm -v engram-data:/data alpine chown -R 1000:1000 /data

Viewing logs

# Docker Compose
docker compose logs -f engram

# Docker directly
docker logs -f engram