# Teaching template: review every setting before production.
services:
  postgres:
    image: postgres:17-alpine
    environment:
      POSTGRES_DB: perfectworld
      POSTGRES_USER: perfectworld
      POSTGRES_PASSWORD: CHANGE_ME_LONG_RANDOM
    volumes:
      - /srv/fast/postgres:/var/lib/postgresql/data
    restart: unless-stopped
    networks: [private]

  redis:
    image: redis:7-alpine
    command: ["redis-server", "--appendonly", "yes"]
    volumes:
      - /srv/fast/redis:/data
    restart: unless-stopped
    networks: [private]

  mediamtx:
    image: bluenviron/mediamtx:1.20.0
    volumes:
      - ./mediamtx.yml:/mediamtx.yml:ro
      - /srv/archive/video:/recordings
    ports:
      - "127.0.0.1:8888:8888" # HLS; publish through authenticated proxy
      - "8554:8554"            # RTSP camera VLAN only
    restart: unless-stopped
    networks: [private]

  llama:
    image: ghcr.io/ggml-org/llama.cpp:server-rocm
    devices:
      - /dev/kfd:/dev/kfd
      - /dev/dri:/dev/dri
    group_add: ["video"]
    volumes:
      - /srv/fast/models:/models:ro
    command: ["-m", "/models/replace-with-model.gguf", "--host", "0.0.0.0", "--port", "8080", "--n-gpu-layers", "99"]
    expose: ["8080"]
    restart: unless-stopped
    networks: [private]

networks:
  private:
    internal: true
