# assets/docker-compose.yml

This file is part of the skill, at `assets/docker-compose.yml` relative to the skill's directory. Write the code below to that path in the user's project before running or copying it.

```yaml
# Local Grafana for the product friction dashboard.
#
# Klaviyo remains the only event store. Grafana polls the read API through the
# Infinity data source and holds the key server-side.
#
# Start with:
#   export KLAVIYO_API_KEY="..."   # read key: events:read + metrics:read
#   docker compose up -d
#
# Rotating the key requires recreating the container, not restarting it — a
# restart reuses the environment captured at creation time.

services:
  grafana:
    image: grafana/grafana-oss:latest
    container_name: product-friction-grafana
    ports:
      - "127.0.0.1:3000:3000"
    environment:
      GF_SECURITY_ADMIN_USER: admin
      GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:?set GRAFANA_ADMIN_PASSWORD before starting}
      GF_AUTH_ANONYMOUS_ENABLED: "false"
      GF_PLUGINS_PREINSTALL: yesoreyeram-infinity-datasource
      KLAVIYO_API_KEY: ${KLAVIYO_API_KEY:?set KLAVIYO_API_KEY before starting}
    volumes:
      - ./provisioning:/etc/grafana/provisioning:ro
      - ./dashboards:/var/lib/grafana/dashboards:ro
      - grafana-data:/var/lib/grafana
    restart: unless-stopped

volumes:
  grafana-data:
```
