AI's Wide Shut code · Part 4 — Your Own Private AI

Chapter 13 The Server Route

4 blocks · pp. 65–68 in the paperback

Step 1: Update the Compose File

# p. 65

File /opt/stacks/ollama/docker-compose.yml

Replaces the file from Be Your Own Cloud, Chapter 16.

services:
  ollama:
    image: ollama/ollama:0.35.0
    container_name: ollama
    restart: unless-stopped
    environment:
      - OLLAMA_NO_CLOUD=1   # local models only
    volumes:
      - ./ollama-data:/root/.ollama
    ports:
      - '127.0.0.1:11434:11434'

  open-webui:
    image: ghcr.io/open-webui/open-webui:v0.11.4
    container_name: open-webui
    restart: unless-stopped
    depends_on:
      - ollama
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
      - WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}
      - ENABLE_SIGNUP=false
      - OFFLINE_MODE=true
      - ENABLE_OPENAI_API=false
      - ENABLE_COMMUNITY_SHARING=false
      - ENABLE_ADMIN_CHAT_ACCESS=false
      - ENABLE_ADMIN_EXPORT=false
      - RAG_EMBEDDING_ENGINE=ollama   # document search, Chapter 15
      - RAG_EMBEDDING_MODEL=nomic-embed-text
      - ENABLE_TOOL_PERMISSIONS=true   # approvals, Chapter 18
    volumes:
      - ./webui-data:/app/backend/data
    networks:
      - default
      - proxy   # Chapter 8's shared network -- no host port published

networks:
  proxy:
    external: true

Step 2: Create the Secret Key

# p. 66

Run Terminal, on the server
cd /opt/stacks/ollama
echo "WEBUI_SECRET_KEY=$(openssl rand -hex 32)" > .env
chmod 600 .env

# p. 66

Run Terminal, in /opt/stacks/ollama
docker compose up -d

Step 5: Pull Models for Everyone

# p. 68

Run Terminal, on the server
docker exec -it ollama ollama pull qwen3:8b
docker exec -it ollama ollama pull nomic-embed-text

Current model suggestions →

Reproduced exactly from AI's Wide Shut, Chapter 13. The book explains what each line does and what to do when it doesn't work. About the book

Something here not working as the book describes? Tell the author.