repos
/ orchard main

orchard

mirror

Every site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.

blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics

2.3 KB · 81 lines · YAML Raw History
 1name: orchard-chat
 2
 3# Two services. The model lives behind llm.bythewood.me now, so this site holds
 4# no weights and asks for no GPU, and the key in .env is what lets it through
 5# that gateway. Beside it sits an offline Wikipedia, which is data rather than
 6# code and is the one image here built by somebody else.
 7
 8services:
 9  app:
10    build:
11      context: .
12      dockerfile: Dockerfile
13    container_name: orchard-chat
14    restart: unless-stopped
15    # Longer than Docker's 10s default so a turn in flight finishes and the
16    # database closes cleanly rather than being killed mid write.
17    stop_grace_period: 30s
18    environment:
19      LLM_URL: http://orchard-llm:8000
20      LLM_KEY: ${LLM_KEY:?create a key at llm.bythewood.me and put it in .env}
21      LLM_CTX: "65536"
22      CHAT_DB: /data/chat.db
23      WIKI_URL: http://orchard-wiki:8000
24    volumes:
25      - data:/data
26    deploy:
27      resources:
28        limits:
29          cpus: "1.00"
30          memory: 512M
31    security_opt:
32      - no-new-privileges:true
33    logging:
34      driver: json-file
35      options:
36        max-size: "10m"
37        max-file: "3"
38    networks: [edge]
39
40  # Every article's opening section, which is the half that answers what and who
41  # and when and the half that fits a small context window. The ZIM is 12.5GB
42  # and `make wiki` from the repo root is what puts it in the volume, since
43  # nothing here can build a file that large.
44  wiki:
45    image: ghcr.io/kiwix/kiwix-serve:3.8.2@sha256:de4d451d9d9e3e2d37c1a7b5a861698c67cc4c52c364c2a593ba554cddd6ce03
46    container_name: orchard-wiki
47    restart: unless-stopped
48    # kiwix names a book after its file, and tools/wikipedia.go asks for
49    # "wikipedia", so renaming this file breaks every lookup with a 400.
50    command: /data/wikipedia.zim
51    environment:
52      PORT: "8000"
53    volumes:
54      - wiki:/data:ro
55    deploy:
56      resources:
57        limits:
58          cpus: "1.00"
59          # It mmaps the ZIM rather than reading it, so this bounds the working
60          # set and not the file. It idles at about 4MB.
61          memory: 1G
62    security_opt:
63      - no-new-privileges:true
64    logging:
65      driver: json-file
66      options:
67        max-size: "10m"
68        max-file: "3"
69    networks: [edge]
70
71volumes:
72  data:
73    name: orchard-chat-data
74  wiki:
75    name: orchard-wiki-data
76
77networks:
78  edge:
79    name: orchard-edge
80    external: true