Skip to content

Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring

2.2 KB
Raw Blame
services:
  backend:
    build:
      context: .
      dockerfile: Dockerfile.backend
    restart: unless-stopped
    env_file:
      - .env
    environment:
      # Override env_file: SQLite path must point inside the container volume
      SQLITE_PATH: /app/data/homelab.db
    volumes:
      - backend_data:/app/data
    networks:
      - homelable
    # Required for ping-based status checks
    cap_add:
      - NET_RAW
    # MAC addresses: on this bridge network the scanner can never see them —
    # ARP is layer 2 and every LAN host is one hop away behind the Docker
    # gateway. To collect MACs (and so keep DHCP devices matched across an IP
    # change), put the backend on the LAN: comment out the `networks:` key
    # above and uncomment the line below (Linux hosts only).
    # network_mode: host
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"]
      interval: 10s
      timeout: 5s
      retries: 6
      start_period: 15s

  mcp:
    build:
      context: ./mcp
      dockerfile: Dockerfile.mcp
    restart: unless-stopped
    ports:
      - "8001:8001"
    env_file:
      - .env
    environment:
      BACKEND_URL: "http://backend:8000"
    depends_on:
      - backend
    networks:
      - homelable
    # Backend on network_mode: host? Use BACKEND_URL "http://host.docker.internal:8000"
    # above, and uncomment:
    # extra_hosts:
    #   - "host.docker.internal:host-gateway"

  frontend:
    build:
      context: .
      dockerfile: Dockerfile.frontend
      args:
        # Serve Homelable under a subpath, e.g. VITE_BASE_PATH=/homelab/ in .env.
        # Defaults to the root — see docs/INSTALLATION.md.
        VITE_BASE_PATH: ${VITE_BASE_PATH:-/}
    restart: unless-stopped
    ports:
      - "3000:80"
    depends_on:
      - backend
    networks:
      - homelable
    # Backend on network_mode: host (see INSTALLATION.md, "Scanning from Docker")?
    # `backend` no longer resolves from this network; keep the frontend here and
    # point nginx at the host instead:
    # environment:
    #   BACKEND_UPSTREAM: "host.docker.internal:8000"
    # extra_hosts:
    #   - "host.docker.internal:host-gateway"

volumes:
  backend_data:

networks:
  homelable:
    driver: bridge