Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.

add-on registry tests last commit release

DDEV Assistant Ollama

Overview

This add-on installs Ollama inside the web container of your DDEV project, so local models are available to your code with no extra setup.

The ollama command works in ddev ssh and ddev exec, and the Ollama API answers on http://localhost:11434 inside the web container. Models are downloaded once per machine and shared by every project that uses this add-on.

Requirements

Installation

ddev add-on get brookemahoney/ddev-assistant-ollama
ddev restart

After installation, make sure to commit the .ddev directory to version control.

Usage

Command Description
ddev exec ollama run <model> Run a model, downloading it first if needed
ddev exec ollama list List downloaded models
ddev exec ddev-ollama-start Start the server, if it is not already running
ddev describe View the Ollama endpoint in the service table

From inside the web container, the API is at http://localhost:11434, or http://web:11434 from another container in the same project:

ddev exec ollama run llama3.2
ddev exec curl -s http://localhost:11434/api/version

Configuration

The add-on sets two environment variables, and only as defaults, so a project can override either of them with web_environment in .ddev/config.local.yaml:

Variable Default Description
OLLAMA_HOST 0.0.0.0:11434 Where the server listens. Point it at a non-local address, such as host.docker.internal:11434, to use an Ollama that already runs on the host; the add-on then does not start a server of its own.
OLLAMA_MODELS /mnt/ddev-global-cache/assistant-ollama/models Where models are stored. The DDEV global cache is per machine, so a model is downloaded once for all projects.
# .ddev/config.local.yaml
web_environment:
  - OLLAMA_HOST=127.0.0.1:11435

Server logs are in /tmp/ollama.log inside the web container:

ddev exec tail -f /tmp/ollama.log

Reaching Ollama from the host

The port is not published by default, because the server is meant for the web container. To reach it from the host as well, publish it on the web service:

# .ddev/docker-compose.web-ports.yaml
services:
  web:
    ports:
      - "11434"

ddev describe then shows the host port to use.

How it works

Notes

Credits

Contributed and maintained by @brookemahoney

If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.