# MeshWX. Save this file, then:
#
#   docker compose up -d          <- install AND upgrade, same command
#
# Docker fetches the image itself; there is nothing to download by hand. To move
# to a newer release later:
#
#   docker compose pull
#   docker compose up -d
#
# This file does not change between releases, so you never need to replace it.
services:
  mesh-wx:
    # `latest` always resolves to the newest published release, and the image is
    # multi-arch: the same tag serves PCs/servers (amd64) and Raspberry Pi
    # (arm64), so there is no build to pick.
    image: ghcr.io/brokensignal/meshwx:latest
    container_name: mesh-wx
    restart: unless-stopped
    # Dashboard on http://<host>:8110. The app inside listens on 8000.
    ports:
      - "8110:8000"
    environment:
      MESH_WX_PORT: "8000"
      MESH_WX_DB: "/data/mesh-wx.db"
    volumes:
      # SQLite lives here (settings, history, transmit log, dedupe state).
      # Keep this directory and your setup survives every upgrade.
      - ./data:/data
      # Bind-mount the host device tree so the serial nodes AND the stable
      # /dev/serial/by-id/ symlinks are visible inside the container even
      # after re-plugging or ttyUSB* renumbering. Combined with the cgroup
      # rules below, this means a port change never requires a compose edit.
      - /dev:/dev
    # Grant access to USB serial device *classes* rather than pinning one
    # /dev/ttyUSBx path:
    #   188:*  -> USB serial converters (ttyUSB*, e.g. CP210x / CH9102)
    #   166:*  -> USB CDC ACM devices  (ttyACM*)
    device_cgroup_rules:
      - "c 188:* rmw"
      - "c 166:* rmw"
